Skip to content

Commit

Permalink
fix: update transactions.submit request (#36)
Browse files Browse the repository at this point in the history
Description
---
updates to changes from tari-project/tari-dan#1151 and tari-project/tari-dan#1153
Version bump to v0.2.0

Motivation and Context
---
Updates to incorporate the improvements to the transaction submit API.
  • Loading branch information
sdbondi authored Sep 18, 2024
1 parent 35ef9bf commit 1dc4699
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 46 deletions.
27 changes: 11 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tari-project/tarijs",
"version": "0.1.24",
"version": "0.2.0",
"description": "",
"type": "module",
"publishConfig": {
Expand All @@ -14,8 +14,8 @@
"license": "ISC",
"dependencies": {
"@metamask/providers": "^9.0.0",
"@tari-project/wallet_jrpc_client": "^1.0.8",
"@tari-project/typescript-bindings": "^1.0.6",
"@tari-project/wallet_jrpc_client": "^1.1.0",
"@tari-project/typescript-bindings": "^1.1.0",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/universal-provider": "^2.13.3"
},
Expand Down
28 changes: 14 additions & 14 deletions src/providers/wallet_daemon/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,24 @@ export class WalletDaemonTariProvider implements TariProvider {

public async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
const params = {
transaction: null,
transaction: {
instructions: req.instructions as Instruction[],
fee_instructions: req.fee_instructions as Instruction[],
inputs: req.required_substates.map((s) => ({
// TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
substate_id: s.substate_id as any,
version: s.version
})),
min_epoch: null,
max_epoch: null,
},
signing_key_index: req.account_id,
fee_instructions: req.fee_instructions as Instruction[],
instructions: req.instructions as Instruction[],
inputs: req.required_substates.map((s) => ({
// TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
substate_id: s.substate_id as any,
version: s.version
})),
input_refs: [],
override_inputs: false,
is_dry_run: req.is_dry_run,
autofill_inputs: [],
detect_inputs: true,
proof_ids: [],
min_epoch: null,
max_epoch: null,
} as TransactionSubmitRequest;
const res = await this.client.submitTransaction(params);

const res = await this.client.submitTransaction(params);
return {transaction_id: res.transaction_id};
}

Expand Down
26 changes: 13 additions & 13 deletions src/providers/walletconnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ export class WalletConnectTariProvider implements TariProvider {
async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
const method = 'tari_submitTransaction';
const params = {
transaction: null,
transaction: {
fee_instructions: req.fee_instructions as Instruction[],
instructions: req.instructions as Instruction[],
inputs: req.required_substates.map((s) => ({
// TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
substate_id: s.substate_id as any,
version: s.version
})),
min_epoch: null,
max_epoch: null,
},
signing_key_index: req.account_id,
fee_instructions: req.fee_instructions as Instruction[],
instructions: req.instructions as Instruction[],
inputs: req.required_substates.map((s) => ({
// TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
substate_id: s.substate_id as any,
version: s.version
})),
input_refs: [],
override_inputs: false,
is_dry_run: req.is_dry_run,
autofill_inputs: [],
detect_inputs: true,
proof_ids: [],
min_epoch: null,
max_epoch: null,
} as TransactionSubmitRequest;

const res = await this.sendRequest(method, params);
Expand Down

0 comments on commit 1dc4699

Please sign in to comment.