diff options
author | Greg Hysen <hysz@users.noreply.github.com> | 2019-01-15 03:48:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 03:48:17 +0800 |
commit | 1c25d8e997456c248470d925cf6702e46d959a62 (patch) | |
tree | 4e2c77924445247b2916d7713e058ba3466b70a5 /packages/utils/src/abi_encoder/evm_data_types/method.ts | |
parent | fc89b97818eda9c7447273b5728c1ba8fbb5cdf5 (diff) | |
parent | b0817854e81512ad95cca4d842a671304ae3b94a (diff) | |
download | dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.gz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.bz2 dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.lz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.xz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.zst dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.zip |
Merge pull request #1475 from 0xProject/feature/monorepo/useNewAbiEncoder
Use Compressed Calldata in Contract Wrappers
Diffstat (limited to 'packages/utils/src/abi_encoder/evm_data_types/method.ts')
-rw-r--r-- | packages/utils/src/abi_encoder/evm_data_types/method.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts index b1cd1377f..c852a0fdf 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/method.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts @@ -44,7 +44,20 @@ export class MethodDataType extends AbstractSetDataType { return returnValues; } - public getSignature(): string { + public strictDecodeReturnValue<T>(returndata: string, rules?: DecodingRules): T { + const returnValues = this._returnDataType.decode(returndata, rules); + const returnValuesAsArray: any = _.isObject(returnValues) ? _.values(returnValues) : [returnValues]; + switch (returnValuesAsArray.length) { + case 0: + return undefined as any; + case 1: + return returnValuesAsArray[0]; + default: + return returnValuesAsArray; + } + } + + public getSignatureType(): string { return this._methodSignature; } |