diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-18 20:07:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 20:07:19 +0800 |
commit | bf653327638149816769027b0fde2d2e44a6fed0 (patch) | |
tree | 954985c17cf11eb5321b48a377523565bbf09733 /packages/web3-wrapper | |
parent | e6fe728bcbbab0c500fc7adee1439505282e8eca (diff) | |
parent | 3973dec9944a10c62ec6c3d15d973a00a6ea45a6 (diff) | |
download | dexon-0x-contracts-bf653327638149816769027b0fde2d2e44a6fed0.tar.gz dexon-0x-contracts-bf653327638149816769027b0fde2d2e44a6fed0.tar.zst dexon-0x-contracts-bf653327638149816769027b0fde2d2e44a6fed0.zip |
Merge branch 'development' into feature/new-ganache
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.json | 6 | ||||
-rw-r--r-- | packages/web3-wrapper/package.json | 2 | ||||
-rw-r--r-- | packages/web3-wrapper/src/utils.ts | 8 | ||||
-rw-r--r-- | packages/web3-wrapper/test/web3_wrapper_test.ts | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 99eced094..4a639f662 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,8 +1,12 @@ [ { - "version": "3.2.5", + "version": "4.0.0", "changes": [ { + "note": "Upgrade the bignumber.js to v8.0.2", + "pr": 1517 + }, + { "note": "Update ganache-core to v2.3.3", "pr": 1518 } diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index da5186f14..f28cc36ca 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -41,7 +41,7 @@ "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-bignumber": "^2.0.1", + "chai-bignumber": "^3.0.0", "dirty-chai": "^2.0.1", "ganache-core": "^2.3.3", "make-promises-safe": "^1.1.0", diff --git a/packages/web3-wrapper/src/utils.ts b/packages/web3-wrapper/src/utils.ts index c68587632..1aba3c75a 100644 --- a/packages/web3-wrapper/src/utils.ts +++ b/packages/web3-wrapper/src/utils.ts @@ -2,10 +2,6 @@ import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; export const utils = { - isBigNumber(value: any): boolean { - const isBigNumber = _.isObject(value) && value.isBigNumber; - return isBigNumber; - }, convertHexToNumber(value: string): number { const valueBigNumber = new BigNumber(value); const valueNumber = valueBigNumber.toNumber(); @@ -20,7 +16,7 @@ export const utils = { }, convertAmountToBigNumber(value: string | number | BigNumber): BigNumber { const num = value || 0; - const isBigNumber = utils.isBigNumber(num); + const isBigNumber = BigNumber.isBigNumber(num); if (isBigNumber) { return num as BigNumber; } @@ -37,7 +33,7 @@ export const utils = { const hexBase = 16; const valueHex = valueBigNumber.toString(hexBase); - return valueBigNumber.lessThan(0) ? `-0x${valueHex.substr(1)}` : `0x${valueHex}`; + return valueBigNumber.isLessThan(0) ? `-0x${valueHex.substr(1)}` : `0x${valueHex}`; }, numberToHex(value: number): string { if (!isFinite(value) && !utils.isHexStrict(value)) { diff --git a/packages/web3-wrapper/test/web3_wrapper_test.ts b/packages/web3-wrapper/test/web3_wrapper_test.ts index 32628422e..c4ee91d3d 100644 --- a/packages/web3-wrapper/test/web3_wrapper_test.ts +++ b/packages/web3-wrapper/test/web3_wrapper_test.ts @@ -1,10 +1,10 @@ +import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import { BlockParamLiteral, JSONRPCErrorCallback, JSONRPCRequestPayload, TransactionReceipt } from 'ethereum-types'; import * as Ganache from 'ganache-core'; import * as _ from 'lodash'; import 'mocha'; -import { utils } from '../src/utils'; import { Web3Wrapper } from '../src/web3_wrapper'; import { chaiSetup } from './utils/chai_setup'; @@ -118,7 +118,7 @@ describe('Web3Wrapper tests', () => { throw new Error('Expected block to exist'); } expect(blockIfExists.number).to.be.equal(0); - expect(utils.isBigNumber(blockIfExists.difficulty)).to.equal(true); + expect(BigNumber.isBigNumber(blockIfExists.difficulty)).to.equal(true); expect(_.isNumber(blockIfExists.gasLimit)).to.equal(true); }); it('gets block when supplied a block number', async () => { @@ -151,7 +151,7 @@ describe('Web3Wrapper tests', () => { const blockParamLiteral = BlockParamLiteral.Earliest; const block = await web3Wrapper.getBlockWithTransactionDataAsync(blockParamLiteral); expect(block.number).to.be.equal(0); - expect(utils.isBigNumber(block.difficulty)).to.equal(true); + expect(BigNumber.isBigNumber(block.difficulty)).to.equal(true); expect(_.isNumber(block.gasLimit)).to.equal(true); }); it('should throw if supplied invalid blockParam value', async () => { |