From 7edb17d0b4faf3f327080b2f43135ba431939465 Mon Sep 17 00:00:00 2001 From: Tomek Marciniak Date: Thu, 24 Oct 2024 16:29:32 +0300 Subject: [PATCH] fix(accounts): fix failing specs --- .../private-key-to-account.spec.ts.snap | 14 +++++++------- .../src/accounts/private-key-to-account.spec.ts | 2 +- packages/connect/src/client.spec.ts | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/accounts/src/accounts/__snapshots__/private-key-to-account.spec.ts.snap b/packages/accounts/src/accounts/__snapshots__/private-key-to-account.spec.ts.snap index 68470b1..4abf2ea 100644 --- a/packages/accounts/src/accounts/__snapshots__/private-key-to-account.spec.ts.snap +++ b/packages/accounts/src/accounts/__snapshots__/private-key-to-account.spec.ts.snap @@ -26,13 +26,13 @@ exports[`signs a message 1`] = ` exports[`signs a transaction 1`] = ` { "data": { - "amount": 3000000000n, - "fee": 100000000n, + "amount": "3000000000", + "fee": "100000000", "from": "B62qmWKtvNQTtUqo1LxfEEDLyWMg59cp6U7c4uDC7aqgaCEijSc3Hx5", "memo": "", - "nonce": 1n, + "nonce": "1", "to": "B62qmWKtvNQTtUqo1LxfEEDLyWMg59cp6U7c4uDC7aqgaCEijSc3Hx5", - "validUntil": 4294967295n, + "validUntil": "4294967295", }, "publicKey": "B62qmWKtvNQTtUqo1LxfEEDLyWMg59cp6U7c4uDC7aqgaCEijSc3Hx5", "signature": { @@ -45,9 +45,9 @@ exports[`signs a transaction 1`] = ` exports[`signs fields 1`] = ` { "data": [ - 1n, - 2n, - 3n, + "1", + "2", + "3", ], "publicKey": "B62qmWKtvNQTtUqo1LxfEEDLyWMg59cp6U7c4uDC7aqgaCEijSc3Hx5", "signature": "7mXCUvhLhFvG9ptrdfNceCrpThkCUyg1ct2z8uwY7eQbKz7UNmhv33TbuDjTznaypJtXRiMJyQWDnf27TH1FSXG7uJHTKAd9", diff --git a/packages/accounts/src/accounts/private-key-to-account.spec.ts b/packages/accounts/src/accounts/private-key-to-account.spec.ts index dc6b993..7ed0724 100644 --- a/packages/accounts/src/accounts/private-key-to-account.spec.ts +++ b/packages/accounts/src/accounts/private-key-to-account.spec.ts @@ -41,7 +41,7 @@ it("creates a nullifier", async () => { const nullifier = await account.createNullifier({ message: message.map((el) => el.toString()), }); - expect(typeof nullifier.private.c).toBe("bigint"); + expect(typeof nullifier.private.c).toBe("string"); }); it("signs fields", async () => { diff --git a/packages/connect/src/client.spec.ts b/packages/connect/src/client.spec.ts index 8c578b1..fb66230 100644 --- a/packages/connect/src/client.spec.ts +++ b/packages/connect/src/client.spec.ts @@ -39,7 +39,7 @@ describe("json-rpc source", () => { providerSource: "klesia", }); const balance = await client.getBalance(); - expect(balance).toBeGreaterThanOrEqual(0); + expect(BigInt(balance)).toBeGreaterThanOrEqual(0); }); it("returns transaction count", async () => { @@ -50,7 +50,7 @@ describe("json-rpc source", () => { providerSource: "klesia", }); const transactionCount = await client.getTransactionCount(); - expect(transactionCount).toBeGreaterThanOrEqual(0); + expect(BigInt(transactionCount)).toBeGreaterThanOrEqual(0); }); it("returns chain id", async () => { @@ -83,7 +83,7 @@ describe("local source", () => { const transaction = await client.prepareTransactionRequest({ from: PUBLIC_KEY, to: PUBLIC_KEY, - amount: 1_000_000_000n, + amount: "1000000000", }); expect(transaction.fee).toBeDefined(); expect(transaction.nonce).toBeDefined();