aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-26 13:40:37 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commitad1b5af4e59ba750c019cab1f5ec9584b8645101 (patch)
tree8d06b6ed215586320ede31867738d5bbdce60fc8 /packages/utils/src
parentfeb551a02efe144b0aca4696f01dcdd42383fb36 (diff)
downloaddexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar.gz
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar.bz2
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar.lz
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar.xz
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.tar.zst
dexon-sol-tools-ad1b5af4e59ba750c019cab1f5ec9584b8645101.zip
Ran prettier
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/array.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts7
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts7
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts7
-rw-r--r--packages/utils/src/abi_encoder/utils/math.ts12
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;