@tari-project/tarijs 0.6.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE.md +2 -12
  2. package/Dockerfile +2 -2
  3. package/README.md +1 -1
  4. package/docusaurus/tari-docs/docs/provider-vs-signer.md +27 -0
  5. package/docusaurus/tari-docs/docs/wallet/submit-transaction/build-execute-request.md +0 -2
  6. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/inputs.md +0 -1
  7. package/docusaurus/tari-docs/package-lock.json +17964 -0
  8. package/docusaurus/tari-docs/package.json +2 -2
  9. package/package.json +1 -1
  10. package/packages/builders/package.json +3 -2
  11. package/packages/builders/src/helpers/index.ts +1 -1
  12. package/packages/builders/src/helpers/submitTransaction.ts +26 -31
  13. package/packages/builders/src/helpers/workspace.ts +32 -15
  14. package/packages/builders/src/index.ts +1 -2
  15. package/packages/builders/src/transaction/TransactionBuilder.ts +105 -38
  16. package/packages/builders/src/transaction/TransactionRequest.ts +30 -38
  17. package/packages/indexer_provider/package.json +1 -1
  18. package/packages/metamask_signer/package.json +1 -1
  19. package/packages/metamask_signer/src/index.ts +12 -19
  20. package/packages/tari_permissions/package.json +1 -1
  21. package/packages/tari_permissions/src/tari_permissions.ts +1 -17
  22. package/packages/tari_provider/package.json +1 -1
  23. package/packages/tari_signer/package.json +1 -1
  24. package/packages/tari_universe/package.json +1 -1
  25. package/packages/tarijs/package.json +1 -1
  26. package/packages/tarijs/src/index.ts +0 -8
  27. package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +74 -44
  28. package/packages/tarijs_types/package.json +1 -1
  29. package/packages/tarijs_types/src/SubstateDiff.ts +0 -4
  30. package/packages/tarijs_types/src/SubstateType.ts +1 -1
  31. package/packages/tarijs_types/src/TransactionResult.ts +2 -8
  32. package/packages/tarijs_types/src/TransactionStatus.ts +7 -7
  33. package/packages/tarijs_types/src/helpers/txResult.ts +8 -11
  34. package/packages/tarijs_types/src/index.ts +1 -16
  35. package/packages/tarijs_types/src/signer.ts +6 -11
  36. package/packages/wallet_daemon/package.json +1 -1
  37. package/packages/wallet_daemon/src/signer.ts +12 -25
  38. package/packages/wallet_daemon/src/webrtc.ts +3 -3
  39. package/packages/walletconnect/package.json +1 -1
  40. package/packages/walletconnect/src/index.ts +14 -28
  41. package/pnpm-workspace.yaml +2 -2
  42. package/scripts/check_versions.sh +2 -2
  43. package/scripts/set_package_versions.sh +39 -0
  44. package/packages/tarijs_types/src/FinalizeResult.ts +0 -17
  45. package/packages/tarijs_types/src/Instruction.ts +0 -36
  46. package/packages/tarijs_types/src/SubstateRequirement.ts +0 -6
  47. package/packages/tarijs_types/src/Transaction.ts +0 -16
  48. package/packages/tarijs_types/src/UnsignedTransaction.ts +0 -14
  49. package/packages/tarijs_types/src/VersionedSubstateId.ts +0 -6
@@ -1,7 +1,6 @@
1
1
  import { TariSigner } from "@tari-project/tari-signer";
