diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-05-24 05:16:32 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-05-24 05:16:32 +0800 |
commit | 3fe94891d3569a4615f4aa32d47f0065b5957fe9 (patch) | |
tree | 83d4e4ccf7748d2100aa935c457de0a893eaec9c /packages/web3-wrapper | |
parent | d0abc60176dba3116cb3986d298ab5164c1fe49c (diff) | |
parent | f6b81f588d98e09e7a5806902d94e2892d029481 (diff) | |
download | dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.gz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.bz2 dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.lz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.xz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.zst dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.zip |
Merge branch 'v2-prototype' into feature/website/wallet-flex-box
* v2-prototype: (95 commits)
Add missing dep to website
Upgrade solidity parser
Fix trace test
Fix linter issues
Move contract utils
Fix prettier
Fix NameResolver
Fix prettier
Remove 0x.js as a dependency from website
Enable 0x.js tests
Fix small bug in order-utils
Address feedback
Fix Tslint error caused by "PromiseLike" value
Fix Tslint error caused by "PromiseLike" value
Update dogfood url
fix contract-wrappers version
Parse compiler.json in SolCompilerArtifactsAdapter
Fix TokenTransferProxy artifact name since it's now suffixed with _v1
Update yarn.lock
Fix signature verification test
...
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.md | 6 | ||||
-rw-r--r-- | packages/web3-wrapper/package.json | 12 | ||||
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 16 |
4 files changed, 29 insertions, 14 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 35e4383fd..b753ffbac 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1527009133, + "version": "0.6.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1525477860, "version": "0.6.3", "changes": [ diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 3358c9a01..4b8fb7bac 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.6.3 - _May 5, 2018_ +## v0.6.4 - _May 22, 2018_ + + * Dependencies updated + +## v0.6.3 - _May 4, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index ed2fce7dc..18bbf14a0 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "0.6.3", + "version": "0.6.4", "engines": { "node": ">=6.12" }, @@ -43,8 +43,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -62,9 +62,9 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "ethers": "^3.0.15", "lodash": "^4.17.4", "web3": "^0.20.0" diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index c60d5fe33..91a1af870 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -19,6 +19,8 @@ import * as Web3 from 'web3'; import { Web3WrapperErrors } from './types'; +const BASE_TEN = 10; + /** * A wrapper around the Web3.js 0.x library that provides a consistent, clean promise-based interface. */ @@ -48,7 +50,7 @@ export class Web3Wrapper { * @return The amount in units. */ public static toUnitAmount(amount: BigNumber, decimals: number): BigNumber { - const aUnit = new BigNumber(10).pow(decimals); + const aUnit = new BigNumber(BASE_TEN).pow(decimals); const unit = amount.div(aUnit); return unit; } @@ -61,7 +63,7 @@ export class Web3Wrapper { * @return The amount in baseUnits. */ public static toBaseUnitAmount(amount: BigNumber, decimals: number): BigNumber { - const unit = new BigNumber(10).pow(decimals); + const unit = new BigNumber(BASE_TEN).pow(decimals); const baseUnitAmount = amount.times(unit); const hasDecimals = baseUnitAmount.decimalPlaces() !== 0; if (hasDecimals) { @@ -180,8 +182,8 @@ export class Web3Wrapper { public async doesContractExistAtAddressAsync(address: string): Promise<boolean> { const code = await promisify<string>(this._web3.eth.getCode)(address); // Regex matches 0x0, 0x00, 0x in order to accommodate poorly implemented clients - const codeIsEmpty = /^0x0{0,40}$/i.test(code); - return !codeIsEmpty; + const isCodeEmpty = /^0x0{0,40}$/i.test(code); + return !isCodeEmpty; } /** * Sign a message with a specific address's private key (`eth_sign`) @@ -336,16 +338,16 @@ export class Web3Wrapper { pollingIntervalMs: number = 1000, timeoutMs?: number, ): Promise<TransactionReceiptWithDecodedLogs> { - let timeoutExceeded = false; + let wasTimeoutExceeded = false; if (timeoutMs) { - setTimeout(() => (timeoutExceeded = true), timeoutMs); + setTimeout(() => (wasTimeoutExceeded = true), timeoutMs); } const txReceiptPromise = new Promise( (resolve: (receipt: TransactionReceiptWithDecodedLogs) => void, reject) => { const intervalId = intervalUtils.setAsyncExcludingInterval( async () => { - if (timeoutExceeded) { + if (wasTimeoutExceeded) { intervalUtils.clearAsyncExcludingInterval(intervalId); return reject(Web3WrapperErrors.TransactionMiningTimeout); } |