diff options
author | Fabio Berger <me@fabioberger.com> | 2017-08-31 01:47:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-08-31 01:47:14 +0800 |
commit | 4620c1c818e6d54741b262e2100d2731dae16dda (patch) | |
tree | 2bb1e842a02780ec009995e1481997895885ff7b /src/0x.ts | |
parent | 4370e19880966cf00726a6fae41cfaa5f751e881 (diff) | |
parent | 5f44b5f7111873a3958050503fff0ed098b65b04 (diff) | |
download | dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.gz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.bz2 dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.lz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.xz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.zst dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.zip |
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js:
Improve the comment
Add assert.isWeb3Provider
Use more concise dep pointing
Don't create whole web3 object in beta tests
Improve the comment
Add tests for web3@1.0
Use zeroEx.getAvailableAddressesAsync instead of web3.eth.getAccounts
Add web3@1.0 to web3Factory
Support web3@1.0 providers
Define web3@1.0 types ;)
Install web3@1.0.0 as web3_beta
Diffstat (limited to 'src/0x.ts')
-rw-r--r-- | src/0x.ts | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -163,6 +163,13 @@ export class ZeroEx { * @return An instance of the 0x.js ZeroEx class. */ constructor(provider: Web3Provider, config?: ZeroExConfig) { + assert.isWeb3Provider('provider', provider); + if (_.isUndefined((provider as any).sendAsync)) { + // Web3@1.0 provider doesn't support synchronous http requests, + // so it only has an async `send` method, instead of a `send` and `sendAsync` in web3@0.x.x` + // We re-assign the send method so that Web3@1.0 providers work with 0x.js + (provider as any).sendAsync = (provider as any).send; + } this._web3Wrapper = new Web3Wrapper(provider); const gasPrice = _.isUndefined(config) ? undefined : config.gasPrice; this.token = new TokenWrapper(this._web3Wrapper, gasPrice); |