@tari-project/tarijs 0.5.3 → 0.5.5

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.
@@ -9,19 +9,100 @@ title: Installation
9
9
 
10
10
  Usually, you will need to install the base package and at least one package that implements a concrete provider.
11
11
 
12
- ## Install base package
12
+ ## Prerequisites
13
13
 
14
- ```bash npm2yarn
15
- npm install @tari-project/tarijs
14
+ Before you begin with the above, however, you will need to have at minimum a default web project template set up in your IDE of choice. We have provided instructions for creating a base React + Vite project below in your IDE of choice, but you are not limited to React.
15
+
16
+ Tari.js is useable in any Typescript or Javascript application and framework, so you have full flexibility to choose whichever technology and framework suits you.
17
+
18
+
19
+ ### Create a React project
20
+
21
+ The quickest way to set up a new React project is to leverage `vite` to do so.
22
+
23
+ In the terminal, run the following command below, and select `Y` to continue
24
+
25
+ ```bash
26
+ npm create vite@latest
27
+ ```
28
+
29
+ When you run this command, you'll be likely asked to install the following. Select `Y` to continue
30
+
31
+ ```bash
32
+ Need to install the following packages:
33
+ create-vite@6.3.1
34
+ Ok to proceed? (y)
35
+ ```
36
+
37
+ You'll be asked to enter a project name. You can call it what you like but to make it easy to follow along, let's call it the `'base-app`.
38
+
39
+ ```bash
40
+ > npx
41
+ > create-vite
42
+
43
+ ✔ Project name: … base-app
44
+ ```
45
+ Next, select `React` from the list of options:
46
+
47
+ ```bash
48
+ ? Select a framework: › - Use arrow-keys. Return to submit.
49
+ Vanilla
50
+ Vue
51
+ ❯ React
52
+ Preact
53
+ Lit
54
+ Svelte
55
+ Solid
56
+ Qwik
57
+ Angular
58
+ Others
59
+ ```
60
+
61
+ Lastly, choose the `Typescript` variant:
62
+
63
+ ```bash
64
+ ? Select a variant: › - Use arrow-keys. Return to submit.
65
+ ❯ TypeScript
66
+ TypeScript + SWC
67
+ JavaScript
68
+ JavaScript + SWC
69
+ React Router v7 ↗
70
+ ```
71
+
72
+ Once this is done, you'll be instructed to enter the following commands. Do so in the same terminal:
73
+
74
+ ```bash
75
+ cd latest
76
+ npm install
77
+ npm run dev
78
+ ```
79
+
80
+ The above will install all the necessary dependencies and then run the template Vite + React application. When running the application, you'll see the following message:
81
+
82
+ ```bash
83
+ VITE v6.2.1 ready in 123 ms
84
+
85
+ ➜ Local: http://localhost:5173/
86
+ ➜ Network: use --host to expose
87
+ ➜ press h + enter to show help
16
88
  ```
17
89
 
18
- ## Install a provider
90
+ The `localhost:port` address indicates that you have the app running locally at that address. Entering the address in your browser will open up the stock app. You'll see something equivalent to the below:
91
+
92
+ You can view the project and its associated files on the left-hand side of VS Code
19
93
 
20
- For this documentation, we will use the `Wallet Daemon Provider`, which allows direct connection to the wallet if you are hosting it locally.
21
- However, you are free to install any other available provider.
94
+ We'll be modifying this app to get your Hello Ootle app up and running. For now, you can proceed to the next step.
95
+
96
+ ## Install the base package
97
+
98
+ Use the below commands to install the tari.js base package.
22
99
 
23
100
  ```bash npm2yarn
24
- npm install @tari-project/wallet-daemon-provider
101
+ npm install @tari-project/tarijs
25
102
  ```
26
103
 
27
- We will review all providers on their dedicated pages.
104
+ ## Install a provider or signer.
105
+
106
+ In order to use the wallet, you will need to connect either to an Ootle indexer or a signer that allows you to interact with the Ootle via several clients. We explain more about providers and signers in the following section, but in short:
107
+ - You will use an indexer when you simply want to obtain information from the Ootle.
108
+ - A signer is used when you wish to modify, interact with or create on the Ootle.
@@ -16,10 +16,6 @@ npm install @tari-project/wallet-connect-signer
16
16
 
17
17
  Establishing connection requires multiple steps.
18
18
 
19
- ## Obtain WalletConnect Project ID
20
-
21
- Obtain a WalletConnect Project ID by registering your project on the WalletConnect Cloud. This ID is then used to connect your dApp to the WalletConnect infrastructure, facilitating communication between the dApp and user wallets.
22
-
23
19
  ## Request a connection and display wallet connect dialog
24
20
 
25
21
  ```js
@@ -4,7 +4,7 @@ sidebar_position: 3
4
4
 
5
5
  # Instructions
6
6
 
7
- There are nine types of instructions. In most cases, you will not need to create raw instructions yourself but will instead use one of the methods provided by the Transaction Builder.
7
+ There are ten types of instructions. In most cases, you will not need to create raw instructions yourself but will instead use one of the methods provided by the Transaction Builder.
8
8
 
9
9
  ## CreateAccount
10
10
 
@@ -105,4 +105,15 @@ DropAllProofsInWorkspace
105
105
  "output": ConfidentialOutput | null
106
106
  }
107
107
  }
108
+ ```
109
+
110
+ ## AllocateAddress
111
+
112
+ ```json
113
+ {
114
+ "AllocateAddress": {
115
+ "substate_type": string,
116
+ "workspace_id": string
117
+ }
118
+ }
108
119
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-builders",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -6,12 +6,12 @@ import {
6
6
  TransactionStatus,
7
7
  DownSubstates,
8
8
  UpSubstates,
9
- FinalizeResultStatus,
10
- TxResultAccept,
11
9
  SubmitTxResult,
12
10
  ReqSubstate,
13
11
  SubmitTransactionRequest,
12
+ ComponentAddress,
14
13
  } from "@tari-project/tarijs-types";
14
+ import { getSubstateValueFromUpSubstates, substateIdToString, txResultCheck } from "@tari-project/tarijs-types";
15
15
 
16
16
  export function buildTransactionRequest(
17
17
  transaction: Transaction,
@@ -46,10 +46,30 @@ export async function submitAndWaitForTransaction(
46
46
  try {
47
47
  const response = await signer.submitTransaction(req);
48
48
  const result = await waitForTransactionResult(signer, response.transaction_id);
49
+ const { upSubstates, downSubstates } = getAcceptResultSubstates(result);
50
+ const newComponents = getSubstateValueFromUpSubstates("Component", upSubstates);
51
+
52
+ function getComponentForTemplate(templateAddress: string): ComponentAddress | null {
53
+ for (const [substateId, substate] of upSubstates) {
54
+ if ("Component" in substate.substate) {
55
+ const templateAddr = substate.substate.Component.template_address;
56
+ const templateString =
57
+ typeof templateAddr === "string" ? templateAddr : new TextDecoder().decode(templateAddr);
58
+ if (templateAddress === templateString) {
59
+ return substateIdToString(substateId);
60
+ }
61
+ }
62
+ }
63
+ return null;
64
+ }
49
65
 
50
66
  return {
51
67
  response,
52
68
  result,
69
+ upSubstates,
70
+ downSubstates,
71
+ newComponents,
72
+ getComponentForTemplate,
53
73
  };
54
74
  } catch (e) {
55
75
  throw new Error(`Transaction failed: ${e}`);
@@ -81,17 +101,20 @@ export async function waitForTransactionResult(
81
101
  }
82
102
  }
83
103
 
84
- export function getAcceptResultSubstates(
85
- txResult: TransactionResult,
86
- ): { upSubstates: UpSubstates; downSubstates: DownSubstates } | undefined {
104
+ export function getAcceptResultSubstates(txResult: TransactionResult): {
105
+ upSubstates: UpSubstates;
106
+ downSubstates: DownSubstates;
107
+ } {
87
108
  const result = txResult.result?.result;
88
109
 
89
- if (result && isAccept(result)) {
110
+ if (result && txResultCheck.isAcceptFeeRejectRest(result)) {
111
+ return {
112
+ upSubstates: result.AcceptFeeRejectRest[0].up_substates,
113
+ downSubstates: result.AcceptFeeRejectRest[0].down_substates,
114
+ };
115
+ }
116
+ if (result && txResultCheck.isAccept(result)) {
90
117
  return { upSubstates: result.Accept.up_substates, downSubstates: result.Accept.down_substates };
91
118
  }
92
- return undefined;
93
- }
94
-
95
- function isAccept(result: FinalizeResultStatus): result is TxResultAccept {
96
- return "Accept" in result;
119
+ return { upSubstates: [], downSubstates: [] };
97
120
  }
@@ -14,6 +14,7 @@ import {
14
14
  TransactionSignature,
15
15
  UnsignedTransaction,
16
16
  PublishedTemplateAddress,
17
+ SubstateType,
17
18
  TransactionArg,
18
19
  } from "@tari-project/tarijs-types";
19
20
 
@@ -151,6 +152,15 @@ export class TransactionBuilder implements Builder {
151
152
  });
152
153
  }
153
154
 
155
+ public allocateAddress(substateType: SubstateType, workspaceId: string): this {
156
+ return this.addInstruction({
157
+ AllocateAddress: {
158
+ substate_type: substateType,
159
+ workspace_id: workspaceId,
160
+ },
161
+ });
162
+ }
163
+
154
164
  /**
155
165
  * The `SaveVar` method replaces
156
166
  * `PutLastInstructionOutputOnWorkspace: { key: Array<number> }`
@@ -70,7 +70,7 @@ export class IndexerProvider implements TariProvider {
70
70
 
71
71
  public async getSubstate({ substate_address, version }: GetSubstateRequest): Promise<Substate> {
72
72
  const resp = await this.client.getSubstate({
73
- address: stringToSubstateId(substate_address),
73
+ address: substate_address,
74
74
  version: version ?? null,
75
75
  local_search_only: false,
76
76
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-universe-signer",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -11,14 +11,14 @@ import {
11
11
  ListAccountNftFromBalancesRequest,
12
12
  } from "@tari-project/tarijs-types";
13
13
  import { SignerRequest, SignerMethodNames, SignerReturnType, TariUniverseSignerParameters, WindowSize } from "./types";
14
+ import { sendSignerCall } from "./utils";
15
+ import { TariSigner } from "@tari-project/tari-signer";
14
16
  import {
15
17
  AccountsGetBalancesResponse,
16
18
  ConfidentialViewVaultBalanceRequest,
17
19
  ListAccountNftRequest,
18
20
  ListAccountNftResponse,
19
- } from "@tari-project/wallet_jrpc_client";
20
- import { sendSignerCall } from "./utils";
21
- import { TariSigner } from "@tari-project/tari-signer";
21
+ } from "@tari-project/typescript-bindings";
22
22
 
23
23
  export class TariUniverseSigner implements TariSigner {
24
24
  public signerName = "TariUniverse";
@@ -75,7 +75,7 @@ export class TariUniverseSigner implements TariSigner {
75
75
  });
76
76
  }
77
77
 
78
- public async createFreeTestCoins(): Promise<void> {
78
+ public async createFreeTestCoins(): Promise<AccountData> {
79
79
  return this.sendRequest({ methodName: "createFreeTestCoins", args: [] });
80
80
  }
81
81
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-all",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,18 @@
1
1
  import { assert, describe, expect, it } from "vitest";
2
2
 
3
- import { Network, SubmitTransactionRequest, TariPermissions, WalletDaemonTariSigner } from "../../../src";
3
+ import {
4
+ Amount,
5
+ buildTransactionRequest,
6
+ Network,
7
+ submitAndWaitForTransaction,
8
+ SubmitTransactionRequest,
9
+ TariPermissions,
10
+ TransactionBuilder,
11
+ TransactionStatus,
12
+ waitForTransactionResult,
13
+ WalletDaemonTariSigner,
14
+ } from "../../../src";
15
+ import { inspect } from "util";
4
16
 
5
17
  function buildSigner(): Promise<WalletDaemonTariSigner> {
6
18
  const permissions = new TariPermissions().addPermission("Admin");
@@ -113,6 +125,37 @@ describe("WalletDaemonTariSigner", () => {
113
125
  transaction_id: expect.any(String),
114
126
  });
115
127
  });
128
+
129
+ it("submits a dry run transaction", async () => {
130
+ const signer = await buildSigner();
131
+ const account = await signer.getAccount();
132
+
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",
142
+ },
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,
152
+ detect_inputs_use_unversioned: true,
153
+ };
154
+ const result = await signer.submitTransaction(request);
155
+ const txResult = await waitForTransactionResult(signer, result.transaction_id);
156
+
157
+ expect(txResult.status).toEqual(TransactionStatus.DryRun);
158
+ });
116
159
  });
117
160
 
118
161
  describe("getAccountBalances", () => {
@@ -215,4 +258,40 @@ describe("WalletDaemonTariSigner", () => {
215
258
  expect(substates.every((substate) => substate.module_name)).toBe(true);
216
259
  });
217
260
  });
261
+
262
+ describe("allocateAddress", () => {
263
+ it("allocates component address", async () => {
264
+ const signer = await buildSigner();
265
+ const account = await signer.getAccount();
266
+
267
+ const fee = new Amount(2000);
268
+ const builder = new TransactionBuilder();
269
+ builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
270
+ builder.allocateAddress("Component", "id-1");
271
+ const transaction = builder.build();
272
+
273
+ const isDryRun = false;
274
+ const inputRefs = undefined;
275
+ const network = Network.LocalNet;
276
+ const requiredSubstates = [{ substate_id: account.address }];
277
+ const submitTransactionRequest = buildTransactionRequest(
278
+ transaction,
279
+ account.account_id,
280
+ requiredSubstates,
281
+ inputRefs,
282
+ isDryRun,
283
+ network,
284
+ );
285
+
286
+ const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
287
+
288
+ expect(txResult.result.status).toBe(TransactionStatus.OnlyFeeAccepted);
289
+
290
+ const executionResult = txResult.result.result?.result;
291
+ const reason =
292
+ executionResult && "AcceptFeeRejectRest" in executionResult && executionResult.AcceptFeeRejectRest[1];
293
+ const failure = reason && typeof reason === "object" && "ExecutionFailure" in reason && reason.ExecutionFailure;
294
+ expect(failure).toEqual("1 dangling address allocations remain after transaction execution");
295
+ });
296
+ });
218
297
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-types",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,4 +1,4 @@
1
- import { ComponentAddress, LogLevel, PublishedTemplateAddress } from "@tari-project/typescript-bindings";
1
+ import { ComponentAddress, LogLevel, PublishedTemplateAddress, SubstateType } from "@tari-project/typescript-bindings";
2
2
  import { TransactionArg } from "./TransactionArg";
3
3
  import { ConfidentialClaim } from "./ConfidentialClaim";
4
4
  import { Amount } from "./Amount";
@@ -13,7 +13,8 @@ export type Instruction =
13
13
  | ClaimBurn
14
14
  | ClaimValidatorFees
15
15
  | DropAllProofsInWorkspace
16
- | CreateFreeTestCoins;
16
+ | CreateFreeTestCoins
17
+ | AllocateAddress;
17
18
 
18
19
  export type CreateAccount = { CreateAccount: { owner_public_key: string; workspace_bucket: string | null } };
19
20
  export type CallFunction = {
@@ -30,3 +31,6 @@ export type DropAllProofsInWorkspace = "DropAllProofsInWorkspace";
30
31
  export type CreateFreeTestCoins = {
31
32
  CreateFreeTestCoins: { revealed_amount: Amount; output: ConfidentialOutput | null };
32
33
  };
34
+ export type AllocateAddress = {
35
+ AllocateAddress: { substate_type: SubstateType; workspace_id: string };
36
+ };
@@ -0,0 +1 @@
1
+ export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "NonFungibleIndex" | "ValidatorFeePool" | "Template";
@@ -1,5 +1,7 @@
1
1
  import { TransactionStatus } from "./TransactionStatus";
2
2
  import { FinalizeResult } from "./FinalizeResult";
3
+ import { DownSubstates, UpSubstates } from "./SubstateDiff";
4
+ import { ComponentAddress } from "@tari-project/typescript-bindings";
3
5
 
4
6
  export type SubmitTransactionResponse = {
5
7
  transaction_id: string;
@@ -8,6 +10,10 @@ export type SubmitTransactionResponse = {
8
10
  export interface SubmitTxResult {
9
11
  response: SubmitTransactionResponse;
10
12
  result: TransactionResult;
13
+ upSubstates: UpSubstates;
14
+ downSubstates: DownSubstates;
15
+ newComponents: UpSubstates;
16
+ getComponentForTemplate(templateAddress: string): ComponentAddress | null;
11
17
  }
12
18
 
13
19
  export type TransactionResult = {
@@ -15,3 +21,9 @@ export type TransactionResult = {
15
21
  status: TransactionStatus;
16
22
  result: FinalizeResult | null;
17
23
  };
24
+
25
+ export type TransactionResultResponse = {
26
+ transaction_id: string;
27
+ status: TransactionStatus;
28
+ result: FinalizeResult | null;
29
+ };
@@ -1,6 +1,7 @@
1
1
  import { NonFungibleId, NonFungibleToken, ResourceAddress } from "@tari-project/typescript-bindings";
2
2
  import { TransactionStatus } from "../TransactionStatus";
3
3
  export { fromHexString, toHexString } from "./hexString";
4
+ export { txResultCheck, getSubstateValueFromUpSubstates, getComponentsForTemplate } from "./txResult";
4
5
  export { BinaryTag, CborValue, convertTaggedValue, getCborValueByPath, parseCbor } from "./cbor";
5
6
  export {
6
7
  substateIdToString,
@@ -0,0 +1,75 @@
1
+ import {
2
+ SubstateDiff,
3
+ VaultId,
4
+ Vault,
5
+ SubstateId,
6
+ SubstateValue,
7
+ ResourceContainer,
8
+ ResourceAddress,
9
+ Amount,
10
+ RejectReason,
11
+ substateIdToString,
12
+ ComponentAddress,
13
+ } from "@tari-project/typescript-bindings";
14
+ import { FinalizeResultStatus } from "../FinalizeResult";
15
+ import { UpSubstates } from "../SubstateDiff";
16
+
17
+ function isOfType<T extends object>(obj: T, key: keyof T): boolean {
18
+ return obj !== null && typeof obj === "object" && key in obj;
19
+ }
20
+
21
+ export const txResultCheck = {
22
+ isAccept: (result: FinalizeResultStatus): result is { Accept: SubstateDiff } => {
23
+ return "Accept" in result;
24
+ },
25
+
26
+ isVaultId: (substateId: SubstateId): substateId is { Vault: VaultId } => {
27
+ return isOfType(substateId, "Vault" as keyof SubstateId);
28
+ },
29
+
30
+ isVaultSubstate: (substate: SubstateValue): substate is { Vault: Vault } => {
31
+ return "Vault" in substate;
32
+ },
33
+
34
+ isFungible: (
35
+ resourceContainer: ResourceContainer,
36
+ ): resourceContainer is { Fungible: { address: ResourceAddress; amount: Amount; locked_amount: Amount } } => {
37
+ return "Fungible" in resourceContainer;
38
+ },
39
+
40
+ isReject: (result: FinalizeResultStatus): result is { Reject: RejectReason } => {
41
+ return "Reject" in result;
42
+ },
43
+ isAcceptFeeRejectRest: (
44
+ result: FinalizeResultStatus,
45
+ ): result is { AcceptFeeRejectRest: [SubstateDiff, RejectReason] } => {
46
+ return "AcceptFeeRejectRest" in result;
47
+ },
48
+ };
49
+
50
+ export function getSubstateValueFromUpSubstates(
51
+ substateType: keyof SubstateValue | string,
52
+ upSubstates: UpSubstates,
53
+ ): UpSubstates {
54
+ const components: UpSubstates = [];
55
+ for (const [substateId, substate] of upSubstates) {
56
+ if (substateType in substate.substate) {
57
+ components.push([substateId, substate]);
58
+ }
59
+ }
60
+ return components;
61
+ }
62
+
63
+ export function getComponentsForTemplate(templateAddress: string, upSubstates: UpSubstates): ComponentAddress[] | null {
64
+ const components: ComponentAddress[] = [];
65
+ const templateAddressBytes = new TextEncoder().encode(templateAddress);
66
+ for (const [substateId, substate] of upSubstates) {
67
+ if ("Component" in substate.substate) {
68
+ const componentHeader = substate.substate.Component;
69
+ if (componentHeader.template_address === templateAddressBytes) {
70
+ components.push(substateIdToString(substateId));
71
+ }
72
+ }
73
+ }
74
+ return components;
75
+ }
@@ -16,7 +16,13 @@ export { Instruction } from "./Instruction";
16
16
  export { Transaction } from "./Transaction";
17
17
  export { SubstateDiff, DownSubstates, UpSubstates } from "./SubstateDiff";
18
18
  export { SubstateRequirement } from "./SubstateRequirement";
19
- export { TransactionResult, SubmitTxResult, SubmitTransactionResponse } from "./TransactionResult";
19
+ export { SubstateType } from "./SubstateType";
20
+ export {
21
+ TransactionResult,
22
+ SubmitTxResult,
23
+ SubmitTransactionResponse,
24
+ TransactionResultResponse,
25
+ } from "./TransactionResult";
20
26
  export { TransactionSignature } from "./TransactionSignature";
21
27
  export { TransactionStatus } from "./TransactionStatus";
22
28
  export { UnsignedTransaction } from "./UnsignedTransaction";
@@ -57,6 +63,9 @@ export {
57
63
  convertTaggedValue,
58
64
  getCborValueByPath,
59
65
  parseCbor,
66
+ getSubstateValueFromUpSubstates,
67
+ getComponentsForTemplate,
68
+ txResultCheck,
60
69
  BinaryTag,
61
70
  CborValue,
62
71
  } from "./helpers";
@@ -16,6 +16,7 @@
16
16
  "@tari-project/tari-permissions": "workspace:^",
17
17
  "@tari-project/tari-signer": "workspace:^",
18
18
  "@tari-project/tarijs-types": "workspace:^",
19
+ "@tari-project/typescript-bindings": "catalog:",
19
20
  "@tari-project/wallet_jrpc_client": "catalog:"
20
21
  },
21
22
  "devDependencies": {
@@ -1,17 +1,7 @@
1
1
  import { TariPermissions } from "@tari-project/tari-permissions";
2
2
  import { TariConnection } from "./webrtc";
3
3
  import { TariSigner } from "@tari-project/tari-signer";
4
- import {
5
- WalletDaemonClient,
6
- substateIdToString,
7
- Instruction,
8
- SubstatesListRequest,
9
- KeyBranch,
10
- SubstateId,
11
- ListAccountNftRequest,
12
- ListAccountNftResponse,
13
- ConfidentialViewVaultBalanceRequest,
14
- } from "@tari-project/wallet_jrpc_client";
4
+ import { WalletDaemonClient } from "@tari-project/wallet_jrpc_client";
15
5
  import { WebRtcRpcTransport } from "./webrtc_transport";
16
6
  import {
17
7
  AccountData,
@@ -25,6 +15,16 @@ import {
25
15
  ListSubstatesResponse,
26
16
  ListSubstatesRequest,
27
17
  } from "@tari-project/tarijs-types";
18
+ import {
19
+ ConfidentialViewVaultBalanceRequest,
20
+ Instruction,
21
+ KeyBranch,
22
+ ListAccountNftRequest,
23
+ ListAccountNftResponse,
24
+ SubstateId,
25
+ substateIdToString,
26
+ SubstatesListRequest,
27
+ } from "@tari-project/typescript-bindings";
28
28
 
29
29
  export const WalletDaemonNotConnected = "WALLET_DAEMON_NOT_CONNECTED";
30
30
  export const Unsupported = "UNSUPPORTED";
@@ -194,7 +194,9 @@ export class WalletDaemonTariSigner implements TariSigner {
194
194
  detect_inputs_use_unversioned: req.detect_inputs_use_unversioned,
195
195
  };
196
196
 
197
- const res = await this.client.submitTransaction(params);
197
+ const res = req.is_dry_run
198
+ ? await this.client.submitTransactionDryRun(params)
199
+ : await this.client.submitTransaction(params);
198
200
  return { transaction_id: res.transaction_id };
199
201
  }
200
202
 
@@ -1,15 +1,6 @@
1
1
  import { TariSigner } from "@tari-project/tari-signer";
2
2
  import UniversalProvider from "@walletconnect/universal-provider";
3
3
  import { WalletConnectModal } from "@walletconnect/modal";
4
- import {
5
- ConfidentialViewVaultBalanceRequest,
6
- Instruction,
7
- KeyBranch,
8
- ListAccountNftRequest,
9
- ListAccountNftResponse,
10
- substateIdToString,
11
- TransactionSubmitRequest,
12
- } from "@tari-project/wallet_jrpc_client";
13
4
  import {
14
5
  convertStringToTransactionStatus,
15
6
  GetTransactionResultResponse,
@@ -22,6 +13,15 @@ import {
22
13
  ListSubstatesResponse,
23
14
  ListSubstatesRequest,
24
15
  } from "@tari-project/tarijs-types";
16
+ import {
17
+ ConfidentialViewVaultBalanceRequest,
18
+ Instruction,
19
+ KeyBranch,
20
+ ListAccountNftRequest,
21
+ ListAccountNftResponse,
22
+ substateIdToString,
23
+ TransactionSubmitRequest,
24
+ } from "@tari-project/typescript-bindings";
25
25
 
26
26
  const walletConnectParams = {
27
27
  requiredNamespaces: {
@@ -193,7 +193,7 @@ export class WalletConnectTariSigner implements TariSigner {
193
193
  }
194
194
 
195
195
  async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
196
- const method = "tari_submitTransaction";
196
+ const method = req.is_dry_run ? "tari_submitTransactionDryRun" : "tari_submitTransaction";
197
197
  const params: TransactionSubmitRequest = {
198
198
  transaction: {
199
199
  V1: {
@@ -8,8 +8,8 @@ catalog:
8
8
  vitest: ^3.0.4
9
9
  vite: ^6.1.0
10
10
  "@types/node": ^22.13.1
11
- "@tari-project/typescript-bindings": ^1.5.1
12
- "@tari-project/wallet_jrpc_client": ^1.5.1
11
+ "@tari-project/typescript-bindings": ^1.5.5
12
+ "@tari-project/wallet_jrpc_client": ^1.5.4
13
13
  "@metamask/providers": ^18.2.0
14
14
  "@walletconnect/universal-provider": ^2.13.3
15
15
  "@walletconnect/modal": ^2.6.2