2
2
  import {
3
3
  SubmitTransactionRequest,
4
- TransactionResult,
5
4
  TransactionStatus,
6
5
  SubmitTransactionResponse,
7
6
  VaultBalances,
@@ -99,11 +98,11 @@ export class MetamaskTariSigner implements TariSigner {
99
98
  }
100
99
 
101
100
  async listSubstates({
102
- filter_by_template,
103
- filter_by_type,
104
- limit,
105
- offset,
106
- }: ListSubstatesRequest): Promise<ListSubstatesResponse> {
101
+ filter_by_template,
102
+ filter_by_type,
103
+ limit,
104
+ offset,
105
+ }: ListSubstatesRequest): Promise<ListSubstatesResponse> {
107
106
  const res = (await this.metamaskRequest("listSubstates", {
108
107
  filter_by_template,
109
108
  filter_by_type,
@@ -115,13 +114,7 @@ export class MetamaskTariSigner implements TariSigner {
115
114
  }
116
115
 
117
116
  async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
118
- const params = {
119
- instructions: req.instructions,
120
- fee_instructions: req.fee_instructions,
121
- input_refs: req.input_refs,
122
- required_substates: req.required_substates || [],
123
- is_dry_run: req.is_dry_run,
124
- };
117
+ const params = req.transaction;
125
118
 
126
119
  const resp = await this.metamaskRequest<any>("sendTransaction", params);
127
120
  if (!resp) {
@@ -173,11 +166,11 @@ export class MetamaskTariSigner implements TariSigner {
173
166
  }
174
167
 
175
168
  public async getConfidentialVaultBalances({
176
- vault_id,
177
- maximum_expected_value,
178
- minimum_expected_value,
179
- view_key_id,
180
- }: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances> {
169
+ vault_id,
170
+ maximum_expected_value,
171
+ minimum_expected_value,
172
+ view_key_id,
173
+ }: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances> {
181
174
  const resp = await this.metamaskRequest("getConfidentialVaultBalances", {
182
175
  view_key_id,
183
176
  vault_id,
@@ -227,7 +220,7 @@ export class MetamaskTariSigner implements TariSigner {
227
220
  }
228
221
 
229
222
  function convertToStatus(result: any): TransactionStatus {
230
- // Ref: https://github.com/tari-project/tari-dan/blob/bb0b31139b770aacd7bb49af865543aa4a9e2de4/dan_layer/wallet/sdk/src/apis/transaction.rs
223
+ // Ref: https://github.com/tari-project/tari-ootle/blob/bb0b31139b770aacd7bb49af865543aa4a9e2de4/dan_layer/wallet/sdk/src/apis/transaction.rs
231
224
  if (result.final_decision !== "Commit") {
232
225
  return TransactionStatus.Rejected;
233
226
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-permissions",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -102,17 +102,6 @@ export class NonFungibleAddress {
102
102
  }
103
103
  }
104
104
 
105
- export class NonFungibleIndexAddress {
106
- private resource_address: ResourceAddress;
107
- private index: number;
108
- constructor(resource_address: ResourceAddress, index: number) {
109
- this.resource_address = resource_address;
110
- this.index = index;
111
- }
112
- toJSON() {
113
- return { resource_address: this.resource_address, index: this.index };
114
- }
115
- }
116
105
 
117
106
  export class ComponentAddress {
118
107
  private tagged: Tagged;
@@ -139,8 +128,7 @@ export type SubstateAddressType =
139
128
  | ComponentAddress
140
129
  | VaultId
141
130
  | UnclaimedConfidentialOutputAddress
142
- | NonFungibleAddress
143
- | NonFungibleIndexAddress;
131
+ | NonFungibleAddress;
144
132
 
145
133
  export class SubstateAddress {
146
134
  private value: SubstateAddressType;
@@ -156,10 +144,6 @@ export class SubstateAddress {
156
144
  return { Vault: this.value };
157
145
  } else if (this.value instanceof UnclaimedConfidentialOutputAddress) {
158
146
  return { UnclaimedConfidentialOutput: this.value };
159
- } else if (this.value instanceof NonFungibleAddress) {
160
- return { NonFungible: this.value };
161
- } else if (this.value instanceof NonFungibleIndexAddress) {
162
- return { NonFungibleIndex: this.value };
163
147
  }
164
148
  throw "Unknown type";
165
149
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-provider",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-signer",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-universe-signer",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-all",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -11,8 +11,6 @@ import {
11
11
  buildTransactionRequest,
12
12
  submitAndWaitForTransaction,
13
13
  waitForTransactionResult,
14
- fromWorkspace,
15
- toWorkspace,
16
14
  } from "@tari-project/tarijs-builders";
17
15
  import {
18
16
  convertStringToTransactionStatus,
@@ -23,12 +21,10 @@ import {
23
21
  TransactionStatus,
24
22
  GetTransactionResultResponse,
25
23
  AccountData,
26
- SubmitTransactionResponse,
27
24
  SubmitTransactionRequest,
28
25
  VaultBalances,
29
26
  VaultData,
30
27
  TemplateDefinition,
31
- SubstateRequirement,
32
28
  Substate,
33
29
  Network,
34
30
  fromHexString,
@@ -50,12 +46,10 @@ export {
50
46
  AccountData,
51
47
  TransactionStatus,
52
48
  GetTransactionResultResponse,
53
- SubmitTransactionResponse,
54
49
  SubmitTransactionRequest,
55
50
  VaultBalances,
56
51
  VaultData,
57
52
  TemplateDefinition,
58
- SubstateRequirement,
59
53
  MetamaskTariSigner,
60
54
  WalletDaemonTariSigner,
61
55
  WalletDaemonParameters,
@@ -73,8 +67,6 @@ export {
73
67
  buildTransactionRequest,
74
68
  submitAndWaitForTransaction,
75
69
  waitForTransactionResult,
76
- fromWorkspace,
77
- toWorkspace,
78
70
  convertHexStringToU256Array,
79
71
  convertU256ToHexString,
80
72
  createNftAddressFromResource,
@@ -3,7 +3,6 @@ import { assert, describe, expect, it } from "vitest";
3
3
  import {
4
4
  Amount,
5
5
  buildTransactionRequest,
6
- fromWorkspace,
7
6
  Network,
8
7
  submitAndWaitForTransaction,
9
8
  SubmitTransactionRequest,
@@ -13,6 +12,7 @@ import {
13
12
  waitForTransactionResult,
14
13
  WalletDaemonTariSigner,
15
14
  } from "../../../src";
15
+ import { Instruction, SubstateId } from "@tari-project/typescript-bindings";
16
16
 
17
17
  function buildSigner(): Promise<WalletDaemonTariSigner> {
18
18
  const permissions = new TariPermissions().addPermission("Admin");
@@ -103,21 +103,21 @@ describe("WalletDaemonTariSigner", () => {
103
103
  args: [`Amount(${fee})`],
104
104
  },
105
105
  },
106
- ];
106
+ ] as Instruction[];
107
107
 
108
108
  const request: SubmitTransactionRequest = {
109
- network: Network.LocalNet,
110
- account_id: account.account_id,
111
- fee_instructions,
112
- instructions: [],
113
- inputs: [],
114
- input_refs: [],
115
- required_substates: [],
116
- is_dry_run: false,
117
- min_epoch: null,
118
- max_epoch: null,
119
- is_seal_signer_authorized: true,
109
+ transaction: {
110
+ network: Network.LocalNet,
111
+ fee_instructions,
112
+ instructions: [],
113
+ inputs: [],
114
+ dry_run: false,
115
+ min_epoch: null,
116
+ max_epoch: null,
117
+ is_seal_signer_authorized: true,
118
+ },
120
119
  detect_inputs_use_unversioned: true,
120
+ account_id: account.account_id,
121
121
  };
122
122
  const result = await signer.submitTransaction(request);
123
123
 
@@ -131,24 +131,24 @@ describe("WalletDaemonTariSigner", () => {
131
131
  const account = await signer.getAccount();
132
132
 
133
133
  const request: SubmitTransactionRequest = {
134
- network: Network.LocalNet,
135
- account_id: account.account_id,
136
- fee_instructions: [],
137
- instructions: [
138
- {
139
- EmitLog: {
140
- level: "Info",
141
- message: "From Integration Test",
134
+ transaction: {
135
+ network: Network.LocalNet,
136
+ fee_instructions: [],
137
+ instructions: [
138
+ {
139
+ EmitLog: {
140
+ level: "Info",
141
+ message: "From Integration Test",
142
+ },
142
143
  },
143
- },
144
- ],
145
- inputs: [],
146
- input_refs: [],
147
- required_substates: [],
148
- is_dry_run: true,
149
- min_epoch: null,
150
- max_epoch: null,
151
- is_seal_signer_authorized: true,
144
+ ],
145
+ inputs: [],
146
+ dry_run: true,
147
+ min_epoch: null,
148
+ max_epoch: null,
149
+ is_seal_signer_authorized: true,
150
+ },
151
+ account_id: account.account_id,
152
152
  detect_inputs_use_unversioned: true,
153
153
  };
154
154
  const result = await signer.submitTransaction(request);
@@ -164,7 +164,8 @@ describe("WalletDaemonTariSigner", () => {
164
164
  const xtrAddress = account.resources[0].resource_address;
165
165
 
166
166
  const fee = new Amount(2000);
167
- const builder = new TransactionBuilder();
167
+ const network = Network.LocalNet;
168
+ const builder = new TransactionBuilder(network);
168
169
  builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
169
170
 
170
171
  builder.callMethod(
@@ -180,21 +181,14 @@ describe("WalletDaemonTariSigner", () => {
180
181
  componentAddress: account.address,
181
182
  methodName: "deposit",
182
183
  },
183
- [fromWorkspace(workspaceId)],
184
+ [workspaceId],
184
185
  );
185
- const transaction = builder.build();
186
+ builder.addInput({ substate_id: { Component: account.address }, version: null });
187
+ const transaction = builder.buildUnsignedTransaction();
186
188
 
187
- const isDryRun = false;
188
- const inputRefs = undefined;
189
- const network = Network.LocalNet;
190
- const requiredSubstates = [{ substate_id: account.address }];
191
189
  const submitTransactionRequest = buildTransactionRequest(
192
190
  transaction,
193
191
  account.account_id,
194
- requiredSubstates,
195
- inputRefs,
196
- isDryRun,
197
- network,
198
192
  );
199
193
 
200
194
  const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
@@ -213,9 +207,9 @@ describe("WalletDaemonTariSigner", () => {
213
207
 
214
208
  assert(
215
209
  accountBalances &&
216
- typeof accountBalances === "object" &&
217
- "balances" in accountBalances &&
218
- accountBalances.balances,
210
+ typeof accountBalances === "object" &&
211
+ "balances" in accountBalances &&
212
+ accountBalances.balances,
219
213
  "accountBalances is not an object",
220
214
  );
221
215
  assert(Array.isArray(accountBalances.balances), "accountBalances.balances is not an array");
@@ -338,4 +332,40 @@ describe("WalletDaemonTariSigner", () => {
338
332
  expect(failure).toEqual("1 dangling address allocations remain after transaction execution");
339
333
  });
340
334
  });
335
+
336
+ describe("assertBucketContains", () => {
337
+ it("fails if bucket does not exist", async () => {
338
+ const signer = await buildSigner();
339
+ const account = await signer.getAccount();
340
+
341
+ const fee = new Amount(2000);
342
+ const builder = new TransactionBuilder();
343
+ builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
344
+ builder.assertBucketContains("not_exist", "resource_0000000000000000000000000000000000000000000000000000000000000000", Amount.newAmount(1));
345
+ const transaction = builder.build();
346
+
347
+ const isDryRun = false;
348
+ const inputRefs = undefined;
349
+ const network = Network.LocalNet;
350
+ const requiredSubstates = [{ substate_id: account.address }];
351
+ const submitTransactionRequest = buildTransactionRequest(
352
+ transaction,
353
+ account.account_id,
354
+ requiredSubstates,
355
+ inputRefs,
356
+ isDryRun,
357
+ network,
358
+ );
359
+
360
+ const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
361
+
362
+ expect(txResult.result.status).toBe(TransactionStatus.OnlyFeeAccepted);
363
+
364
+ const executionResult = txResult.result.result?.result;
365
+ const reason =
366
+ executionResult && "AcceptFeeRejectRest" in executionResult && executionResult.AcceptFeeRejectRest[1];
367
+ const failure = reason && typeof reason === "object" && "ExecutionFailure" in reason && reason.ExecutionFailure;
368
+ expect(failure).toContain("Item at id 0 does not exist on the workspace");
369
+ });
370
+ });
341
371
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-types",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,7 +3,3 @@ import { Substate, SubstateId } from "@tari-project/typescript-bindings";
3
3
  export type UpSubstates = Array<[SubstateId, Substate]>;
4
4
  export type DownSubstates = Array<[SubstateId, number]>;
5
5
 
6
- export interface SubstateDiff {
7
- up_substates: UpSubstates;
8
- down_substates: DownSubstates;
9
- }
@@ -1 +1 @@
1
- export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "NonFungibleIndex" | "ValidatorFeePool" | "Template";
1
+ export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "ValidatorFeePool" | "Template";
@@ -1,7 +1,6 @@
1
1
  import { TransactionStatus } from "./TransactionStatus";
2
- import { FinalizeResult } from "./FinalizeResult";
3
2
  import { DownSubstates, UpSubstates } from "./SubstateDiff";
4
- import { ComponentAddress } from "@tari-project/typescript-bindings";
3
+ import { ComponentAddress, FinalizeResult, TransactionResult } from "@tari-project/typescript-bindings";
5
4
 
6
5
  export type SubmitTransactionResponse = {
7
6
  transaction_id: string;
@@ -13,15 +12,10 @@ export interface SubmitTxResult {
13
12
  upSubstates: UpSubstates;
14
13
  downSubstates: DownSubstates;
15
14
  newComponents: UpSubstates;
15
+
16
16
  getComponentForTemplate(templateAddress: string): ComponentAddress | null;
17
17
  }
18
18
 
19
- export type TransactionResult = {
20
- transaction_id: string;
21
- status: TransactionStatus;
22
- result: FinalizeResult | null;
23
- };
24
-
25
19
  export type TransactionResultResponse = {
26
20
  transaction_id: string;
27
21
  status: TransactionStatus;
@@ -1,9 +1,9 @@
1
1
  export enum TransactionStatus {
2
- New,
3
- DryRun,
4
- Pending,
5
- Accepted,
6
- Rejected,
7
- InvalidTransaction,
8
- OnlyFeeAccepted,
2
+ New = "New",
3
+ DryRun = "DryRun",
4
+ Pending = "Pending",
5
+ Accepted = "Accepted",
6
+ Rejected = "Rejected",
7
+ InvalidTransaction = "InvalidTransaction",
8
+ OnlyFeeAccepted = "OnlyFeeAccepted",
9
9
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- SubstateDiff,
3
2
  VaultId,
4
3
  Vault,
5
4
  SubstateId,
@@ -7,11 +6,9 @@ import {
7
6
  ResourceContainer,
8
7
  ResourceAddress,
9
8
  Amount,
10
- RejectReason,
11
9
  substateIdToString,
12
- ComponentAddress,
10
+ ComponentAddress, FinalizeResult,
13
11
  } from "@tari-project/typescript-bindings";
14
- import { FinalizeResultStatus } from "../FinalizeResult";
15
12
  import { UpSubstates } from "../SubstateDiff";
16
13
 
17
14
  function isOfType<T extends object>(obj: T, key: keyof T): boolean {
@@ -19,8 +16,8 @@ function isOfType<T extends object>(obj: T, key: keyof T): boolean {
19
16
  }
20
17
 
21
18
  export const txResultCheck = {
22
- isAccept: (result: FinalizeResultStatus): result is { Accept: SubstateDiff } => {
23
- return "Accept" in result;
19
+ isAccept: (result: FinalizeResult) => {
20
+ return "Accept" in result.result;
24
21
  },
25
22
 
26
23
  isVaultId: (substateId: SubstateId): substateId is { Vault: VaultId } => {
@@ -37,13 +34,13 @@ export const txResultCheck = {
37
34
  return "Fungible" in resourceContainer;
38
35
  },
39
36
 
40
- isReject: (result: FinalizeResultStatus): result is { Reject: RejectReason } => {
41
- return "Reject" in result;
37
+ isReject: (result: FinalizeResult): boolean => {
38
+ return "Reject" in result.result;
42
39
  },
43
40
  isAcceptFeeRejectRest: (
44
- result: FinalizeResultStatus,
45
- ): result is { AcceptFeeRejectRest: [SubstateDiff, RejectReason] } => {
46
- return "AcceptFeeRejectRest" in result;
41
+ result: FinalizeResult,
42
+ ): boolean => {
43
+ return "AcceptFeeRejectRest" in result.result;
47
44
  },
48
45
  };
49
46
 
@@ -4,29 +4,14 @@ export { TransactionArg } from "./TransactionArg";
4
4
  export { ConfidentialClaim } from "./ConfidentialClaim";
5
5
  export { ConfidentialOutput } from "./ConfidentialOutput";
6
6
  export { ConfidentialWithdrawProof } from "./ConfidentialWithdrawProof";
7
- export {
8
- FinalizeResult,
9
- FinalizeResultStatus,
10
- TxResultAccept,
11
- TxResultAcceptFeeRejectRest,
12
- TxResultReject,
13
- } from "./FinalizeResult";
14
7
  export { GetTransactionResultResponse } from "./GetTransactionResultResponse";
15
- export { Instruction } from "./Instruction";
16
- export { Transaction } from "./Transaction";
17
- export { SubstateDiff, DownSubstates, UpSubstates } from "./SubstateDiff";
18
- export { SubstateRequirement } from "./SubstateRequirement";
8
+ export { DownSubstates, UpSubstates } from "./SubstateDiff";
19
9
  export { SubstateType } from "./SubstateType";
20
10
  export {
21
- TransactionResult,
22
- SubmitTxResult,
23
11
  SubmitTransactionResponse,
24
- TransactionResultResponse,
25
12
  } from "./TransactionResult";
26
13
  export { TransactionSignature } from "./TransactionSignature";
27
14
  export { TransactionStatus } from "./TransactionStatus";
28
- export { UnsignedTransaction } from "./UnsignedTransaction";
29
- export { VersionedSubstateId } from "./VersionedSubstateId";
30
15
  export { WorkspaceArg } from "./Workspace";
31
16
  export { ListAccountNftFromBalancesRequest } from "./ListAccountNftFromBalancesRequest";
32
17
  export { Network } from "./network";
@@ -1,4 +1,8 @@
1
- import { SubstateType, TemplateDef } from "@tari-project/typescript-bindings";
1
+ import {
2
+ SubstateType,
3
+ TemplateDef,
4
+ UnsignedTransactionV1,
5
+ } from "@tari-project/typescript-bindings";
2
6
 
3
7
  export type SubstateMetadata = {
4
8
  substate_id: string;
@@ -13,17 +17,8 @@ export type ReqSubstate = {
13
17
  };
14
18
 
15
19
  export type SubmitTransactionRequest = {
16
- network: number;
20
+ transaction: UnsignedTransactionV1,
17
21
  account_id: number;
18
- instructions: object[];
19
- fee_instructions: object[];
20
- inputs: object[];
21
- input_refs: object[];
22
- required_substates: ReqSubstate[];
23
- is_dry_run: boolean;
24
- min_epoch: number | null;
25
- max_epoch: number | null;
26
- is_seal_signer_authorized: boolean;
27
22
  detect_inputs_use_unversioned: boolean;
28
23
  };
29
24
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-daemon-signer",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -173,28 +173,15 @@ export class WalletDaemonTariSigner implements TariSigner {
173
173
  public async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
174
174
  const params = {
175
175
  transaction: {
176
- V1: {
177
- network: req.network,
178
- instructions: req.instructions as Instruction[],
179
- fee_instructions: req.fee_instructions as Instruction[],
180
- inputs: req.required_substates.map((s) => ({
181
- // TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
182
- substate_id: s.substate_id as any,
183
- version: s.version ?? null,
184
- })),
185
- min_epoch: null,
186
- max_epoch: null,
187
- is_seal_signer_authorized: req.is_seal_signer_authorized,
188
- },
176
+ V1: req.transaction,
189
177
  },
190
178
  signing_key_index: req.account_id,
191
- autofill_inputs: [],
192
179
  detect_inputs: true,
193
180
  proof_ids: [],
194
181
  detect_inputs_use_unversioned: req.detect_inputs_use_unversioned,
195
182
  };
196
183
 
197
- const res = req.is_dry_run
184
+ const res = req.transaction.dry_run
198
185
  ? await this.client.submitTransactionDryRun(params)
199
186
  : await this.client.submitTransaction(params);
200
187
  return { transaction_id: res.transaction_id };
@@ -221,11 +208,11 @@ export class WalletDaemonTariSigner implements TariSigner {
221
208
  }
222
209
 
223
210
  public async getConfidentialVaultBalances({
224
- vault_id,
225
- view_key_id,
226
- maximum_expected_value = null,
227
- minimum_expected_value = null,
228
- }: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances> {
211
+ vault_id,
212
+ view_key_id,
213
+ maximum_expected_value = null,
214
+ minimum_expected_value = null,
215
+ }: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances> {
229
216
  const res = await this.client.viewVaultBalance({
230
217
  view_key_id,
231
218
  vault_id,
@@ -236,11 +223,11 @@ export class WalletDaemonTariSigner implements TariSigner {
236
223
  }
237
224
 
238
225
  public async listSubstates({
239
- filter_by_template,
240
- filter_by_type,
241
- limit,
242
- offset,
243
- }: ListSubstatesRequest): Promise<ListSubstatesResponse> {
226
+ filter_by_template,
227
+ filter_by_type,
228
+ limit,
229
+ offset,
230
+ }: ListSubstatesRequest): Promise<ListSubstatesResponse> {
244
231
  const resp = await this.client.substatesList({
245
232
  filter_by_template,
246
233
  filter_by_type,
@@ -1,7 +1,7 @@
1
1
  import { TariPermissions } from "@tari-project/tari-permissions";
2
2
  import { transports } from "@tari-project/wallet_jrpc_client";
3
3
 
4
- class SignaligServer {
4
+ class SignalingServer {
5
5
  private _token?: string;
6
6
  private _server_url: string;
7
7
 
@@ -72,7 +72,7 @@ class SignaligServer {
72
72
  export class TariConnection {
73
73
  private _peerConnection: RTCPeerConnection;
74
74
  private _dataChannel: RTCDataChannel;
75
- private _signalingServer: SignaligServer;
75
+ private _signalingServer: SignalingServer;
76
76
  private _callbacks: { [key: string]: any[] };
77
77
  private _offer?: RTCSessionDescriptionInit;
78
78
  private _walletToken: string | undefined;
@@ -83,7 +83,7 @@ export class TariConnection {
83
83
  constructor(signalig_server_url?: string, config?: RTCConfiguration) {
84
84
  this._peerConnection = new RTCPeerConnection(config || this.config());
85
85
  this._dataChannel = this._peerConnection.createDataChannel("tari-data");
86
- this._signalingServer = new SignaligServer(signalig_server_url);
86
+ this._signalingServer = new SignalingServer(signalig_server_url);
87
87
  this._callbacks = {};
88
88
  }
89
89
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-connect-signer",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {