@tari-project/tarijs 0.6.0 → 0.8.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/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/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 +36 -33
- package/packages/indexer_provider/package.json +1 -1
- package/packages/metamask_signer/package.json +1 -1
- package/packages/metamask_signer/src/index.ts +1 -1
- 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 -4
- package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +37 -2
- package/packages/tarijs_types/package.json +1 -1
- package/packages/tarijs_types/src/Instruction.ts +6 -2
- package/packages/tarijs_types/src/SubstateType.ts +1 -1
- package/packages/wallet_daemon/package.json +1 -1
- package/packages/wallet_daemon/src/signer.ts +1 -0
- package/packages/walletconnect/package.json +1 -1
- package/packages/walletconnect/src/index.ts +1 -0
- package/pnpm-workspace.yaml +2 -2
- package/scripts/check_versions.sh +2 -2
- package/scripts/set_package_versions.sh +39 -0
|
@@ -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,
|
|
@@ -180,7 +179,7 @@ describe("WalletDaemonTariSigner", () => {
|
|
|
180
179
|
componentAddress: account.address,
|
|
181
180
|
methodName: "deposit",
|
|
182
181
|
},
|
|
183
|
-
[
|
|
182
|
+
[workspaceId],
|
|
184
183
|
);
|
|
185
184
|
const transaction = builder.build();
|
|
186
185
|
|
|
@@ -338,4 +337,40 @@ describe("WalletDaemonTariSigner", () => {
|
|
|
338
337
|
expect(failure).toEqual("1 dangling address allocations remain after transaction execution");
|
|
339
338
|
});
|
|
340
339
|
});
|
|
340
|
+
|
|
341
|
+
describe("assertBucketContains", () => {
|
|
342
|
+
it("fails if bucket does not exist", async () => {
|
|
343
|
+
const signer = await buildSigner();
|
|
344
|
+
const account = await signer.getAccount();
|
|
345
|
+
|
|
346
|
+
const fee = new Amount(2000);
|
|
347
|
+
const builder = new TransactionBuilder();
|
|
348
|
+
builder.feeTransactionPayFromComponent(account.address, fee.getStringValue());
|
|
349
|
+
builder.assertBucketContains("not_exist", "resource_0000000000000000000000000000000000000000000000000000000000000000", Amount.newAmount(1));
|
|
350
|
+
const transaction = builder.build();
|
|
351
|
+
|
|
352
|
+
const isDryRun = false;
|
|
353
|
+
const inputRefs = undefined;
|
|
354
|
+
const network = Network.LocalNet;
|
|
355
|
+
const requiredSubstates = [{ substate_id: account.address }];
|
|
356
|
+
const submitTransactionRequest = buildTransactionRequest(
|
|
357
|
+
transaction,
|
|
358
|
+
account.account_id,
|
|
359
|
+
requiredSubstates,
|
|
360
|
+
inputRefs,
|
|
361
|
+
isDryRun,
|
|
362
|
+
network,
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
const txResult = await submitAndWaitForTransaction(signer, submitTransactionRequest);
|
|
366
|
+
|
|
367
|
+
expect(txResult.result.status).toBe(TransactionStatus.OnlyFeeAccepted);
|
|
368
|
+
|
|
369
|
+
const executionResult = txResult.result.result?.result;
|
|
370
|
+
const reason =
|
|
371
|
+
executionResult && "AcceptFeeRejectRest" in executionResult && executionResult.AcceptFeeRejectRest[1];
|
|
372
|
+
const failure = reason && typeof reason === "object" && "ExecutionFailure" in reason && reason.ExecutionFailure;
|
|
373
|
+
expect(failure).toContain("Item at id 0 does not exist on the workspace");
|
|
374
|
+
});
|
|
375
|
+
});
|
|
341
376
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentAddress, LogLevel, PublishedTemplateAddress, SubstateType } from "@tari-project/typescript-bindings";
|
|
1
|
+
import { ComponentAddress, ResourceAddress, LogLevel, PublishedTemplateAddress, SubstateType, WorkspaceOffsetId } from "@tari-project/typescript-bindings";
|
|
2
2
|
import { TransactionArg } from "./TransactionArg";
|
|
3
3
|
import { ConfidentialClaim } from "./ConfidentialClaim";
|
|
4
4
|
import { Amount } from "./Amount";
|
|
@@ -14,7 +14,8 @@ export type Instruction =
|
|
|
14
14
|
| ClaimValidatorFees
|
|
15
15
|
| DropAllProofsInWorkspace
|
|
16
16
|
| CreateFreeTestCoins
|
|
17
|
-
| AllocateAddress
|
|
17
|
+
| AllocateAddress
|
|
18
|
+
| AssertBucketContains;
|
|
18
19
|
|
|
19
20
|
export type CreateAccount = { CreateAccount: { owner_public_key: string; workspace_bucket: string | null } };
|
|
20
21
|
export type CallFunction = {
|
|
@@ -34,3 +35,6 @@ export type CreateFreeTestCoins = {
|
|
|
34
35
|
export type AllocateAddress = {
|
|
35
36
|
AllocateAddress: { substate_type: SubstateType; workspace_id: string };
|
|
36
37
|
};
|
|
38
|
+
export type AssertBucketContains = {
|
|
39
|
+
AssertBucketContains: { key: WorkspaceOffsetId; resource_address: ResourceAddress; min_amount: Amount };
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "
|
|
1
|
+
export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "ValidatorFeePool" | "Template";
|
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.0"
|
|
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
|
+
|