diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-08 18:58:33 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-11 19:21:44 +0800 |
commit | f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a (patch) | |
tree | 4816997b033912fd517a77dc2149bf0efac395a3 /packages/assert/src/index.ts | |
parent | a6f97181310c9acba176b2a28ffba1ca7d53727d (diff) | |
download | dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar.gz dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar.bz2 dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar.lz dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar.xz dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.tar.zst dexon-sol-tools-f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a.zip |
Remove ethereum-address dependency and add this logic to the repo
Diffstat (limited to 'packages/assert/src/index.ts')
-rw-r--r-- | packages/assert/src/index.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 92bcf6f03..94900074a 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -3,10 +3,11 @@ import { SchemaValidator, } from '@0xproject/json-schemas'; import BigNumber from 'bignumber.js'; -import * as ethereum_address from 'ethereum-address'; import * as _ from 'lodash'; import * as validUrl from 'valid-url'; +import {addressUtils} from './address_utils'; + const HEX_REGEX = /^0x[0-9A-F]*$/i; export const assert = { @@ -35,9 +36,9 @@ export const assert = { this.typeAssertionMessage(variableName, 'HexString', value)); }, isETHAddressHex(variableName: string, value: string): void { - this.assert(ethereum_address.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); + this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); this.assert( - ethereum_address.isAddress(value) && value.toLowerCase() === value, + addressUtils.isAddress(value) && value.toLowerCase() === value, `Checksummed addresses are not supported. Convert ${variableName} to lower case before passing`, ); }, |