diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-12-12 22:30:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 22:30:04 +0800 |
commit | cb7188d47390719b74d7e09c938068a9f201c1b0 (patch) | |
tree | 1b67b0b849550bea8b5ad20fe4d7a383ec49163d /packages/assert | |
parent | 02f22d91555ea05fc52d342e9c91cd9477321da1 (diff) | |
parent | d778378b37b0cbd77ecdf8d1cafc7720682064ec (diff) | |
download | dexon-0x-contracts-cb7188d47390719b74d7e09c938068a9f201c1b0.tar.gz dexon-0x-contracts-cb7188d47390719b74d7e09c938068a9f201c1b0.tar.zst dexon-0x-contracts-cb7188d47390719b74d7e09c938068a9f201c1b0.zip |
Merge pull request #257 from 0xProject/fix/ethereum-address
Remove ethereum-address dependency and add this logic to the repo
Diffstat (limited to 'packages/assert')
-rw-r--r-- | packages/assert/package.json | 2 | ||||
-rw-r--r-- | packages/assert/src/globals.d.ts | 4 | ||||
-rw-r--r-- | packages/assert/src/index.ts | 6 |
3 files changed, 4 insertions, 8 deletions
diff --git a/packages/assert/package.json b/packages/assert/package.json index 65b163c21..2fb7746a8 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -38,8 +38,8 @@ }, "dependencies": { "@0xproject/json-schemas": "^0.6.10", + "@0xproject/utils": "^0.1.0", "bignumber.js": "~4.1.0", - "ethereum-address": "^0.0.4", "lodash": "^4.17.4", "valid-url": "^1.0.9" } diff --git a/packages/assert/src/globals.d.ts b/packages/assert/src/globals.d.ts index cc47f3113..91ed2021e 100644 --- a/packages/assert/src/globals.d.ts +++ b/packages/assert/src/globals.d.ts @@ -1,5 +1 @@ declare module 'dirty-chai'; - -declare module 'ethereum-address' { - const isAddress: (arg: any) => boolean; -} diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 92bcf6f03..fadc31d09 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -2,8 +2,8 @@ import { Schema, SchemaValidator, } from '@0xproject/json-schemas'; +import {addressUtils} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; -import * as ethereum_address from 'ethereum-address'; import * as _ from 'lodash'; import * as validUrl from 'valid-url'; @@ -35,9 +35,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`, ); }, |