aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_encoder/evm_data_types/method.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2019-01-15 22:10:50 +0800
committerFabio Berger <me@fabioberger.com>2019-01-15 22:10:50 +0800
commitae147e615af9da32ca3da0b92ef77815061ad5be (patch)
treed7bae435a99c668d02cc9ee9d84619c3056509f6 /packages/utils/src/abi_encoder/evm_data_types/method.ts
parent98579300c1f78d8c360fa960cc73ffacb1012e91 (diff)
parent18084588ea9fa724d6e32c9a49c79d49f189ba7c (diff)
downloaddexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar.gz
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar.bz2
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar.lz
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar.xz
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.tar.zst
dexon-sol-tools-ae147e615af9da32ca3da0b92ef77815061ad5be.zip
Merge branch 'development' into fix/dev-tools-pages/finalTouches
* development: (87 commits) Update packages/sol-tracing-utils/src/trace_collection_subprovider.ts Make mapping namings direct Remove unused tslint disable Revert "Remove logAsyncErrors hack" Remove logAsyncErrors hack Refactor logAsyncErrors to follow our conventions Export Sources and SourceCodes out of tracing utils Replace console.log with logUtils.log (#1515) strict decoding of return values using generics makerAssetFillAmount -> takerAssetFillAmount Ran prettier Linter Fix build after rebase Style cleanup for Compressed Calldata in Contract Wrappers PR Use simpler `_.find` to locate fillOrderBai Updated dutch auction wrapper Added back abi-gen-wrappers Renamed signatureParser.ts to signature_parser.ts Renamed decode rule `structsAsObjects` to `shouldConvertStructsToObjects` circle build failed. New commit to resubmit job. ...
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.ts15
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;
}