aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-20 05:07:34 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:10 +0800
commit0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a (patch)
tree4e5a53539c0aaf25368179ffba42d80b5b233cd8 /packages/utils/src
parentb213cb39747ba0b78138d5a1db07b511bd9fd3b8 (diff)
downloaddexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar.gz
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar.bz2
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar.lz
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar.xz
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.tar.zst
dexon-sol-tools-0c0bcb44d3ef6d68c9c7c05be25641ef57a7287a.zip
All 71 tests passing. Both for function encoding and individual types.
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/data_type.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types.ts3
2 files changed, 4 insertions, 3 deletions
diff --git a/packages/utils/src/abi_encoder/data_type.ts b/packages/utils/src/abi_encoder/data_type.ts
index 21c08ef54..243b221ef 100644
--- a/packages/utils/src/abi_encoder/data_type.ts
+++ b/packages/utils/src/abi_encoder/data_type.ts
@@ -40,8 +40,8 @@ export abstract class DataType {
return calldataHex;
}
- public decode(calldata: string, rules?: DecodingRules): any {
- const rawCalldata = new RawCalldata(calldata, true); // @TODO Sohuld not hardcode false here
+ public decode(calldata: string, rules?: DecodingRules, hasSelector: boolean = false): any {
+ const rawCalldata = new RawCalldata(calldata, hasSelector);
const rules_ = rules ? rules : DataType.DEFAULT_DECODING_RULES;
const value = this.generateValue(rawCalldata, rules_);
return value;
diff --git a/packages/utils/src/abi_encoder/evm_data_types.ts b/packages/utils/src/abi_encoder/evm_data_types.ts
index b6a62a5d4..2895ee00f 100644
--- a/packages/utils/src/abi_encoder/evm_data_types.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types.ts
@@ -515,7 +515,8 @@ export class Method extends MemberDataType {
if (!calldata.startsWith(this.selector)) {
throw new Error(`Tried to decode calldata, but it was missing the function selector. Expected '${this.selector}'.`);
}
- const value = super.decode(calldata, rules);
+ const hasSelector = true;
+ const value = super.decode(calldata, rules, hasSelector);
return value;
}