diff options
Diffstat (limited to 'packages/utils/src')
4 files changed, 10 insertions, 8 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts index 089d04659..00059a4b6 100644 --- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts +++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts @@ -62,7 +62,7 @@ export abstract class AbstractSetDataType extends DataType { // Create a new scope in the calldata, before descending into the members of this set. calldata.startScope(); let value: any[] | object; - if (rules.structsAsObjects && !this._isArray) { + if (rules.shouldConvertStructsToObjects && !this._isArray) { // Construct an object with values for each member of the set. value = {}; _.each(this._memberIndexByName, (idx: number, key: string) => { diff --git a/packages/utils/src/abi_encoder/calldata/calldata.ts b/packages/utils/src/abi_encoder/calldata/calldata.ts index 5f3eee94a..b08fb71ce 100644 --- a/packages/utils/src/abi_encoder/calldata/calldata.ts +++ b/packages/utils/src/abi_encoder/calldata/calldata.ts @@ -49,7 +49,7 @@ export class Calldata { throw new Error('expected root'); } // Optimize, if flag set - if (this._rules.optimize) { + if (this._rules.shouldOptimize) { this._optimize(); } // Set offsets @@ -60,7 +60,9 @@ export class Calldata { offset += block.getSizeInBytes(); } // Generate hex string - const hexString = this._rules.annotate ? this._toHumanReadableCallData() : this._toEvmCompatibeCallDataHex(); + const hexString = this._rules.shouldAnnotate + ? this._toHumanReadableCallData() + : this._toEvmCompatibeCallDataHex(); return hexString; } /** diff --git a/packages/utils/src/abi_encoder/utils/constants.ts b/packages/utils/src/abi_encoder/utils/constants.ts index 2f43ba04d..36de2dd4f 100644 --- a/packages/utils/src/abi_encoder/utils/constants.ts +++ b/packages/utils/src/abi_encoder/utils/constants.ts @@ -11,7 +11,7 @@ export const constants = { HEX_SELECTOR_BYTE_OFFSET_IN_CALLDATA: 0, // Disable no-object-literal-type-assertion so we can enforce cast /* tslint:disable no-object-literal-type-assertion */ - DEFAULT_DECODING_RULES: { structsAsObjects: false } as DecodingRules, - DEFAULT_ENCODING_RULES: { optimize: true, annotate: false } as EncodingRules, + DEFAULT_DECODING_RULES: { shouldConvertStructsToObjects: false } as DecodingRules, + DEFAULT_ENCODING_RULES: { shouldOptimize: true, shouldAnnotate: false } as EncodingRules, /* tslint:enable no-object-literal-type-assertion */ }; diff --git a/packages/utils/src/abi_encoder/utils/rules.ts b/packages/utils/src/abi_encoder/utils/rules.ts index 31471e97a..c8d83c3ba 100644 --- a/packages/utils/src/abi_encoder/utils/rules.ts +++ b/packages/utils/src/abi_encoder/utils/rules.ts @@ -1,8 +1,8 @@ export interface DecodingRules { - structsAsObjects: boolean; + shouldConvertStructsToObjects: boolean; } export interface EncodingRules { - optimize?: boolean; - annotate?: boolean; + shouldOptimize?: boolean; + shouldAnnotate?: boolean; } |