@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.
Files changed (35) 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/transaction-builder/inputs.md +0 -1
  6. package/docusaurus/tari-docs/package-lock.json +17964 -0
  7. package/docusaurus/tari-docs/package.json +2 -2
  8. package/package.json +1 -1
  9. package/packages/builders/package.json +3 -2
  10. package/packages/builders/src/helpers/index.ts +1 -1
  11. package/packages/builders/src/helpers/workspace.ts +32 -15
  12. package/packages/builders/src/index.ts +1 -2
  13. package/packages/builders/src/transaction/TransactionBuilder.ts +105 -38
  14. package/packages/builders/src/transaction/TransactionRequest.ts +36 -33
  15. package/packages/indexer_provider/package.json +1 -1
  16. package/packages/metamask_signer/package.json +1 -1
  17. package/packages/metamask_signer/src/index.ts +1 -1
  18. package/packages/tari_permissions/package.json +1 -1
  19. package/packages/tari_permissions/src/tari_permissions.ts +1 -17
  20. package/packages/tari_provider/package.json +1 -1
  21. package/packages/tari_signer/package.json +1 -1
  22. package/packages/tari_universe/package.json +1 -1
  23. package/packages/tarijs/package.json +1 -1
  24. package/packages/tarijs/src/index.ts +0 -4
  25. package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +37 -2
  26. package/packages/tarijs_types/package.json +1 -1
  27. package/packages/tarijs_types/src/Instruction.ts +6 -2
  28. package/packages/tarijs_types/src/SubstateType.ts +1 -1
  29. package/packages/wallet_daemon/package.json +1 -1
  30. package/packages/wallet_daemon/src/signer.ts +1 -0
  31. package/packages/walletconnect/package.json +1 -1
  32. package/packages/walletconnect/src/index.ts +1 -0
  33. package/pnpm-workspace.yaml +2 -2
  34. package/scripts/check_versions.sh +2 -2
  35. 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
- [fromWorkspace(workspaceId)],
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-types",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -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" | "NonFungibleIndex" | "ValidatorFeePool" | "Template";
1
+ export type SubstateType = "Component" | "Resource" | "Vault" | "UnclaimedConfidentialOutput" | "NonFungible" | "TransactionReceipt" | "ValidatorFeePool" | "Template";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-daemon-signer",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -184,6 +184,7 @@ export class WalletDaemonTariSigner implements TariSigner {
184
184
  })),
185
185
  min_epoch: null,
186
186
  max_epoch: null,
187
+ dry_run: req.is_dry_run,
187
188
  is_seal_signer_authorized: req.is_seal_signer_authorized,
188
189
  },
189
190
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-connect-signer",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -207,6 +207,7 @@ export class WalletConnectTariSigner implements TariSigner {
207
207
  })),
208
208
  min_epoch: null,
209
209
  max_epoch: null,
210
+ dry_run: req.is_dry_run,
210
211
  is_seal_signer_authorized: req.is_seal_signer_authorized,
211
212
  },
212
213
  },
@@ -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.5
12
- "@tari-project/wallet_jrpc_client": ^1.5.4
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
+