diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-11-13 09:49:52 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 08:38:10 +0800 |
commit | 52474a0b8edb2f49f850069c1a79dcd9b5d77e9d (patch) | |
tree | 7125220a26e6b0f29256e639a3ac9323df3b58d0 /packages/order-utils/test/abi_encoder_test.ts | |
parent | 2a6b358717e3134aef3ff86cc5343b3b37edee7e (diff) | |
download | dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar.gz dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar.bz2 dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar.lz dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar.xz dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.tar.zst dexon-sol-tools-52474a0b8edb2f49f850069c1a79dcd9b5d77e9d.zip |
decoding with objects as structs works
Diffstat (limited to 'packages/order-utils/test/abi_encoder_test.ts')
-rw-r--r-- | packages/order-utils/test/abi_encoder_test.ts | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/packages/order-utils/test/abi_encoder_test.ts b/packages/order-utils/test/abi_encoder_test.ts index 631255e68..137850b35 100644 --- a/packages/order-utils/test/abi_encoder_test.ts +++ b/packages/order-utils/test/abi_encoder_test.ts @@ -26,7 +26,7 @@ const expect = chai.expect; describe.only('ABI Encoder', () => { describe.only('ABI Tests at Method Level', () => { - it('Crazy ABI', async () => { + it.only('Crazy ABI', async () => { const method = new AbiEncoder.Method(AbiSamples.crazyAbi); console.log(method.getSignature()); @@ -78,7 +78,15 @@ describe.only('ABI Encoder', () => { }; const someArrayOfTuplesWithDynamicTypes = [someTupleWithDynamicTypes2, someTupleWithDynamicTypes3]; - const args = [someStaticArray, someStaticArrayWithDynamicMembers, someDynamicArrayWithDynamicMembers, some2DArray, someTuple, someTupleWithDynamicTypes, someArrayOfTuplesWithDynamicTypes]; + const args = { + someStaticArray: someStaticArray, + someStaticArrayWithDynamicMembers: someStaticArrayWithDynamicMembers, + someDynamicArrayWithDynamicMembers: someDynamicArrayWithDynamicMembers, + some2DArray: some2DArray, + someTuple: someTuple, + someTupleWithDynamicTypes: someTupleWithDynamicTypes, + someArrayOfTuplesWithDynamicTypes: someArrayOfTuplesWithDynamicTypes + }; const calldata = method.encode(args); console.log(calldata); @@ -91,13 +99,14 @@ describe.only('ABI Encoder', () => { expect(calldata).to.be.equal(expectedCalldata); // Test decoding - /*const expectedDecodedValueJson = JSON.stringify(args); - const decodedValue = method.decode(calldata); + const expectedDecodedValueJson = JSON.stringify(args); + const decodedValue = method.decode(calldata, true); const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson);*/ + console.log(`DECODED`, '*'.repeat(200), '\n', decodedValueJson); + expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); }); - it.only('Crazy ABI #1', async () => { + it('Crazy ABI #1', async () => { const method = new AbiEncoder.Method(AbiSamples.crazyAbi1); const args = [ |