@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.
- package/.github/PULL_REQUEST_TEMPLATE.md +2 -12
- package/Dockerfile +2 -2
- package/README.md +1 -1
- package/docusaurus/tari-docs/docs/provider-vs-signer.md +27 -0
- package/docusaurus/tari-docs/docs/wallet/submit-transaction/build-execute-request.md +0 -2
- package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/inputs.md +0 -1
- package/docusaurus/tari-docs/package-lock.json +17964 -0
- package/docusaurus/tari-docs/package.json +2 -2
- package/package.json +1 -1
- package/packages/builders/package.json +3 -2
- package/packages/builders/src/helpers/index.ts +1 -1
- package/packages/builders/src/helpers/submitTransaction.ts +26 -31
- package/packages/builders/src/helpers/workspace.ts +32 -15
- package/packages/builders/src/index.ts +1 -2
- package/packages/builders/src/transaction/TransactionBuilder.ts +105 -38
- package/packages/builders/src/transaction/TransactionRequest.ts +30 -38
- package/packages/indexer_provider/package.json +1 -1
- package/packages/metamask_signer/package.json +1 -1
- package/packages/metamask_signer/src/index.ts +12 -19
- package/packages/tari_permissions/package.json +1 -1
- package/packages/tari_permissions/src/tari_permissions.ts +1 -17
- 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/tarijs/package.json +1 -1
- package/packages/tarijs/src/index.ts +0 -8
- package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +74 -44
- package/packages/tarijs_types/package.json +1 -1
- package/packages/tarijs_types/src/SubstateDiff.ts +0 -4
- package/packages/tarijs_types/src/SubstateType.ts +1 -1
- package/packages/tarijs_types/src/TransactionResult.ts +2 -8
- package/packages/tarijs_types/src/TransactionStatus.ts +7 -7
- package/packages/tarijs_types/src/helpers/txResult.ts +8 -11
- package/packages/tarijs_types/src/index.ts +1 -16
- package/packages/tarijs_types/src/signer.ts +6 -11
- package/packages/wallet_daemon/package.json +1 -1
- package/packages/wallet_daemon/src/signer.ts +12 -25
- package/packages/wallet_daemon/src/webrtc.ts +3 -3
- package/packages/walletconnect/package.json +1 -1
- package/packages/walletconnect/src/index.ts +14 -28
- package/pnpm-workspace.yaml +2 -2
- package/scripts/check_versions.sh +2 -2
- package/scripts/set_package_versions.sh +39 -0
- package/packages/tarijs_types/src/FinalizeResult.ts +0 -17
- package/packages/tarijs_types/src/Instruction.ts +0 -36
- package/packages/tarijs_types/src/SubstateRequirement.ts +0 -6
- package/packages/tarijs_types/src/Transaction.ts +0 -16
- package/packages/tarijs_types/src/UnsignedTransaction.ts +0 -14
- package/packages/tarijs_types/src/VersionedSubstateId.ts +0 -6
|
@@ -5,17 +5,16 @@ import {
|
|
|
5
5
|
convertStringToTransactionStatus,
|
|
6
6
|
GetTransactionResultResponse,
|
|
7
7
|
SubmitTransactionRequest,
|
|
8
|
-
SubmitTransactionResponse,
|
|
9
8
|
VaultBalances,
|
|
10
9
|
TemplateDefinition,
|
|
11
10
|
Substate,
|
|
12
11
|
AccountData,
|
|
13
12
|
ListSubstatesResponse,
|
|
14
13
|
ListSubstatesRequest,
|
|
14
|
+
SubmitTransactionResponse,
|
|
15
15
|
} from "@tari-project/tarijs-types";
|
|
16
16
|
import {
|
|
17
17
|
ConfidentialViewVaultBalanceRequest,
|
|
18
|
-
Instruction,
|
|
19
18
|
KeyBranch,
|
|
20
19
|
ListAccountNftRequest,
|
|
21
20
|
ListAccountNftResponse,
|
|
@@ -40,7 +39,7 @@ const walletConnectParams = {
|
|
|
40
39
|
"tari_getNftsList",
|
|
41
40
|
],
|
|
42
41
|
chains: ["tari:devnet"],
|
|
43
|
-
events: [
|
|
42
|
+
events: ["chainChanged\", \"accountsChanged"],
|
|
44
43
|
},
|
|
45
44
|
},
|
|
46
45
|
};
|
|
@@ -152,11 +151,11 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
public async listSubstates({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
filter_by_template,
|
|
155
|
+
filter_by_type,
|
|
156
|
+
limit,
|
|
157
|
+
offset,
|
|
158
|
+
}: ListSubstatesRequest): Promise<ListSubstatesResponse> {
|
|
160
159
|
const method = "tari_listSubstates";
|
|
161
160
|
const params = {
|
|
162
161
|
filter_by_template,
|
|
@@ -193,25 +192,12 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
|
|
196
|
-
const method = req.
|
|
195
|
+
const method = req.transaction.dry_run ? "tari_submitTransactionDryRun" : "tari_submitTransaction";
|
|
197
196
|
const params: TransactionSubmitRequest = {
|
|
198
197
|
transaction: {
|
|
199
|
-
V1:
|
|
200
|
-
network: req.network,
|
|
201
|
-
fee_instructions: req.fee_instructions as Instruction[],
|
|
202
|
-
instructions: req.instructions as Instruction[],
|
|
203
|
-
inputs: req.required_substates.map((s) => ({
|
|
204
|
-
// TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
|
|
205
|
-
substate_id: s.substate_id as any,
|
|
206
|
-
version: s.version ?? null,
|
|
207
|
-
})),
|
|
208
|
-
min_epoch: null,
|
|
209
|
-
max_epoch: null,
|
|
210
|
-
is_seal_signer_authorized: req.is_seal_signer_authorized,
|
|
211
|
-
},
|
|
198
|
+
V1: req.transaction,
|
|
212
199
|
},
|
|
213
200
|
signing_key_index: req.account_id,
|
|
214
|
-
autofill_inputs: [],
|
|
215
201
|
detect_inputs: true,
|
|
216
202
|
proof_ids: [],
|
|
217
203
|
detect_inputs_use_unversioned: req.detect_inputs_use_unversioned,
|
|
@@ -243,11 +229,11 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
243
229
|
}
|
|
244
230
|
|
|
245
231
|
async getConfidentialVaultBalances({
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
232
|
+
vault_id,
|
|
233
|
+
view_key_id,
|
|
234
|
+
maximum_expected_value = null,
|
|
235
|
+
minimum_expected_value = null,
|
|
236
|
+
}: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances> {
|
|
251
237
|
const method = "tari_viewConfidentialVaultBalance";
|
|
252
238
|
const params = {
|
|
253
239
|
view_key_id,
|
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":
|
|
12
|
-
"@tari-project/wallet_jrpc_client": ^1.
|
|
11
|
+
"@tari-project/typescript-bindings": ">=1.9.1"
|
|
12
|
+
"@tari-project/wallet_jrpc_client": ^1.6.0
|
|
13
13
|
"@metamask/providers": ^18.2.0
|
|
14
14
|
"@walletconnect/universal-provider": ^2.13.3
|
|
15
15
|
"@walletconnect/modal": ^2.6.2
|
|
@@ -35,8 +35,8 @@ for version in "${versions[@]}"; do
|
|
|
35
35
|
done
|
|
36
36
|
|
|
37
37
|
if [ "$all_same" = false ]; then
|
|
38
|
-
echo "::error::All package.json versions are NOT the same. Please unify them."
|
|
38
|
+
echo "❌ ::error::All package.json versions are NOT the same. Please unify them."
|
|
39
39
|
exit 1
|
|
40
40
|
else
|
|
41
|
-
echo "All package.json versions are consistent: $reference_version"
|
|
41
|
+
echo "✅ All package.json versions are consistent: $reference_version"
|
|
42
42
|
fi
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# This script sets the package versions in all package.json files for the workspace.
|
|
5
|
+
|
|
6
|
+
# Usage: ./scripts/set_package_versions.sh <version>
|
|
7
|
+
if [ "$#" -ne 1 ]; then
|
|
8
|
+
echo "Usage: $0 <version>"
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
gitroot=$(git rev-parse --show-toplevel)
|
|
13
|
+
|
|
14
|
+
VERSION=$1
|
|
15
|
+
# Find all package.json files in the workspace
|
|
16
|
+
pushd "${gitroot}/packages" > /dev/null
|
|
17
|
+
find . -depth -maxdepth 2 -name 'package.json' | while read -r package_json; do
|
|
18
|
+
# Update the version in the package.json file
|
|
19
|
+
jq --arg version "$VERSION" '.version = $version' "$package_json" > "$package_json.tmp" && mv "$package_json.tmp" "$package_json"
|
|
20
|
+
echo "Updated version in $package_json to $VERSION"
|
|
21
|
+
done
|
|
22
|
+
popd > /dev/null
|
|
23
|
+
|
|
24
|
+
pushd "${gitroot}/docusaurus/tari-docs" > /dev/null
|
|
25
|
+
jq --arg version "$VERSION" '.version = $version' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
26
|
+
echo "Updated docusaurus package.json version to $VERSION"
|
|
27
|
+
popd > /dev/null
|
|
28
|
+
|
|
29
|
+
pushd "${gitroot}" > /dev/null
|
|
30
|
+
# Update the version in the root package.json
|
|
31
|
+
jq --arg version "$VERSION" '.version = $version' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
32
|
+
echo "Updated root package.json version to $VERSION"
|
|
33
|
+
|
|
34
|
+
pnpm install
|
|
35
|
+
|
|
36
|
+
echo "Running check_versions script to verify versions..."
|
|
37
|
+
./scripts/check_versions.sh
|
|
38
|
+
popd > /dev/null
|
|
39
|
+
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FeeReceipt, InstructionResult, LogEntry, RejectReason } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { SubstateDiff } from "./SubstateDiff";
|
|
3
|
-
|
|
4
|
-
export type TxResultAccept = { Accept: SubstateDiff };
|
|
5
|
-
export type TxResultAcceptFeeRejectRest = { AcceptFeeRejectRest: [SubstateDiff, RejectReason] };
|
|
6
|
-
export type TxResultReject = { Reject: RejectReason };
|
|
7
|
-
|
|
8
|
-
export type FinalizeResultStatus = TxResultAccept | TxResultAcceptFeeRejectRest | TxResultReject;
|
|
9
|
-
|
|
10
|
-
export interface FinalizeResult {
|
|
11
|
-
transaction_hash: Uint8Array;
|
|
12
|
-
events: Array<Event>;
|
|
13
|
-
logs: Array<LogEntry>;
|
|
14
|
-
execution_results: Array<InstructionResult>;
|
|
15
|
-
result: FinalizeResultStatus;
|
|
16
|
-
fee_receipt: FeeReceipt;
|
|
17
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ComponentAddress, LogLevel, PublishedTemplateAddress, SubstateType } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { TransactionArg } from "./TransactionArg";
|
|
3
|
-
import { ConfidentialClaim } from "./ConfidentialClaim";
|
|
4
|
-
import { Amount } from "./Amount";
|
|
5
|
-
import { ConfidentialOutput } from "./ConfidentialOutput";
|
|
6
|
-
|
|
7
|
-
export type Instruction =
|
|
8
|
-
| CreateAccount
|
|
9
|
-
| CallFunction
|
|
10
|
-
| CallMethod
|
|
11
|
-
| PutLastInstructionOutputOnWorkspace
|
|
12
|
-
| EmitLog
|
|
13
|
-
| ClaimBurn
|
|
14
|
-
| ClaimValidatorFees
|
|
15
|
-
| DropAllProofsInWorkspace
|
|
16
|
-
| CreateFreeTestCoins
|
|
17
|
-
| AllocateAddress;
|
|
18
|
-
|
|
19
|
-
export type CreateAccount = { CreateAccount: { owner_public_key: string; workspace_bucket: string | null } };
|
|
20
|
-
export type CallFunction = {
|
|
21
|
-
CallFunction: { template_address: PublishedTemplateAddress; function: string; args: Array<TransactionArg> };
|
|
22
|
-
};
|
|
23
|
-
export type CallMethod = {
|
|
24
|
-
CallMethod: { component_address: ComponentAddress; method: string; args: Array<TransactionArg> };
|
|
25
|
-
};
|
|
26
|
-
export type PutLastInstructionOutputOnWorkspace = { PutLastInstructionOutputOnWorkspace: { key: string } };
|
|
27
|
-
export type EmitLog = { EmitLog: { level: LogLevel; message: string } };
|
|
28
|
-
export type ClaimBurn = { ClaimBurn: { claim: ConfidentialClaim } };
|
|
29
|
-
export type ClaimValidatorFees = { ClaimValidatorFees: { epoch: number; validator_public_key: string } };
|
|
30
|
-
export type DropAllProofsInWorkspace = "DropAllProofsInWorkspace";
|
|
31
|
-
export type CreateFreeTestCoins = {
|
|
32
|
-
CreateFreeTestCoins: { revealed_amount: Amount; output: ConfidentialOutput | null };
|
|
33
|
-
};
|
|
34
|
-
export type AllocateAddress = {
|
|
35
|
-
AllocateAddress: { substate_type: SubstateType; workspace_id: string };
|
|
36
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Instruction } from "./Instruction";
|
|
2
|
-
import { SubstateRequirement } from "./SubstateRequirement";
|
|
3
|
-
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
4
|
-
import { TransactionSignature } from "./TransactionSignature";
|
|
5
|
-
import { Epoch } from "@tari-project/typescript-bindings";
|
|
6
|
-
|
|
7
|
-
export interface Transaction {
|
|
8
|
-
id: string;
|
|
9
|
-
feeInstructions: Array<Instruction>;
|
|
10
|
-
instructions: Array<Instruction>;
|
|
11
|
-
inputs: Array<SubstateRequirement>;
|
|
12
|
-
minEpoch?: Epoch;
|
|
13
|
-
maxEpoch?: Epoch;
|
|
14
|
-
signatures: Array<TransactionSignature>;
|
|
15
|
-
filledInputs: Array<VersionedSubstateId>;
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Epoch } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { Instruction } from "./Instruction";
|
|
3
|
-
import { SubstateRequirement } from "./SubstateRequirement";
|
|
4
|
-
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
5
|
-
|
|
6
|
-
// differs from bindings implementation because of 'Instruction'
|
|
7
|
-
export interface UnsignedTransaction {
|
|
8
|
-
feeInstructions: Instruction[];
|
|
9
|
-
instructions: Instruction[];
|
|
10
|
-
inputs: SubstateRequirement[];
|
|
11
|
-
filledInputs: VersionedSubstateId[];
|
|
12
|
-
minEpoch?: Epoch;
|
|
13
|
-
maxEpoch?: Epoch;
|
|
14
|
-
}
|