diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 05:52:32 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 08:38:11 +0800 |
commit | 04503200e5eafda6617039b113ef26cf48184f62 (patch) | |
tree | 6e853cdd3c563908cf31a88214c499a1a0673842 /packages | |
parent | 2da7cadefa877ff824da8fbaecd59dbff5028728 (diff) | |
download | dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar.gz dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar.bz2 dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar.lz dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar.xz dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.tar.zst dexon-0x-contracts-04503200e5eafda6617039b113ef26cf48184f62.zip |
Linter / Prettier
Diffstat (limited to 'packages')
3 files changed, 13 insertions, 13 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 bbe29eff0..089d04659 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 @@ -107,11 +107,7 @@ export abstract class AbstractSetDataType extends DataType { } // Create a new calldata block for this set. const parentName = _.isUndefined(parentBlock) ? '' : parentBlock.getName(); - const block = new SetCalldataBlock( - this.getDataItem().name, - this.getSignature(), - parentName, - ); + const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName); // If this set has an undefined length then set its header to be the number of elements. let members = this._members; if (this._isArray && _.isUndefined(this._arrayLength)) { @@ -135,11 +131,7 @@ export abstract class AbstractSetDataType extends DataType { protected _generateCalldataBlockFromObject(obj: object, parentBlock?: CalldataBlock): SetCalldataBlock { // Create a new calldata block for this set. const parentName = _.isUndefined(parentBlock) ? '' : parentBlock.getName(); - const block = new SetCalldataBlock( - this.getDataItem().name, - this.getSignature(), - parentName, - ); + const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName); // Create blocks for members of set. const memberCalldataBlocks: CalldataBlock[] = []; const childMap = _.cloneDeep(this._memberIndexByName); @@ -178,7 +170,11 @@ export abstract class AbstractSetDataType extends DataType { private _createMembersWithKeys(dataItem: DataItem): [DataType[], MemberIndexByName] { // Sanity check if (_.isUndefined(dataItem.components)) { - throw new Error(`Tried to create a set using key/value pairs, but no components were defined by the input DataItem '${dataItem.name}'.`); + throw new Error( + `Tried to create a set using key/value pairs, but no components were defined by the input DataItem '${ + dataItem.name + }'.`, + ); } // Create one member for each component of `dataItem` const members: DataType[] = []; diff --git a/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts b/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts index c706fe908..72d6a3173 100644 --- a/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts +++ b/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts @@ -24,8 +24,9 @@ export class PointerCalldataBlock extends CalldataBlock { } public toBuffer(): Buffer { - const destinationOffset = - !_.isUndefined(this._aliasFor) ? this._aliasFor.getOffsetInBytes() : this._dependency.getOffsetInBytes(); + const destinationOffset = !_.isUndefined(this._aliasFor) + ? this._aliasFor.getOffsetInBytes() + : this._dependency.getOffsetInBytes(); const parentOffset = this._parent.getOffsetInBytes(); const parentHeaderSize = this._parent.getHeaderSizeInBytes(); const pointer: number = destinationOffset - (parentOffset + parentHeaderSize); diff --git a/packages/utils/src/abi_encoder/utils/constants.ts b/packages/utils/src/abi_encoder/utils/constants.ts index acc06329c..2f43ba04d 100644 --- a/packages/utils/src/abi_encoder/utils/constants.ts +++ b/packages/utils/src/abi_encoder/utils/constants.ts @@ -9,6 +9,9 @@ export const constants = { HEX_SELECTOR_LENGTH_IN_CHARS: 10, HEX_SELECTOR_LENGTH_IN_BYTES: 4, 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, + /* tslint:enable no-object-literal-type-assertion */ }; |