aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/test
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-20 06:30:23 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commit7991de9ed0b5f1e8a38097d902eae09cc6b5cf11 (patch)
tree3aaaa01876f4639d0165f75b65c2e55f4e7b4368 /packages/utils/test
parente9a82905e35041d36c4c9be75e11c0399ee96b89 (diff)
downloaddexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar.gz
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar.bz2
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar.lz
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar.xz
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.tar.zst
dexon-sol-tools-7991de9ed0b5f1e8a38097d902eae09cc6b5cf11.zip
Generalized `create` for signature / dataItems. Cleaner.
Diffstat (limited to 'packages/utils/test')
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts264
1 files changed, 132 insertions, 132 deletions
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
index 4faa5a21f..919b71c55 100644
--- a/packages/utils/test/abi_encoder/evm_data_types_test.ts
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -27,9 +27,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic size; Static elements', async () => {
// Create DataType object
@@ -46,9 +46,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Fixed size; Dynamic elements', async () => {
// Create DataType object
@@ -65,9 +65,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic size; Dynamic elements', async () => {
// Create DataType object
@@ -84,9 +84,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic Size; Multidimensional; Dynamic Elements', async () => {
// Create DataType object
@@ -106,9 +106,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic Size; Multidimensional; Static Elements', async () => {
// Create DataType object
@@ -128,9 +128,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Static Size; Multidimensional; Static Elements', async () => {
// Create DataType object
@@ -149,9 +149,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Static Size; Multidimensional; Dynamic Elements', async () => {
// Create DataType object
@@ -170,9 +170,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Static size; Too Few Elements', async () => {
// Create DataType object
@@ -230,9 +230,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args, encodingRules);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args, encodingRules);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic elements only', async () => {
// Create DataType object
@@ -254,9 +254,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Static Array', async () => {
// Create DataType object
@@ -278,9 +278,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Dynamic Array', async () => {
// Create DataType object
@@ -302,9 +302,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Static Multidimensional Array', async () => {
// Create DataType object
@@ -328,9 +328,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Dynamic Multidimensional Array', async () => {
// Create DataType object
@@ -354,9 +354,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Static and dynamic elements mixed', async () => {
// Create DataType object
@@ -388,9 +388,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Missing Key', async () => {
// Create DataType object
@@ -439,9 +439,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Invalid Address - input is not valid hex', async () => {
// Create DataType object
@@ -482,9 +482,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('False', async () => {
// Create DataType object
@@ -500,9 +500,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
});
@@ -528,9 +528,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Negative Base Case', async () => {
// Create DataType object
@@ -546,9 +546,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Positive Value', async () => {
// Create DataType object
@@ -564,9 +564,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Negative Value', async () => {
// Create DataType object
@@ -582,9 +582,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Value too large', async () => {
// Create DataType object
@@ -622,9 +622,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Negative Base Case', async () => {
// Create DataType object
@@ -640,9 +640,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Positive Value', async () => {
// Create DataType object
@@ -658,9 +658,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Negative Value', async () => {
// Create DataType object
@@ -676,9 +676,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Value too large', async () => {
// Create DataType object
@@ -726,9 +726,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Positive Value', async () => {
// Create DataType object
@@ -744,9 +744,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Zero Value', async () => {
// Create DataType object
@@ -762,9 +762,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Value too large', async () => {
// Create DataType object
@@ -802,9 +802,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Positive Value', async () => {
// Create DataType object
@@ -820,9 +820,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Zero Value', async () => {
// Create DataType object
@@ -838,9 +838,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Value too large', async () => {
// Create DataType object
@@ -881,9 +881,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Single Byte (bytes1)', async () => {
// Create DataType object
@@ -899,9 +899,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('4 Bytes (bytes4)', async () => {
// Create DataType object
@@ -917,9 +917,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('4 Bytes (bytes4); Encoder must pad input', async () => {
// Create DataType object
@@ -937,9 +937,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const paddedArgs = '0x1a180000';
expect(decodedArgs).to.be.deep.equal(paddedArgs);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('32 Bytes (bytes32)', async () => {
// Create DataType object
@@ -955,9 +955,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('32 Bytes (bytes32); Encoder must pad input', async () => {
// Create DataType object
@@ -975,9 +975,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const paddedArgs = '0x1a18bf6100000000000000000000000000000000000000000000000000000000';
expect(decodedArgs).to.be.deep.equal(paddedArgs);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Should throw when pass in too many bytes (bytes4)', async () => {
// Create DataType object
@@ -1046,9 +1046,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Spans multiple EVM words', async () => {
// Create DataType object
@@ -1067,9 +1067,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Input as Buffer', async () => {
// Create DataType object
@@ -1088,9 +1088,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Should throw when pass in bad hex (no 0x prefix)', async () => {
// Create DataType object
@@ -1133,9 +1133,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('Spans multiple EVM words', async () => {
// Create DataType object
@@ -1154,9 +1154,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
it('String that begins with 0x prefix', async () => {
// Create DataType object
@@ -1175,9 +1175,9 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
// Validate signature
- const dataTypeFromSignature = AbiEncoder.fromSignature(dataType.getSignature(true));
- const encodedArgsFromSignature = dataTypeFromSignature.encode(args);
- expect(encodedArgsFromSignature).to.be.deep.equal(expectedEncodedArgs);
+ const dataTypecreate = AbiEncoder.create(dataType.getSignature(true));
+ const encodedArgscreate = dataTypecreate.encode(args);
+ expect(encodedArgscreate).to.be.deep.equal(expectedEncodedArgs);
});
});
});