diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-11 19:43:19 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-11 19:43:19 +0800 |
commit | a14424ae5f45784db5e75c2d6a9098dc96914c9e (patch) | |
tree | e0cc054713cc7fff81269c4065883629f117a590 | |
parent | f1e7ea118b0c8c9a9a013b09d0e63bdd3694b21a (diff) | |
download | dexon-0x-contracts-a14424ae5f45784db5e75c2d6a9098dc96914c9e.tar.gz dexon-0x-contracts-a14424ae5f45784db5e75c2d6a9098dc96914c9e.tar.zst dexon-0x-contracts-a14424ae5f45784db5e75c2d6a9098dc96914c9e.zip |
Move isAddress to shared utils and remove all dependencies on ethereum-address
-rw-r--r-- | packages/assert/package.json | 3 | ||||
-rw-r--r-- | packages/assert/src/globals.d.ts | 4 | ||||
-rw-r--r-- | packages/assert/src/index.ts | 3 | ||||
-rw-r--r-- | packages/subproviders/package.json | 1 | ||||
-rw-r--r-- | packages/subproviders/src/globals.d.ts | 5 | ||||
-rw-r--r-- | packages/subproviders/src/subproviders/ledger.ts | 4 | ||||
-rw-r--r-- | packages/utils/src/address_utils.ts (renamed from packages/assert/src/address_utils.ts) | 0 | ||||
-rw-r--r-- | packages/utils/src/index.ts | 1 | ||||
-rw-r--r-- | packages/website/package.json | 1 | ||||
-rw-r--r-- | packages/website/ts/components/inputs/address_input.tsx | 2 | ||||
-rw-r--r-- | packages/website/ts/globals.d.ts | 5 | ||||
-rw-r--r-- | yarn.lock | 16 |
12 files changed, 19 insertions, 26 deletions
diff --git a/packages/assert/package.json b/packages/assert/package.json index 800207ae6..d69241f60 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -22,6 +22,9 @@ "url": "https://github.com/0xProject/0x.js/issues" }, "homepage": "https://github.com/0xProject/0x.js/packages/assert/README.md", + "dependencies": { + "@0xProject/utils": "^0.0.1" + }, "devDependencies": { "@0xproject/tslint-config": "^0.2.1", "@types/lodash": "^4.14.86", 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 94900074a..fadc31d09 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -2,12 +2,11 @@ import { Schema, SchemaValidator, } from '@0xproject/json-schemas'; +import {addressUtils} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; 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 = { diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index b724e5dae..5256f336e 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -20,7 +20,6 @@ "@0xproject/assert": "^0.0.7", "bn.js": "^4.11.8", "es6-promisify": "^5.0.0", - "ethereum-address": "^0.0.4", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", "ledgerco": "0xProject/ledger-node-js-api", diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts index 520ca9232..400bbef5b 100644 --- a/packages/subproviders/src/globals.d.ts +++ b/packages/subproviders/src/globals.d.ts @@ -54,11 +54,6 @@ declare module 'ledgerco' { } } -// ethereum-address declarations -declare module 'ethereum-address' { - export const isAddress: (address: string) => boolean; -} - // Semaphore-async-await declarations declare module 'semaphore-async-await' { class Semaphore { diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts index e0a08f792..578f6ff6f 100644 --- a/packages/subproviders/src/subproviders/ledger.ts +++ b/packages/subproviders/src/subproviders/ledger.ts @@ -1,6 +1,6 @@ import {assert} from '@0xproject/assert'; +import {addressUtils} from '@0xproject/utils'; import promisify = require('es6-promisify'); -import {isAddress} from 'ethereum-address'; import EthereumTx = require('ethereumjs-tx'); import ethUtil = require('ethereumjs-util'); import * as ledger from 'ledgerco'; @@ -47,7 +47,7 @@ export class LedgerSubprovider extends Subprovider { return isValid; } private static validateSender(sender: string) { - if (_.isUndefined(sender) || !isAddress(sender)) { + if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) { throw new Error(LedgerSubproviderErrors.SenderInvalidOrNotSupplied); } } diff --git a/packages/assert/src/address_utils.ts b/packages/utils/src/address_utils.ts index bdbcd3a89..bdbcd3a89 100644 --- a/packages/assert/src/address_utils.ts +++ b/packages/utils/src/address_utils.ts diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index a61f04ad2..edfd192b2 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1 +1,2 @@ export {promisify} from './promisify'; +export {addressUtils} from './address_utils'; diff --git a/packages/website/package.json b/packages/website/package.json index 95e060552..9b261c76c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -28,7 +28,6 @@ "dateformat": "^2.0.0", "deep-equal": "^1.0.1", "dharma-loan-frame": "^0.0.12", - "ethereum-address": "^0.0.4", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", "find-versions": "^2.0.0", diff --git a/packages/website/ts/components/inputs/address_input.tsx b/packages/website/ts/components/inputs/address_input.tsx index 8b03b8d12..832324fda 100644 --- a/packages/website/ts/components/inputs/address_input.tsx +++ b/packages/website/ts/components/inputs/address_input.tsx @@ -1,4 +1,4 @@ -import {isAddress} from 'ethereum-address'; +import {addressUtils} from '@0xproject/utils'; import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; import TextField from 'material-ui/TextField'; diff --git a/packages/website/ts/globals.d.ts b/packages/website/ts/globals.d.ts index b4611f583..3144d7eb5 100644 --- a/packages/website/ts/globals.d.ts +++ b/packages/website/ts/globals.d.ts @@ -55,11 +55,6 @@ interface System { } declare var System: System; -// ethereum-address declarations -declare module 'ethereum-address' { - export const isAddress: (address: string) => boolean; -} - // jsonschema declarations // Source: https://github.com/tdegrunt/jsonschema/blob/master/lib/index.d.ts declare interface Schema { @@ -47,6 +47,16 @@ uuid "^3.1.0" web3 "^0.20.0" +"@0xproject/assert@^0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@0xproject/assert/-/assert-0.0.6.tgz#773616620314f40ace11a9c4c65cc95398d2c178" + dependencies: + "@0xproject/json-schemas" "^0.6.9" + bignumber.js "~4.1.0" + ethereum-address "^0.0.4" + lodash "^4.17.4" + valid-url "^1.0.9" + "@types/accounting@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@types/accounting/-/accounting-0.4.1.tgz#865d9f5694fd7c438fba34eb4bc82eec6f34cdd5" @@ -1281,10 +1291,6 @@ bignumber.js@^4.0.2, bignumber.js@^4.1.0, bignumber.js@~4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.1.0.tgz#db6f14067c140bd46624815a7916c92d9b6c24b1" -bignumber.js@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-5.0.0.tgz#fbce63f09776b3000a83185badcde525daf34833" - "bignumber.js@git+https://github.com/debris/bignumber.js#master": version "2.0.7" resolved "git+https://github.com/debris/bignumber.js#c7a38de919ed75e6fb6ba38051986e294b328df9" @@ -5633,7 +5639,7 @@ normalize-url@^1.4.0: query-string "^4.1.0" sort-keys "^1.0.0" -npm-run-all@^4.1.1, npm-run-all@^4.1.2: +npm-run-all@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.2.tgz#90d62d078792d20669139e718621186656cea056" dependencies: |