From c12179f1b7de37b866180a4ee4941fec6abc0fc2 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Sat, 21 Oct 2023 07:59:15 +0200 Subject: [PATCH 1/3] Fix SDK network tests --- sdk/tests/network-client.test.ts | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/sdk/tests/network-client.test.ts b/sdk/tests/network-client.test.ts index 2656530e1..e9a54891e 100644 --- a/sdk/tests/network-client.test.ts +++ b/sdk/tests/network-client.test.ts @@ -22,7 +22,7 @@ describe('NodeConnection', () => { describe('getBlock', () => { it('should return a Block object', async () => { const block = await connection.getBlock(1); - expect((block as Block).block_hash).toEqual("ab1n79nyqnxa76wpz40efqlq53artsw86wrez4tw9kn5xrpuc65xyxquh3wnw"); + expect((block as Block).block_hash).toEqual("ab1hap8jlxaz66yt887gxlgxptkm2y0dy72x529mq6pg3ysy9tzwyqsphva9c"); }, 60000); it('should throw an error if the request fails', async () => { @@ -35,8 +35,8 @@ describe('NodeConnection', () => { const blockRange = await connection.getBlockRange(1, 3); expect(Array.isArray(blockRange)).toBe(true); expect((blockRange as Block[]).length).toBe(2); - expect(((blockRange as Block[])[0] as Block).block_hash).toBe("ab1n79nyqnxa76wpz40efqlq53artsw86wrez4tw9kn5xrpuc65xyxquh3wnw"); - expect(((blockRange as Block[])[1] as Block).block_hash).toBe("ab1ywy38xs5c73s2q9v3mgyes5cup5wwtg8r2mlad0534zdmltadcrq9dpuw6"); + expect(((blockRange as Block[])[0] as Block).block_hash).toBe("ab1hap8jlxaz66yt887gxlgxptkm2y0dy72x529mq6pg3ysy9tzwyqsphva9c"); + expect(((blockRange as Block[])[1] as Block).block_hash).toBe("ab18dzmjgqgk5z6x4gggezca7aenqts7289chvhus4a7ydrcj4apvrqq5j5h8"); }, 60000); @@ -88,8 +88,8 @@ describe('NodeConnection', () => { describe('getTransaction', () => { it('should return a Transaction object', async () => { - const transaction = await connection.getTransaction('at1ps9rynpue84asfhswp305fzytdy3a99w3yrml2zgg84d7p32wuxq4mq9cc'); - expect((transaction as Transaction).type).toBe("execute"); + const transaction = await connection.getTransaction('at1u833jaha7gtqk7vx0yczcg2njds2tj52lyg54c7zyylgfjvc4vpqn8gqqx'); + expect((transaction as Transaction).type).toBe("deploy"); }, 60000); it('should throw an error if the request fails', async () => { @@ -109,17 +109,6 @@ describe('NodeConnection', () => { }, 60000); }); - describe('getTransitionId', () => { - it('should return a transition id', async () => { - const transition = await connection.getTransitionId('5933570015305968530125784572086807293992783852506506765106247734494477879199field') - expect(typeof transition).toBe('string'); - }, 60000); - - it('should throw an error if the request fails', async () => { - await expect(connection.getTransitionId("garbage")).rejects.toThrow("Error fetching transition ID."); - }, 60000); - }); - describe('findUnspentRecords', () => { it('should fail if block heights or private keys are incorrectly specified', async () => { await expect(connection.findUnspentRecords(5, 0, beaconPrivateKeyString, undefined, undefined, [])).rejects.toThrow(); @@ -139,7 +128,7 @@ describe('NodeConnection', () => { describe('getProgramImports', () => { it('should return the correct program import names', async () => { - const importNames = await connection.getProgramImportNames("disperse_multiple_transactions.aleo"); + const importNames = await connection.getProgramImportNames("aleoswap05.aleo"); const expectedNames = ["credits.aleo"]; expect(importNames).toEqual(expectedNames); From 22e92e23c2be0ca1201a98561f59c5b078c781ec Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Sat, 21 Oct 2023 08:03:32 +0200 Subject: [PATCH 2/3] Bump SDK versions to v0.6.3 --- sdk/package.json | 2 +- wasm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/package.json b/sdk/package.json index 9bd30f28e..7fca67820 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@aleohq/sdk", - "version": "0.6.2", + "version": "0.6.3", "description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions", "collaborators": [ "The Aleo Team " diff --git a/wasm/package.json b/wasm/package.json index f6364df96..99870b510 100644 --- a/wasm/package.json +++ b/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@aleohq/wasm", - "version": "0.6.2", + "version": "0.6.3", "description": "Wasm build for the SDK", "collaborators": [ "The Aleo Team " From 3a06c3c41bbf494f784196e6bbeb09e9e3f2b6e2 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Sat, 21 Oct 2023 19:47:21 +0200 Subject: [PATCH 3/3] Add missing await for Deploy checking --- sdk/src/program-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/src/program-manager.ts b/sdk/src/program-manager.ts index fc6760587..4c9d6c678 100644 --- a/sdk/src/program-manager.ts +++ b/sdk/src/program-manager.ts @@ -137,7 +137,7 @@ class ProgramManager { const programObject = Program.fromString(program); let programSource; try { - programSource = this.networkClient.getProgram(programObject.id()); + programSource = await this.networkClient.getProgram(programObject.id()); } catch (e) { // Program does not exist on the network, deployment can proceed console.log(`Program ${programObject.id()} does not exist on the network, deploying...`);