@tari-project/tarijs 0.5.5 → 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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tari-docs",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
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.5",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,19 +3,14 @@ import { WorkspaceArg } from "@tari-project/tarijs-types";
3
3
  /**
4
4
  *
5
5
  * @param key workspace name
6
- * @returns encoded Uint8Array value
6
+ * @returns encoded hex value
7
7
  * @example
8
- * key: "0" -> [ 48 ]
9
- * key: "0.0" -> [ 48, 46, 48 ]
10
- * key: "0.1" -> [ 48, 46, 49 ]
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): number[] {
17
- const encoder = new TextEncoder();
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: [ 98, 117, 99, 107, 101, 116 ] }
21
+ * key: "bucket" -> { Workspace: "6275636b6574" }
27
22
  */
28
23
  export function fromWorkspace(key: string): WorkspaceArg {
29
- const encoder = new TextEncoder();
30
- const encodedKey = encoder.encode(key);
31
- return { Workspace: Array.from(encodedKey) };
24
+ return { Workspace: Buffer.from(key).toString("hex") };
32
25
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/indexer-provider",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/metamask-signer",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-permissions",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-provider",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-signer",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-universe-signer",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-all",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,6 +3,7 @@ import { assert, describe, expect, it } from "vitest";
3
3
  import {
4
4
  Amount,
5
5
  buildTransactionRequest,
6
+ fromWorkspace,
6
7
  Network,
7
8
  submitAndWaitForTransaction,
8
9
  SubmitTransactionRequest,
@@ -12,7 +13,6 @@ import {
12
13
  waitForTransactionResult,
13
14
  WalletDaemonTariSigner,
14
15
  } from "../../../src";
15
- import { inspect } from "util";
16
16
 
17
17
  function buildSigner(): Promise<WalletDaemonTariSigner> {
18
18
  const permissions = new TariPermissions().addPermission("Admin");
@@ -156,6 +156,50 @@ describe("WalletDaemonTariSigner", () => {
156
156
 
157
157
  expect(txResult.status).toEqual(TransactionStatus.DryRun);
158
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
+ });
159
203
  });
160
204
 
161
205
  describe("getAccountBalances", () => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-types",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -23,7 +23,7 @@ export type CallFunction = {
23
23
  export type CallMethod = {
24
24
  CallMethod: { component_address: ComponentAddress; method: string; args: Array<TransactionArg> };
25
25
  };
26
- export type PutLastInstructionOutputOnWorkspace = { PutLastInstructionOutputOnWorkspace: { key: number[] } };
26
+ export type PutLastInstructionOutputOnWorkspace = { PutLastInstructionOutputOnWorkspace: { key: string } };
27
27
  export type EmitLog = { EmitLog: { level: LogLevel; message: string } };
28
28
  export type ClaimBurn = { ClaimBurn: { claim: ConfidentialClaim } };
29
29
  export type ClaimValidatorFees = { ClaimValidatorFees: { epoch: number; validator_public_key: string } };
@@ -1,3 +1,3 @@
1
1
  export interface WorkspaceArg {
2
- Workspace: number[];
2
+ Workspace: string;
3
3
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-daemon-signer",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-connect-signer",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -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