diff options
5 files changed, 23 insertions, 12 deletions
diff --git a/packages/utils/src/abi_encoder/evm_data_types/array.ts b/packages/utils/src/abi_encoder/evm_data_types/array.ts index 54f7ba9fa..8cf2cf7cf 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/array.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/array.ts @@ -12,7 +12,7 @@ export class Array extends AbstractDataTypes.Set { return Array._MATCHER.test(type); } - private static _decodeElementTypeAndLengthFromType(type: string): [string, undefined|number] { + private static _decodeElementTypeAndLengthFromType(type: string): [string, undefined | number] { const matches = Array._MATCHER.exec(type); if (matches === null || matches.length !== 3) { throw new Error(`Could not parse array: ${type}`); diff --git a/packages/utils/src/abi_encoder/evm_data_types/int.ts b/packages/utils/src/abi_encoder/evm_data_types/int.ts index 8a82ed4cc..032cd045a 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/int.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts @@ -24,9 +24,10 @@ export class Int extends AbstractDataTypes.Blob { private static _decodeWidthFromType(type: string): number { const matches = Int._MATCHER.exec(type); - const width = (matches !== null && matches.length === 2 && matches[1] !== undefined) - ? parseInt(matches[1], Constants.DEC_BASE) - : Int._DEFAULT_WIDTH; + const width = + matches !== null && matches.length === 2 && matches[1] !== undefined + ? parseInt(matches[1], Constants.DEC_BASE) + : Int._DEFAULT_WIDTH; return width; } diff --git a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts index d0b41194e..2c649cb33 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts @@ -20,9 +20,10 @@ export class StaticBytes extends AbstractDataTypes.Blob { private static _decodeWidthFromType(type: string): number { const matches = StaticBytes._MATCHER.exec(type); - const width = (matches !== null && matches.length === 3 && matches[2] !== undefined) - ? parseInt(matches[2], Constants.DEC_BASE) - : StaticBytes._DEFAULT_WIDTH; + const width = + matches !== null && matches.length === 3 && matches[2] !== undefined + ? parseInt(matches[2], Constants.DEC_BASE) + : StaticBytes._DEFAULT_WIDTH; return width; } diff --git a/packages/utils/src/abi_encoder/evm_data_types/uint.ts b/packages/utils/src/abi_encoder/evm_data_types/uint.ts index b1bc690d8..b5b7683a2 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts @@ -24,9 +24,10 @@ export class UInt extends AbstractDataTypes.Blob { private static _decodeWidthFromType(type: string): number { const matches = UInt._MATCHER.exec(type); - const width = (matches !== null && matches.length === 2 && matches[1] !== undefined) - ? parseInt(matches[1], Constants.DEC_BASE) - : UInt._DEFAULT_WIDTH; + const width = + matches !== null && matches.length === 2 && matches[1] !== undefined + ? parseInt(matches[1], Constants.DEC_BASE) + : UInt._DEFAULT_WIDTH; return width; } diff --git a/packages/utils/src/abi_encoder/utils/math.ts b/packages/utils/src/abi_encoder/utils/math.ts index 8d21ada0a..c5fa10e73 100644 --- a/packages/utils/src/abi_encoder/utils/math.ts +++ b/packages/utils/src/abi_encoder/utils/math.ts @@ -4,7 +4,11 @@ import * as _ from 'lodash'; import * as Constants from '../utils/constants'; -function sanityCheckBigNumberRange(value_: BigNumber | string | number, minValue: BigNumber, maxValue: BigNumber): void { +function sanityCheckBigNumberRange( + value_: BigNumber | string | number, + minValue: BigNumber, + maxValue: BigNumber, +): void { const value = new BigNumber(value_, 10); if (value.greaterThan(maxValue)) { throw new Error(`Tried to assign value of ${value}, which exceeds max value of ${maxValue}`); @@ -51,7 +55,11 @@ export function encodeNumericValue(value_: BigNumber | string | number): Buffer * @param value_ The value to encode. * @return ABI Encoded value */ -export function safeEncodeNumericValue(value: BigNumber | string | number, minValue: BigNumber, maxValue: BigNumber): Buffer { +export function safeEncodeNumericValue( + value: BigNumber | string | number, + minValue: BigNumber, + maxValue: BigNumber, +): Buffer { sanityCheckBigNumberRange(value, minValue, maxValue); const encodedValue = encodeNumericValue(value); return encodedValue; |