diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-01-10 18:18:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-10 18:18:51 +0800 |
commit | a39d3d723399e124ae617dfda67e754907312a98 (patch) | |
tree | 2084e27bad0dede62d99165453f9ec092ea8d1be | |
parent | 40c7ee63557b1795340c315eb9fab1dcfe092bed (diff) | |
parent | 326a6b729fe6cf96f0b4787d84903282738b6863 (diff) | |
download | dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.gz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.bz2 dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.lz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.xz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.zst dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.zip |
Merge pull request #305 from 0xProject/fix/bignumber_config
Use configured version of bignumber in all packages
109 files changed, 114 insertions, 148 deletions
diff --git a/packages/0x.js/contract_templates/contract.mustache b/packages/0x.js/contract_templates/contract.mustache index 693fbe4ee..3e501cce6 100644 --- a/packages/0x.js/contract_templates/contract.mustache +++ b/packages/0x.js/contract_templates/contract.mustache @@ -3,9 +3,8 @@ * Templates can be found at https://github.com/0xProject/0x.js/tree/development/packages/abi-gen-templates. */ // tslint:disable-next-line:no-unused-variable -import {TxData, TxDataPayable} from '@0xproject/types'; -import {classUtils, promisify} from '@0xproject/utils'; -import {BigNumber} from 'bignumber.js'; +import { TxData, TxDataPayable } from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; import * as Web3 from 'web3'; import {BaseContract} from './base_contract'; diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 2ece94614..e953ca8c0 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -88,7 +88,6 @@ "@0xproject/json-schemas": "^0.7.1", "@0xproject/utils": "^0.1.2", "@0xproject/web3-wrapper": "^0.1.2", - "bignumber.js": "~4.1.0", "bintrees": "^1.0.2", "bn.js": "^4.11.8", "compare-versions": "^3.0.1", diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 33efe8ba8..67b75df95 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -1,7 +1,6 @@ import { schemas, SchemaValidator } from '@0xproject/json-schemas'; -import { bigNumberConfigs, intervalUtils } from '@0xproject/utils'; +import { BigNumber, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; @@ -29,9 +28,6 @@ import { decorators } from './utils/decorators'; import { signatureUtils } from './utils/signature_utils'; import { utils } from './utils/utils'; -// Customize our BigNumber instances -bigNumberConfigs.configure(); - /** * The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality * and all calls to the library should be made through a ZeroEx instance. diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index 09719b2d8..b03571636 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index a111128ba..e1d80e01a 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts index bfa7da5b4..7943f4a60 100644 --- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; diff --git a/packages/0x.js/src/globalsAugment.d.ts b/packages/0x.js/src/globalsAugment.d.ts index e018fdc54..3e2f2216b 100644 --- a/packages/0x.js/src/globalsAugment.d.ts +++ b/packages/0x.js/src/globalsAugment.d.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; // HACK: This module overrides the Chai namespace so that we can use BigNumber types inside. // Source: https://github.com/Microsoft/TypeScript/issues/7352#issuecomment-191547232 diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts index 47e03dd38..e7d085fc8 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts @@ -1,5 +1,4 @@ -import { intervalUtils } from '@0xproject/utils'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber, intervalUtils } from '@0xproject/utils'; import { RBTree } from 'bintrees'; import * as _ from 'lodash'; diff --git a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts index 2200be0cb..20b09d606 100644 --- a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts +++ b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import { SignedOrder } from '../types'; diff --git a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts index 675c1afc0..33feea105 100644 --- a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts index bb0619738..e22364c09 100644 --- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts +++ b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 9c06ae653..44f8aa223 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -1,5 +1,5 @@ import { TransactionReceipt } from '@0xproject/types'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as Web3 from 'web3'; export enum ZeroExError { diff --git a/packages/0x.js/src/utils/abi_decoder.ts b/packages/0x.js/src/utils/abi_decoder.ts index 2d4e92558..bbd2a0b1d 100644 --- a/packages/0x.js/src/utils/abi_decoder.ts +++ b/packages/0x.js/src/utils/abi_decoder.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as Web3 from 'web3'; import * as SolidityCoder from 'web3/lib/solidity/coder'; diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts index b391a3347..c21f2dbca 100644 --- a/packages/0x.js/src/utils/assert.ts +++ b/packages/0x.js/src/utils/assert.ts @@ -2,9 +2,9 @@ import { assert as sharedAssert } from '@0xproject/assert'; // We need those two unused imports because they're actually used by sharedAssert which gets injected here // tslint:disable-next-line:no-unused-variable import { Schema } from '@0xproject/json-schemas'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; // tslint:disable-next-line:no-unused-variable -import * as BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { ECSignature } from '../types'; diff --git a/packages/0x.js/src/utils/constants.ts b/packages/0x.js/src/utils/constants.ts index 6001e1c7f..06beec8e2 100644 --- a/packages/0x.js/src/utils/constants.ts +++ b/packages/0x.js/src/utils/constants.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', diff --git a/packages/0x.js/src/utils/exchange_transfer_simulator.ts b/packages/0x.js/src/utils/exchange_transfer_simulator.ts index 575a2d3d2..662cd210c 100644 --- a/packages/0x.js/src/utils/exchange_transfer_simulator.ts +++ b/packages/0x.js/src/utils/exchange_transfer_simulator.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index 5674528d5..b7a55ff42 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ZeroEx } from '../0x'; diff --git a/packages/0x.js/src/utils/order_validation_utils.ts b/packages/0x.js/src/utils/order_validation_utils.ts index ebe4c49df..917d414c8 100644 --- a/packages/0x.js/src/utils/order_validation_utils.ts +++ b/packages/0x.js/src/utils/order_validation_utils.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ZeroEx } from '../0x'; diff --git a/packages/0x.js/src/utils/utils.ts b/packages/0x.js/src/utils/utils.ts index 09de6ce52..e42a1a853 100644 --- a/packages/0x.js/src/utils/utils.ts +++ b/packages/0x.js/src/utils/utils.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import BN = require('bn.js'); import * as ethABI from 'ethereumjs-abi'; import * as ethUtil from 'ethereumjs-util'; diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 238cca00b..5bc2c149c 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts index b39481b55..db7acc8e5 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/0x.js/test/ether_token_wrapper_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/test/exchange_transfer_simulator_test.ts b/packages/0x.js/test/exchange_transfer_simulator_test.ts index cd4037cd9..20b4a05ca 100644 --- a/packages/0x.js/test/exchange_transfer_simulator_test.ts +++ b/packages/0x.js/test/exchange_transfer_simulator_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { ExchangeContractErrs, Token, ZeroEx } from '../src'; diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts index 9ac6a10b3..cb927ba8f 100644 --- a/packages/0x.js/test/exchange_wrapper_test.ts +++ b/packages/0x.js/test/exchange_wrapper_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/0x.js/test/expiration_watcher_test.ts index b502207a6..e7ba3533a 100644 --- a/packages/0x.js/test/expiration_watcher_test.ts +++ b/packages/0x.js/test/expiration_watcher_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts index 7d0e02481..9f284cfd9 100644 --- a/packages/0x.js/test/order_state_watcher_test.ts +++ b/packages/0x.js/test/order_state_watcher_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/0x.js/test/order_validation_test.ts index 4e47fbc9b..be3e0590c 100644 --- a/packages/0x.js/test/order_validation_test.ts +++ b/packages/0x.js/test/order_validation_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as Sinon from 'sinon'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/test/remaining_fillable_calculator_test.ts b/packages/0x.js/test/remaining_fillable_calculator_test.ts index 30b70995d..4c6b8f3ac 100644 --- a/packages/0x.js/test/remaining_fillable_calculator_test.ts +++ b/packages/0x.js/test/remaining_fillable_calculator_test.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; diff --git a/packages/0x.js/test/subscription_test.ts b/packages/0x.js/test/subscription_test.ts index 269d8ae89..d6269f15f 100644 --- a/packages/0x.js/test/subscription_test.ts +++ b/packages/0x.js/test/subscription_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts index 11af7d24c..296a704dd 100644 --- a/packages/0x.js/test/token_wrapper_test.ts +++ b/packages/0x.js/test/token_wrapper_test.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import * as chai from 'chai'; import 'mocha'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts index 734db8ee6..1a61487f4 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/0x.js/test/utils/fill_scenarios.ts @@ -1,5 +1,5 @@ +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import BigNumber from 'bignumber.js'; import { SignedOrder, Token, ZeroEx } from '../../src'; import { artifacts } from '../../src/artifacts'; diff --git a/packages/0x.js/test/utils/order_factory.ts b/packages/0x.js/test/utils/order_factory.ts index 04768af65..60a7c5fb2 100644 --- a/packages/0x.js/test/utils/order_factory.ts +++ b/packages/0x.js/test/utils/order_factory.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { SignedOrder, ZeroEx } from '../../src'; diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index fbf3db687..50efc43a1 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/abi-gen/README.md", "dependencies": { - "bignumber.js": "~4.1.0", + "@0xproject/utils": "^0.1.2", "chalk": "^2.3.0", "glob": "^7.1.2", "handlebars": "^4.0.11", diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index 524c54a5e..f6291d98d 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -11,7 +11,9 @@ export const utils = { if (solType.match(trailingArrayRegex)) { const arrayItemSolType = solType.replace(trailingArrayRegex, ''); const arrayItemTsType = utils.solTypeToTsType(paramKind, arrayItemSolType); - const arrayTsType = `(${arrayItemTsType})[]`; + const arrayTsType = utils.isUnionType(arrayItemTsType) + ? `Array<${arrayItemTsType}>` + : `${arrayItemTsType}[]`; return arrayTsType; } else { const solTypeRegexToTsType = [ @@ -38,6 +40,9 @@ export const utils = { throw new Error(`Unknown Solidity type found: ${solType}`); } }, + isUnionType(tsType: string): boolean { + return tsType === 'number|BigNumber'; + }, log(...args: any[]): void { console.log(...args); // tslint:disable-line:no-console }, diff --git a/packages/assert/package.json b/packages/assert/package.json index 71b02b1ac..1752f4b17 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -39,7 +39,6 @@ "dependencies": { "@0xproject/json-schemas": "^0.7.1", "@0xproject/utils": "^0.1.2", - "bignumber.js": "~4.1.0", "lodash": "^4.17.4", "valid-url": "^1.0.9" } diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index e729c043c..051a741c5 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -1,6 +1,5 @@ import { Schema, SchemaValidator } from '@0xproject/json-schemas'; -import { addressUtils } from '@0xproject/utils'; -import BigNumber from 'bignumber.js'; +import { addressUtils, BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as validUrl from 'valid-url'; diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index 51dc1d586..29344584a 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -1,5 +1,5 @@ import { schemas } from '@0xproject/json-schemas'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; import 'mocha'; diff --git a/packages/connect/package.json b/packages/connect/package.json index 34cb0b0ba..2995372d9 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -39,7 +39,6 @@ "@0xproject/assert": "^0.0.9", "@0xproject/json-schemas": "^0.7.1", "@0xproject/utils": "^0.1.2", - "bignumber.js": "~4.1.0", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", "query-string": "^5.0.1", diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index b9fc3c568..a492f5ae9 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -1,8 +1,3 @@ -import { bigNumberConfigs } from '@0xproject/utils'; - -// Customize our BigNumber instances -bigNumberConfigs.configure(); - export { HttpClient } from './http_client'; export { WebSocketOrderbookChannel } from './ws_orderbook_channel'; export { diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts index 1e6139bf9..edb6c77a6 100644 --- a/packages/connect/src/types.ts +++ b/packages/connect/src/types.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; // TODO: Consolidate Order, SignedOrder and ECSignature into a shared package instead of duplicating them from 0x.js export interface Order { diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts index ad27e0b97..c1808ce8a 100644 --- a/packages/connect/src/utils/type_converters.ts +++ b/packages/connect/src/utils/type_converters.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; export const typeConverters = { diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts index fc3292693..fecbaacff 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fees.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import { FeesResponse } from '../../../src/types'; diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts index f91ee75bd..5a03a2ff6 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; export const orderResponse = { maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b', diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts index 2c7ba1b98..6684ac2e5 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; export const orderbookResponse = { bids: [ diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.ts b/packages/connect/test/fixtures/standard_relayer_api/orders.ts index 62407c7cd..5044777bd 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orders.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orders.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; export const ordersResponse = [ { diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts index 17409a961..f48b1e877 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import { TokenPairsItem } from '../../../src/types'; diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index b33b946c0..e7096edad 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; import * as dirtyChai from 'dirty-chai'; diff --git a/packages/contracts/deploy/cli.ts b/packages/contracts/deploy/cli.ts index c3a03e406..53ae3bcfa 100644 --- a/packages/contracts/deploy/cli.ts +++ b/packages/contracts/deploy/cli.ts @@ -1,5 +1,5 @@ +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BigNumber } from 'bignumber.js'; import * as _ from 'lodash'; import * as path from 'path'; import * as Web3 from 'web3'; diff --git a/packages/contracts/deploy/migrations/migrate.ts b/packages/contracts/deploy/migrations/migrate.ts index 85f219a81..3efd1f9a6 100644 --- a/packages/contracts/deploy/migrations/migrate.ts +++ b/packages/contracts/deploy/migrations/migrate.ts @@ -1,5 +1,5 @@ +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BigNumber } from 'bignumber.js'; import * as _ from 'lodash'; import { Deployer } from './../src/deployer'; diff --git a/packages/contracts/deploy/test/util/constants.ts b/packages/contracts/deploy/test/util/constants.ts index 1bd062725..d52076607 100644 --- a/packages/contracts/deploy/test/util/constants.ts +++ b/packages/contracts/deploy/test/util/constants.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; export const constants = { networkId: 0, diff --git a/packages/contracts/globalsAugment.d.ts b/packages/contracts/globalsAugment.d.ts index c3ea54ffe..9b16ce2ad 100644 --- a/packages/contracts/globalsAugment.d.ts +++ b/packages/contracts/globalsAugment.d.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; // HACK: This module overrides the Chai namespace so that we can use BigNumber types inside. // Source: https://github.com/Microsoft/TypeScript/issues/7352#issuecomment-191547232 diff --git a/packages/contracts/package.json b/packages/contracts/package.json index c93043b3b..16dd2db63 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -59,7 +59,6 @@ "@0xproject/json-schemas": "^0.7.1", "@0xproject/utils": "^0.1.2", "@0xproject/web3-wrapper": "^0.1.2", - "bignumber.js": "~4.1.0", "bluebird": "^3.5.0", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/contracts/test/ts/ether_token.ts b/packages/contracts/test/ts/ether_token.ts index 98f477838..f807cdaa3 100644 --- a/packages/contracts/test/ts/ether_token.ts +++ b/packages/contracts/test/ts/ether_token.ts @@ -1,6 +1,5 @@ import { ZeroEx, ZeroExError } from '0x.js'; -import { promisify } from '@0xproject/utils'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber, promisify } from '@0xproject/utils'; import * as chai from 'chai'; import Web3 = require('web3'); diff --git a/packages/contracts/test/ts/exchange/core.ts b/packages/contracts/test/ts/exchange/core.ts index 19887a3e6..770ef0c43 100644 --- a/packages/contracts/test/ts/exchange/core.ts +++ b/packages/contracts/test/ts/exchange/core.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); import * as Web3 from 'web3'; diff --git a/packages/contracts/test/ts/exchange/helpers.ts b/packages/contracts/test/ts/exchange/helpers.ts index 5c5b656b5..95f68e419 100644 --- a/packages/contracts/test/ts/exchange/helpers.ts +++ b/packages/contracts/test/ts/exchange/helpers.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); diff --git a/packages/contracts/test/ts/exchange/wrapper.ts b/packages/contracts/test/ts/exchange/wrapper.ts index 77cd03388..e69e08bcf 100644 --- a/packages/contracts/test/ts/exchange/wrapper.ts +++ b/packages/contracts/test/ts/exchange/wrapper.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; diff --git a/packages/contracts/test/ts/multi_sig_with_time_lock.ts b/packages/contracts/test/ts/multi_sig_with_time_lock.ts index 19f9390d8..ea939a758 100644 --- a/packages/contracts/test/ts/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/ts/multi_sig_with_time_lock.ts @@ -1,6 +1,5 @@ import { RPC } from '@0xproject/dev-utils'; -import { promisify } from '@0xproject/utils'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber, promisify } from '@0xproject/utils'; import * as chai from 'chai'; import Web3 = require('web3'); diff --git a/packages/contracts/test/ts/unlimited_allowance_token.ts b/packages/contracts/test/ts/unlimited_allowance_token.ts index 008ee7ecd..c90a52095 100644 --- a/packages/contracts/test/ts/unlimited_allowance_token.ts +++ b/packages/contracts/test/ts/unlimited_allowance_token.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/ts/unlimited_allowance_token_v2.ts b/packages/contracts/test/ts/unlimited_allowance_token_v2.ts index 0053aedd5..1b29a02ba 100644 --- a/packages/contracts/test/ts/unlimited_allowance_token_v2.ts +++ b/packages/contracts/test/ts/unlimited_allowance_token_v2.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/ts/zrx_token.ts b/packages/contracts/test/ts/zrx_token.ts index 3122060c0..766c94c2a 100644 --- a/packages/contracts/test/ts/zrx_token.ts +++ b/packages/contracts/test/ts/zrx_token.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import Web3 = require('web3'); diff --git a/packages/contracts/util/balances.ts b/packages/contracts/util/balances.ts index eaeecf1c4..6a1659ab1 100644 --- a/packages/contracts/util/balances.ts +++ b/packages/contracts/util/balances.ts @@ -1,11 +1,8 @@ -import { bigNumberConfigs } from '@0xproject/utils'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { BalancesByOwner, ContractInstance } from './types'; -bigNumberConfigs.configure(); - export class Balances { private _tokenContractInstances: ContractInstance[]; private _ownerAddresses: string[]; diff --git a/packages/contracts/util/exchange_wrapper.ts b/packages/contracts/util/exchange_wrapper.ts index 200b0fb1e..ca79f92c4 100644 --- a/packages/contracts/util/exchange_wrapper.ts +++ b/packages/contracts/util/exchange_wrapper.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { formatters } from './formatters'; diff --git a/packages/contracts/util/formatters.ts b/packages/contracts/util/formatters.ts index ab3558ee7..0d0ef6df4 100644 --- a/packages/contracts/util/formatters.ts +++ b/packages/contracts/util/formatters.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { Order } from './order'; diff --git a/packages/contracts/util/order.ts b/packages/contracts/util/order.ts index 2427ffb87..e202d485b 100644 --- a/packages/contracts/util/order.ts +++ b/packages/contracts/util/order.ts @@ -1,5 +1,4 @@ -import { promisify } from '@0xproject/utils'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber, promisify } from '@0xproject/utils'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; import Web3 = require('web3'); diff --git a/packages/contracts/util/order_factory.ts b/packages/contracts/util/order_factory.ts index 3ae06a335..a45877de0 100644 --- a/packages/contracts/util/order_factory.ts +++ b/packages/contracts/util/order_factory.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { Order } from './order'; diff --git a/packages/contracts/util/types.ts b/packages/contracts/util/types.ts index 9b225cb0b..58a7e6a2d 100644 --- a/packages/contracts/util/types.ts +++ b/packages/contracts/util/types.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as Web3 from 'web3'; export interface BalancesByOwner { diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index deac351c5..09c684a5c 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -29,7 +29,7 @@ "typescript": "~2.6.1" }, "dependencies": { - "bignumber.js": "~4.1.0", + "@0xproject/utils": "^0.1.2", "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", "request-promise-native": "^1.0.5" diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 3f7b3536b..9f6cfccc7 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -32,7 +32,6 @@ "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", - "bignumber.js": "~4.1.0", "chai": "^4.0.1", "chai-typescript-typings": "^0.0.1", "dirty-chai": "^2.0.1", diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index b776f6e39..7b058781d 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; import forEach = require('lodash.foreach'); diff --git a/packages/kovan-faucets/package.json b/packages/kovan-faucets/package.json index bfc705c56..85349dd3d 100644 --- a/packages/kovan-faucets/package.json +++ b/packages/kovan-faucets/package.json @@ -16,7 +16,6 @@ "dependencies": { "0x.js": "^0.29.0", "@0xproject/utils": "^0.1.2", - "bignumber.js": "~4.1.0", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.3", "express": "^4.15.2", diff --git a/packages/kovan-faucets/src/ts/zrx_request_queue.ts b/packages/kovan-faucets/src/ts/zrx_request_queue.ts index dddc940bf..bbc06f1de 100644 --- a/packages/kovan-faucets/src/ts/zrx_request_queue.ts +++ b/packages/kovan-faucets/src/ts/zrx_request_queue.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { configs } from './configs'; diff --git a/packages/types/package.json b/packages/types/package.json index d39ed1f91..a16217169 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -20,13 +20,12 @@ "homepage": "https://github.com/0xProject/0x.js/packages/types/README.md", "devDependencies": { "@0xproject/tslint-config": "^0.4.0", - "bignumber.js": "^5.0.0", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "~2.6.1" }, "dependencies": { - "bignumber.js": "~4.1.0", + "@0xproject/utils": "^0.1.2", "web3": "^0.20.0" } } diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 3e81e506f..9cf9bc7af 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as Web3 from 'web3'; export interface TxData { diff --git a/packages/utils/src/bignumber_config.ts b/packages/utils/src/bignumber_config.ts deleted file mode 100644 index 2d5214e6f..000000000 --- a/packages/utils/src/bignumber_config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import BigNumber from 'bignumber.js'; - -export const bigNumberConfigs = { - configure() { - // By default BigNumber's `toString` method converts to exponential notation if the value has - // more then 20 digits. We want to avoid this behavior, so we set EXPONENTIAL_AT to a high number - BigNumber.config({ - EXPONENTIAL_AT: 1000, - }); - }, -}; diff --git a/packages/utils/src/configured_bignumber.ts b/packages/utils/src/configured_bignumber.ts new file mode 100644 index 000000000..e44c062c2 --- /dev/null +++ b/packages/utils/src/configured_bignumber.ts @@ -0,0 +1,9 @@ +import { BigNumber } from 'bignumber.js'; + +// By default BigNumber's `toString` method converts to exponential notation if the value has +// more then 20 digits. We want to avoid this behavior, so we set EXPONENTIAL_AT to a high number +BigNumber.config({ + EXPONENTIAL_AT: 1000, +}); + +export { BigNumber }; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index ca3219f10..2768e49ab 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -2,4 +2,4 @@ export { promisify } from './promisify'; export { addressUtils } from './address_utils'; export { classUtils } from './class_utils'; export { intervalUtils } from './interval_utils'; -export { bigNumberConfigs } from './bignumber_config'; +export { BigNumber } from './configured_bignumber'; diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 6cc642c9d..053712b12 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -30,7 +30,6 @@ }, "dependencies": { "@0xproject/utils": "^0.1.2", - "bignumber.js": "~4.1.0", "lodash": "^4.17.4", "web3": "^0.20.0" } diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index b7dd042f2..8fa38e987 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,6 +1,5 @@ import { TransactionReceipt, TxData } from '@0xproject/types'; -import { bigNumberConfigs, promisify } from '@0xproject/utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber, promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import * as Web3 from 'web3'; @@ -15,9 +14,6 @@ interface RawLogEntry { topics: string[]; } -// Customize our BigNumber instances -bigNumberConfigs.configure(); - export class Web3Wrapper { private _web3: Web3; private _defaults: Partial<TxData>; diff --git a/packages/website/package.json b/packages/website/package.json index dcfbe9330..b4ff61011 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -23,7 +23,6 @@ "@0xproject/utils": "^0.1.2", "accounting": "^0.4.1", "basscss": "^8.0.3", - "bignumber.js": "~4.1.0", "blockies": "^0.0.2", "compare-versions": "^3.0.1", "dateformat": "^2.0.0", diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 4ed1fe371..50cac6d29 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -21,8 +21,7 @@ import { LedgerWalletSubprovider, RedundantRPCSubprovider, } from '@0xproject/subproviders'; -import { intervalUtils, promisify } from '@0xproject/utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber, intervalUtils, promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import contract = require('truffle-contract'); diff --git a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx index ae4328976..661cc1d8c 100644 --- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx +++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import * as React from 'react'; diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index ae7117a70..c8547694a 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx index cd29b34e6..b3dbce598 100644 --- a/packages/website/ts/components/dialogs/send_dialog.tsx +++ b/packages/website/ts/components/dialogs/send_dialog.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index 924ee43b7..f2c505207 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; diff --git a/packages/website/ts/components/eth_wrappers.tsx b/packages/website/ts/components/eth_wrappers.tsx index fe733ea76..d074ec787 100644 --- a/packages/website/ts/components/eth_wrappers.tsx +++ b/packages/website/ts/components/eth_wrappers.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Divider from 'material-ui/Divider'; import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table'; diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 178b1adaf..ab6cdb5f3 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -1,6 +1,6 @@ import { Order as ZeroExOrder, ZeroEx } from '0x.js'; +import { BigNumber } from '@0xproject/utils'; import * as accounting from 'accounting'; -import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import { Card, CardHeader, CardText } from 'material-ui/Card'; import Divider from 'material-ui/Divider'; diff --git a/packages/website/ts/components/fill_order_json.tsx b/packages/website/ts/components/fill_order_json.tsx index d7d9fac4e..f8e43481a 100644 --- a/packages/website/ts/components/fill_order_json.tsx +++ b/packages/website/ts/components/fill_order_json.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; diff --git a/packages/website/ts/components/flash_messages/token_send_completed.tsx b/packages/website/ts/components/flash_messages/token_send_completed.tsx index 060cd2e23..18f371624 100644 --- a/packages/website/ts/components/flash_messages/token_send_completed.tsx +++ b/packages/website/ts/components/flash_messages/token_send_completed.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { Token } from 'ts/types'; diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index 949be4f84..3144fc3bd 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -1,5 +1,5 @@ import { Order, ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import Divider from 'material-ui/Divider'; diff --git a/packages/website/ts/components/generate_order/new_token_form.tsx b/packages/website/ts/components/generate_order/new_token_form.tsx index d0cd6add1..b416de168 100644 --- a/packages/website/ts/components/generate_order/new_token_form.tsx +++ b/packages/website/ts/components/generate_order/new_token_form.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import TextField from 'material-ui/TextField'; import * as React from 'react'; diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index 05da03f86..b29511390 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Toggle from 'material-ui/Toggle'; import * as React from 'react'; diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx index 8a9fcc1c5..ddc434b51 100644 --- a/packages/website/ts/components/inputs/balance_bounded_input.tsx +++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import TextField from 'material-ui/TextField'; import * as React from 'react'; diff --git a/packages/website/ts/components/inputs/eth_amount_input.tsx b/packages/website/ts/components/inputs/eth_amount_input.tsx index 855892e28..a66f92c8c 100644 --- a/packages/website/ts/components/inputs/eth_amount_input.tsx +++ b/packages/website/ts/components/inputs/eth_amount_input.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { BalanceBoundedInput } from 'ts/components/inputs/balance_bounded_input'; diff --git a/packages/website/ts/components/inputs/expiration_input.tsx b/packages/website/ts/components/inputs/expiration_input.tsx index 16aa5aa09..e473648d2 100644 --- a/packages/website/ts/components/inputs/expiration_input.tsx +++ b/packages/website/ts/components/inputs/expiration_input.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import DatePicker from 'material-ui/DatePicker'; import TimePicker from 'material-ui/TimePicker'; diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx index b3ded96c7..f3f522ce3 100644 --- a/packages/website/ts/components/inputs/token_amount_input.tsx +++ b/packages/website/ts/components/inputs/token_amount_input.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { Link } from 'react-router-dom'; diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx index bd462b42a..1b6b32a04 100644 --- a/packages/website/ts/components/order_json.tsx +++ b/packages/website/ts/components/order_json.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index cfd70b0b2..22cdcbf20 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import * as React from 'react'; diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index 356286f93..f94ec346a 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 913eb8a78..112b3fe60 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import DharmaLoanFrame from 'dharma-loan-frame'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; diff --git a/packages/website/ts/components/trade_history/trade_history_item.tsx b/packages/website/ts/components/trade_history/trade_history_item.tsx index 03f9862f2..7e42e64e6 100644 --- a/packages/website/ts/components/trade_history/trade_history_item.tsx +++ b/packages/website/ts/components/trade_history/trade_history_item.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import * as moment from 'moment'; diff --git a/packages/website/ts/containers/generate_order_form.tsx b/packages/website/ts/containers/generate_order_form.tsx index 1508b93d1..3fd31087f 100644 --- a/packages/website/ts/containers/generate_order_form.tsx +++ b/packages/website/ts/containers/generate_order_form.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { connect } from 'react-redux'; diff --git a/packages/website/ts/containers/portal.tsx b/packages/website/ts/containers/portal.tsx index 7ceaf1cf8..cdf5fc268 100644 --- a/packages/website/ts/containers/portal.tsx +++ b/packages/website/ts/containers/portal.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { connect } from 'react-redux'; diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index eee8fcf7b..ffb551561 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -1,7 +1,4 @@ // Polyfills -import 'whatwg-fetch'; - -import { bigNumberConfigs } from '@0xproject/utils'; import { MuiThemeProvider } from 'material-ui/styles'; import * as React from 'react'; import { render } from 'react-dom'; @@ -20,10 +17,9 @@ import { Wiki } from 'ts/pages/wiki/wiki'; import { reducer, State } from 'ts/redux/reducer'; import { WebsitePaths } from 'ts/types'; import { muiTheme } from 'ts/utils/mui_theme'; +import 'whatwg-fetch'; injectTapEventPlugin(); -bigNumberConfigs.configure(); - // Check if we've introduced an update that requires us to clear the tradeHistory local storage entries tradeHistoryStorage.clearIfRequired(); trackedTokenStorage.clearIfRequired(); diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx index c95506cad..df731236e 100644 --- a/packages/website/ts/local_storage/trade_history_storage.tsx +++ b/packages/website/ts/local_storage/trade_history_storage.tsx @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; import { localStorage } from 'ts/local_storage/local_storage'; diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts index 184ef0a05..42989e5e1 100644 --- a/packages/website/ts/redux/dispatcher.ts +++ b/packages/website/ts/redux/dispatcher.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import { Dispatch } from 'redux'; import { State } from 'ts/redux/reducer'; import { diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts index cc7d57a3a..06ac8b670 100644 --- a/packages/website/ts/redux/reducer.ts +++ b/packages/website/ts/redux/reducer.ts @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { Action, diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 86b6f5f90..7f82fded9 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; export enum Side { diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts index 073745ef6..3fc1e6397 100644 --- a/packages/website/ts/utils/constants.ts +++ b/packages/website/ts/utils/constants.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import { Networks } from 'ts/types'; export const constants = { diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 1148ef1bb..13a6d6ae2 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -1,5 +1,5 @@ import { ExchangeContractErrs, ZeroExError } from '0x.js'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from '@0xproject/utils'; import deepEqual = require('deep-equal'); import isMobile = require('is-mobile'); import * as _ from 'lodash'; diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts index 232f12138..6f260dc48 100644 --- a/packages/website/ts/web3_wrapper.ts +++ b/packages/website/ts/web3_wrapper.ts @@ -1,5 +1,4 @@ -import { intervalUtils, promisify } from '@0xproject/utils'; -import BigNumber from 'bignumber.js'; +import { BigNumber, intervalUtils, promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import { Dispatcher } from 'ts/redux/dispatcher'; import * as Web3 from 'web3'; |