aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-09 01:21:51 +0800
committerFabio Berger <me@fabioberger.com>2017-12-09 01:21:51 +0800
commitaf8d24d0eb5af781f4731b5559979f2b02579785 (patch)
tree6f429e6f2b3050de6dd7ce16e42c7f387bd5018a /packages/website
parentca85a97106ea6d09fbceafac8f9516945ccff399 (diff)
parent5eea829be9f5e8669c40dac965231051b668ed37 (diff)
downloaddexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.gz
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.bz2
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.lz
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.xz
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.tar.zst
dexon-sol-tools-af8d24d0eb5af781f4731b5559979f2b02579785.zip
Merge branch 'development' into feature/addSubproviders
* development: Update README.md Inline network module Stop supporting different file extensions in abi-gen Refactor networkId out of web3Wrapper Update connect types in preperation for publishing Fix CI command Address feedback Refactor web3Wrapper to a separate package # Conflicts: # package.json # packages/website/ts/blockchain.ts
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/package.json1
-rw-r--r--packages/website/ts/blockchain.ts6
-rw-r--r--packages/website/ts/globals.d.ts1
-rw-r--r--packages/website/ts/web3_wrapper.ts18
4 files changed, 12 insertions, 14 deletions
diff --git a/packages/website/package.json b/packages/website/package.json
index ac6e61a88..9234ad601 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",
- "es6-promisify": "^5.0.0",
"ethereum-address": "^0.0.4",
"ethereumjs-tx": "^1.3.3",
"ethereumjs-util": "^5.1.1",
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 809da7d4f..76640a072 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -23,9 +23,9 @@ import {
LedgerWalletSubprovider,
RedundantRPCSubprovider,
} from '@0xproject/subproviders';
+import {promisify} from '@0xproject/utils';
import BigNumber from 'bignumber.js';
import compareVersions = require('compare-versions');
-import promisify = require('es6-promisify');
import ethUtil = require('ethereumjs-util');
import findVersions = require('find-versions');
import * as _ from 'lodash';
@@ -68,7 +68,7 @@ export class Blockchain {
public nodeVersion: string;
private zeroEx: ZeroEx;
private dispatcher: Dispatcher;
- private web3Wrapper: Web3Wrapper;
+ private web3Wrapper?: Web3Wrapper;
private exchangeAddress: string;
private tokenTransferProxy: ContractInstance;
private tokenRegistry: ContractInstance;
@@ -631,7 +631,7 @@ export class Blockchain {
let networkIdIfExists: number;
if (!_.isUndefined(injectedWeb3)) {
try {
- networkIdIfExists = _.parseInt(await promisify(injectedWeb3.version.getNetwork)());
+ networkIdIfExists = _.parseInt(await promisify<string>(injectedWeb3.version.getNetwork)());
} catch (err) {
// Ignore error and proceed with networkId undefined
}
diff --git a/packages/website/ts/globals.d.ts b/packages/website/ts/globals.d.ts
index 38a4b971e..b4611f583 100644
--- a/packages/website/ts/globals.d.ts
+++ b/packages/website/ts/globals.d.ts
@@ -1,6 +1,5 @@
declare module 'react-tooltip';
declare module 'react-router-hash-link';
-declare module 'es6-promisify';
declare module 'truffle-contract';
declare module 'ethereumjs-util';
declare module 'keccak';
diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts
index c43436c7e..b713f8a33 100644
--- a/packages/website/ts/web3_wrapper.ts
+++ b/packages/website/ts/web3_wrapper.ts
@@ -1,8 +1,8 @@
+import {promisify} from '@0xproject/utils';
import BigNumber from 'bignumber.js';
-import promisify = require('es6-promisify');
import * as _ from 'lodash';
import {Dispatcher} from 'ts/redux/dispatcher';
-import Web3 = require('web3');
+import * as Web3 from 'web3';
export class Web3Wrapper {
private dispatcher: Dispatcher;
@@ -28,7 +28,7 @@ export class Web3Wrapper {
return this.web3.isAddress(address);
}
public async getAccountsAsync(): Promise<string[]> {
- const addresses = await promisify(this.web3.eth.getAccounts)();
+ const addresses = await promisify<string[]>(this.web3.eth.getAccounts)();
return addresses;
}
public async getFirstAccountIfExistsAsync() {
@@ -38,8 +38,8 @@ export class Web3Wrapper {
}
return (addresses)[0];
}
- public async getNodeVersionAsync() {
- const nodeVersion = await promisify(this.web3.version.getNode)();
+ public async getNodeVersionAsync(): Promise<string> {
+ const nodeVersion = await promisify<string>(this.web3.version.getNode)();
return nodeVersion;
}
public getProviderObj() {
@@ -54,24 +54,24 @@ export class Web3Wrapper {
}
}
public async getBalanceInEthAsync(owner: string): Promise<BigNumber> {
- const balanceInWei: BigNumber = await promisify(this.web3.eth.getBalance)(owner);
+ const balanceInWei: BigNumber = await promisify<BigNumber>(this.web3.eth.getBalance)(owner);
const balanceEthOldBigNumber = this.web3.fromWei(balanceInWei, 'ether');
const balanceEth = new BigNumber(balanceEthOldBigNumber);
return balanceEth;
}
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
- const code = await promisify(this.web3.eth.getCode)(address);
+ const code = await promisify<string>(this.web3.eth.getCode)(address);
// Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients
const zeroHexAddressRegex = /^0[xX][0]*$/;
const didFindCode = _.isNull(code.match(zeroHexAddressRegex));
return didFindCode;
}
public async signTransactionAsync(address: string, message: string): Promise<string> {
- const signData = await promisify(this.web3.eth.sign)(address, message);
+ const signData = await promisify<string>(this.web3.eth.sign)(address, message);
return signData;
}
public async getBlockTimestampAsync(blockHash: string): Promise<number> {
- const {timestamp} = await promisify(this.web3.eth.getBlock)(blockHash);
+ const {timestamp} = await promisify<Web3.BlockWithoutTransactionData>(this.web3.eth.getBlock)(blockHash);
return timestamp;
}
public destroy() {