From 39260a792e1137012d4246ce1471c4af4b366145 Mon Sep 17 00:00:00 2001 From: Raul Duarte Pereira Date: Sat, 28 Oct 2023 00:00:58 -0300 Subject: [PATCH 1/2] Missing FAULT check on calculateFee (neon-dappkit) --- packages/neon-dappkit/src/NeonInvoker.spec.ts | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/neon-dappkit/src/NeonInvoker.spec.ts b/packages/neon-dappkit/src/NeonInvoker.spec.ts index f959488..ab46fe9 100644 --- a/packages/neon-dappkit/src/NeonInvoker.spec.ts +++ b/packages/neon-dappkit/src/NeonInvoker.spec.ts @@ -29,7 +29,7 @@ function toDecimal(num: number, decimal: number) { describe('NeonInvoker', function () { this.timeout(60000) - it('does invokeFuncion', async () => { + it('does invokeFunction', async () => { const account = new wallet.Account('3bd06d95e9189385851aa581d182f25de34af759cf7f883af57030303ded52b8') const invoker = await NeonInvoker.init({ rpcAddress: NeonInvoker.TESTNET, @@ -345,6 +345,33 @@ describe('NeonInvoker', function () { } }) + it('can throw an error if testInvoke state is FAULT', async () => { + const invoker = await NeonInvoker.init({ + rpcAddress: NeonInvoker.TESTNET, + }) + + await assert.rejects( + invoker.testInvoke({ + invocations: [ + { + scriptHash: '0xd2a4cff31913016155e38e474a2c06d08be276cf', + operation: 'transfer', + args: [ + { type: 'Hash160', value: 'NbnjKGMBJzJ6j5PHeYhjJDaQ5Vy5UYu4Fv' }, + { type: 'Integer', value: '100000000' }, + { type: 'Array', value: [] }, + ], + }, + ], + }), + { + name: 'Error', + message: + 'Execution state is FAULT. Exception: Method "transfer" with 3 parameter(s) doesn\'t exist in the contract 0xd2a4cff31913016155e38e474a2c06d08be276cf.', + }, + ) + }) + it('handles integer return', async () => { const invoker = await NeonInvoker.init({ rpcAddress: NeonInvoker.TESTNET, From e7c18497fcbb39a17330523f361dfce3e526fdb9 Mon Sep 17 00:00:00 2001 From: melanke Date: Mon, 30 Oct 2023 08:47:35 -0300 Subject: [PATCH 2/2] rush change --- .../neon-dappkit/CU-86a0q6pde-2_2023-10-30-11-44.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@cityofzion/neon-dappkit/CU-86a0q6pde-2_2023-10-30-11-44.json diff --git a/common/changes/@cityofzion/neon-dappkit/CU-86a0q6pde-2_2023-10-30-11-44.json b/common/changes/@cityofzion/neon-dappkit/CU-86a0q6pde-2_2023-10-30-11-44.json new file mode 100644 index 0000000..9e6a565 --- /dev/null +++ b/common/changes/@cityofzion/neon-dappkit/CU-86a0q6pde-2_2023-10-30-11-44.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@cityofzion/neon-dappkit", + "comment": "", + "type": "none" + } + ], + "packageName": "@cityofzion/neon-dappkit" +} \ No newline at end of file