diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-12-11 08:10:49 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-12-11 08:10:49 +0800 |
commit | e72742f1f76dd3b46976ed3d0f272b539bdfb229 (patch) | |
tree | 968debeda7e6efcabd58c7218d5dff05dc24f357 /packages/utils | |
parent | 928b253c81971eb6f59efd09ab6a9063d4e6e4ca (diff) | |
parent | 253bf4df6a6909d8bd65361c0d115e9d1a8e489e (diff) | |
download | dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.gz dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.bz2 dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.lz dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.xz dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.zst dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.zip |
Merge branch 'development' into feature/contracts-monorepo-7
Diffstat (limited to 'packages/utils')
-rw-r--r-- | packages/utils/CHANGELOG.md | 4 | ||||
-rw-r--r-- | packages/utils/src/abi_utils.ts | 4 | ||||
-rw-r--r-- | packages/utils/test/abi_encoder/evm_data_types_test.ts | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index c5c42161a..e712ebea8 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.7 - _November 28, 2018_ + + * Optimized ABI Encoder/Decoder. Generates compressed calldata to save gas. Generates human-readable calldata to aid development. + ## v2.0.6 - _November 21, 2018_ * Dependencies updated diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts index 598ea5fcc..3e6fc9665 100644 --- a/packages/utils/src/abi_utils.ts +++ b/packages/utils/src/abi_utils.ts @@ -26,7 +26,7 @@ function parseEthersParams(params: DataItem[]): { names: ParamName[]; types: str const result = parseEthersParams(param.components); names.push({ name: param.name || null, names: result.names }); - types.push('tuple(' + result.types.join(',') + ')' + suffix); + types.push(`tuple(${result.types.join(',')})${suffix}`); } else { names.push(param.name || null); types.push(param.type); @@ -120,7 +120,7 @@ function splitTupleTypes(type: string): string[] { if (_.endsWith(type, '[]')) { throw new Error('Internal error: array types are not supported'); } else if (!_.startsWith(type, 'tuple(')) { - throw new Error('Internal error: expected tuple type but got non-tuple type: ' + type); + throw new Error(`Internal error: expected tuple type but got non-tuple type: ${type}`); } // Trim the outtermost tuple(). const trimmedType = type.substring('tuple('.length, type.length - 1); 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 9ef80a560..7185851a8 100644 --- a/packages/utils/test/abi_encoder/evm_data_types_test.ts +++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts @@ -901,7 +901,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Construct args to be encoded // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes. const bytesLength = 40; - const args = '0x' + '61'.repeat(bytesLength); + const args = `0x${'61'.repeat(bytesLength)}`; // Encode Args and validate result const encodedArgs = dataType.encode(args, encodingRules); const expectedEncodedArgs = @@ -993,7 +993,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Construct args to be encoded // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes. const strLength = 40; - const args = '0x' + 'a'.repeat(strLength); + const args = `0x${'a'.repeat(strLength)}`; // Encode Args and validate result const encodedArgs = dataType.encode(args, encodingRules); const expectedEncodedArgs = |