aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-12-04 08:53:01 +0800
committerAmir Bandeali <abandeali1@gmail.com>2019-01-08 02:31:11 +0800
commitc6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b (patch)
tree802ea7e8e4861d97b8d5f42c2616912b00685e4e /packages/utils/src
parent492e0ae34546e0020c2c6a694ce60feef5ebf695 (diff)
downloaddexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar.gz
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar.bz2
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar.lz
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar.xz
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.tar.zst
dexon-sol-tools-c6ff77bdd8ea04e04a9be4ae2e5dc30afc89665b.zip
Add prefix to names of properties in EncodingRules and DecodingRules
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/set.ts2
-rw-r--r--packages/utils/src/abi_encoder/calldata/calldata.ts6
-rw-r--r--packages/utils/src/abi_encoder/utils/constants.ts4
-rw-r--r--packages/utils/src/abi_encoder/utils/rules.ts6
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;
}