@tari-project/tarijs 0.5.4 → 0.6.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.
- package/.github/workflows/check-package-versions.yml +22 -0
- package/docusaurus/tari-docs/docs/installation.md +89 -8
- package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/instruction.md +12 -1
- package/docusaurus/tari-docs/package.json +1 -1
- package/package.json +1 -1
- package/packages/builders/package.json +1 -1
- package/packages/builders/src/helpers/workspace.ts +8 -15
- package/packages/builders/src/transaction/TransactionBuilder.ts +10 -0
- package/packages/indexer_provider/package.json +1 -1
- package/packages/indexer_provider/src/provider.ts +1 -1
- package/packages/metamask_signer/package.json +1 -1
- package/packages/tari_permissions/package.json +1 -1
- package/packages/tari_provider/package.json +1 -1
- package/packages/tari_signer/package.json +1 -1
- package/packages/tari_universe/package.json +1 -1
- package/packages/tari_universe/src/signer.ts +3 -3
- package/packages/tarijs/package.json +1 -1
- package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +124 -1
- package/packages/tarijs_types/package.json +1 -1
- package/packages/tarijs_types/src/Instruction.ts +7 -3
- package/packages/tarijs_types/src/SubstateType.ts +1 -0
- package/packages/tarijs_types/src/Workspace.ts +1 -1
- package/packages/tarijs_types/src/index.ts +1 -0
- package/packages/wallet_daemon/package.json +2 -1
- package/packages/wallet_daemon/src/signer.ts +14 -12
- package/packages/walletconnect/package.json +1 -1
- package/packages/walletconnect/src/index.ts +10 -10
- package/pnpm-workspace.yaml +2 -2
- package/scripts/check_versions.sh +42 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Check package versions
|
|
2
|
+
name: Check Package Versions
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
pull_request:
|
|
9
|
+
types:
|
|
10
|
+
- opened
|
|
11
|
+
- reopened
|
|
12
|
+
- synchronize
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
check_versions:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Check package.json versions
|
|
22
|
+
run: ./scripts/check_versions.sh
|
|
@@ -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
|
-
##
|
|
12
|
+
## Prerequisites
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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/
|
|
101
|
+
npm install @tari-project/tarijs
|
|
25
102
|
```
|
|
26
103
|
|
|
27
|
-
|
|
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.
|
package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/instruction.md
CHANGED
|
@@ -4,7 +4,7 @@ sidebar_position: 3
|
|
|
4
4
|
|
|
5
5
|
# Instructions
|
|
6
6
|
|
|
7
|
-
There are
|
|
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
|
@@ -3,19 +3,14 @@ import { WorkspaceArg } from "@tari-project/tarijs-types";
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param key workspace name
|
|
6
|
-
* @returns encoded
|
|
6
|
+
* @returns encoded hex value
|
|
7
7
|
* @example
|
|
8
|
-
* key: "
|
|
9
|
-
* key: "
|
|
10
|
-
* key: "
|
|
11
|
-
*
|
|
12
|
-
* key: "bucket" -> [ 98, 117, 99, 107, 101, 116 ]
|
|
13
|
-
* key: "bucket.0" -> [ 98, 117, 99, 107, 101, 116, 46, 48 ]
|
|
14
|
-
* key: "bucket.1" -> [ 98, 117, 99, 107, 101, 116, 46, 49 ]
|
|
8
|
+
* key: "bucket" -> "6275636b6574"
|
|
9
|
+
* key: "bucket.0" -> "6275636b65742e30"
|
|
10
|
+
* key: "bucket.1" -> "6275636b65742e31"
|
|
15
11
|
*/
|
|
16
|
-
export function toWorkspace(key: string):
|
|
17
|
-
|
|
18
|
-
return Array.from(encoder.encode(key));
|
|
12
|
+
export function toWorkspace(key: string): string {
|
|
13
|
+
return Buffer.from(key).toString("hex");
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
/**
|
|
@@ -23,10 +18,8 @@ export function toWorkspace(key: string): number[] {
|
|
|
23
18
|
* @param key workspace name
|
|
24
19
|
* @returns formatted Workspace data
|
|
25
20
|
* @example
|
|
26
|
-
* key: "bucket" -> { Workspace:
|
|
21
|
+
* key: "bucket" -> { Workspace: "6275636b6574" }
|
|
27
22
|
*/
|
|
28
23
|
export function fromWorkspace(key: string): WorkspaceArg {
|
|
29
|
-
|
|
30
|
-
const encodedKey = encoder.encode(key);
|
|
31
|
-
return { Workspace: Array.from(encodedKey) };
|
|
24
|
+
return { Workspace: Buffer.from(key).toString("hex") };
|
|
32
25
|
}
|
|
@@ -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:
|
|
73
|
+
address: substate_address,
|
|
74
74
|
version: version ?? null,
|
|
75
75
|
local_search_only: false,
|
|
76
76
|
});
|
|
@@ -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/
|
|
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";
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { assert, describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Amount,
|
|
5
|
+
buildTransactionRequest,
|
|
6
|
+
fromWorkspace,
|
|
7
|
+
Network,
|
|
8
|
+
submitAndWaitForTransaction,
|
|
9
|
+
SubmitTransactionRequest,
|
|
10
|
+
TariPermissions,
|
|
11
|
+
TransactionBuilder,
|
|
12
|
+
TransactionStatus,
|
|
13
|
+
waitForTransactionResult,
|
|
14
|
+
WalletDaemonTariSigner,
|
|
15
|
+
} from "../../../src";
|
|
4
16
|
|
|
5
17
|
function buildSigner(): Promise<WalletDaemonTariSigner> {
|
|
6
18
|
const permissions = new TariPermissions().addPermission("Admin");
|
|
@@ -113,6 +125,81 @@ 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
|
+
});
|
|
159
|
+
|
|
160
|
+
it("submits a transaction, that uses workspaces", async () => {
|
|
161
|
+
const workspaceId = "bucket";
|
|
162
|
+
const signer = await buildSigner();
|
|
163
|
+
const account = await signer.getAccount();
|
|
164
|
+
const xtrAddress = account.resources[0].resource_address;
|
|
165
|
+
|
|
166
|
+
const fee = new Amount(2000);
|
|
167
|
+
const builder = new TransactionBuilder();
|
|
168
|
+
builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
|
|
169
|
+
|
|
170
|
+
builder.callMethod(
|
|
171
|
+
{
|
|
172
|
+
componentAddress: account.address,
|
|
173
|
+
methodName: "withdraw",
|
|
174
|
+
},
|
|
175
|
+
[xtrAddress, 10],
|
|
176
|
+
);
|
|
177
|
+
builder.saveVar(workspaceId);
|
|
178
|
+
builder.callMethod(
|
|
179
|
+
{
|
|
180
|
+
componentAddress: account.address,
|
|
181
|
+
methodName: "deposit",
|
|
182
|
+
},
|
|
183
|
+
[fromWorkspace(workspaceId)],
|
|
184
|
+
);
|
|
185
|
+
const transaction = builder.build();
|
|
186
|
+
|
|
187
|
+
const isDryRun = false;
|
|
188
|
+
const inputRefs = undefined;
|
|
189
|
+
const network = Network.LocalNet;
|
|
190
|
+
const requiredSubstates = [{ substate_id: account.address }];
|
|
191
|
+
const submitTransactionRequest = buildTransactionRequest(
|
|
192
|
+
transaction,
|
|
193
|
+
account.account_id,
|
|
194
|
+
requiredSubstates,
|
|
195
|
+
inputRefs,
|
|
196
|
+
isDryRun,
|
|
197
|
+
network,
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
|
|
201
|
+
expect(txResult.result.status).toBe(TransactionStatus.Accepted);
|
|
202
|
+
});
|
|
116
203
|
});
|
|
117
204
|
|
|
118
205
|
describe("getAccountBalances", () => {
|
|
@@ -215,4 +302,40 @@ describe("WalletDaemonTariSigner", () => {
|
|
|
215
302
|
expect(substates.every((substate) => substate.module_name)).toBe(true);
|
|
216
303
|
});
|
|
217
304
|
});
|
|
305
|
+
|
|
306
|
+
describe("allocateAddress", () => {
|
|
307
|
+
it("allocates component address", async () => {
|
|
308
|
+
const signer = await buildSigner();
|
|
309
|
+
const account = await signer.getAccount();
|
|
310
|
+
|
|
311
|
+
const fee = new Amount(2000);
|
|
312
|
+
const builder = new TransactionBuilder();
|
|
313
|
+
builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
|
|
314
|
+
builder.allocateAddress("Component", "id-1");
|
|
315
|
+
const transaction = builder.build();
|
|
316
|
+
|
|
317
|
+
const isDryRun = false;
|
|
318
|
+
const inputRefs = undefined;
|
|
319
|
+
const network = Network.LocalNet;
|
|
320
|
+
const requiredSubstates = [{ substate_id: account.address }];
|
|
321
|
+
const submitTransactionRequest = buildTransactionRequest(
|
|
322
|
+
transaction,
|
|
323
|
+
account.account_id,
|
|
324
|
+
requiredSubstates,
|
|
325
|
+
inputRefs,
|
|
326
|
+
isDryRun,
|
|
327
|
+
network,
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
|
|
331
|
+
|
|
332
|
+
expect(txResult.result.status).toBe(TransactionStatus.OnlyFeeAccepted);
|
|
333
|
+
|
|
334
|
+
const executionResult = txResult.result.result?.result;
|
|
335
|
+
const reason =
|
|
336
|
+
executionResult && "AcceptFeeRejectRest" in executionResult && executionResult.AcceptFeeRejectRest[1];
|
|
337
|
+
const failure = reason && typeof reason === "object" && "ExecutionFailure" in reason && reason.ExecutionFailure;
|
|
338
|
+
expect(failure).toEqual("1 dangling address allocations remain after transaction execution");
|
|
339
|
+
});
|
|
340
|
+
});
|
|
218
341
|
});
|
|
@@ -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 = {
|
|
@@ -22,7 +23,7 @@ export type CallFunction = {
|
|
|
22
23
|
export type CallMethod = {
|
|
23
24
|
CallMethod: { component_address: ComponentAddress; method: string; args: Array<TransactionArg> };
|
|
24
25
|
};
|
|
25
|
-
export type PutLastInstructionOutputOnWorkspace = { PutLastInstructionOutputOnWorkspace: { key:
|
|
26
|
+
export type PutLastInstructionOutputOnWorkspace = { PutLastInstructionOutputOnWorkspace: { key: string } };
|
|
26
27
|
export type EmitLog = { EmitLog: { level: LogLevel; message: string } };
|
|
27
28
|
export type ClaimBurn = { ClaimBurn: { claim: ConfidentialClaim } };
|
|
28
29
|
export type ClaimValidatorFees = { ClaimValidatorFees: { epoch: number; validator_public_key: string } };
|
|
@@ -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";
|
|
@@ -16,6 +16,7 @@ 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 { SubstateType } from "./SubstateType";
|
|
19
20
|
export {
|
|
20
21
|
TransactionResult,
|
|
21
22
|
SubmitTxResult,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/wallet-daemon-signer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -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 =
|
|
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: {
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -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.
|
|
12
|
-
"@tari-project/wallet_jrpc_client": ^1.5.
|
|
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
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
IFS=$'\n\t'
|
|
4
|
+
|
|
5
|
+
echo "Finding all package.json files and extracting versions..."
|
|
6
|
+
|
|
7
|
+
declare -a versions
|
|
8
|
+
|
|
9
|
+
# Find all package.json files, excluding node_modules, and extract the version
|
|
10
|
+
while IFS= read -r file; do
|
|
11
|
+
version=$(jq -r '.version' "$file")
|
|
12
|
+
if [[ -z "$version" || "$version" == "null" ]]; then
|
|
13
|
+
echo "::error::Could not find 'version' field in $file"
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
echo "Found version '$version' in $file"
|
|
17
|
+
versions+=("$version")
|
|
18
|
+
done < <(find . -name 'package.json' -not -path '*/node_modules/*')
|
|
19
|
+
|
|
20
|
+
if [ ${#versions[@]} -eq 0 ]; then
|
|
21
|
+
echo "Error: No package.json files with a 'version' field were found."
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
reference_version=${versions[0]}
|
|
26
|
+
echo "Reference version: $reference_version"
|
|
27
|
+
|
|
28
|
+
all_same=true
|
|
29
|
+
for version in "${versions[@]}"; do
|
|
30
|
+
if [ "$version" != "$reference_version" ]; then
|
|
31
|
+
echo "Error: Mismatched version found! '$version' does not match '$reference_version'."
|
|
32
|
+
all_same=false
|
|
33
|
+
break
|
|
34
|
+
fi
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
if [ "$all_same" = false ]; then
|
|
38
|
+
echo "::error::All package.json versions are NOT the same. Please unify them."
|
|
39
|
+
exit 1
|
|
40
|
+
else
|
|
41
|
+
echo "All package.json versions are consistent: $reference_version"
|
|
42
|
+
fi
|