diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-15 23:05:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-15 23:05:03 +0800 |
commit | d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957 (patch) | |
tree | d93f79ec7909c1808ddfe7a145df41d2c104a553 /src/web3_wrapper.ts | |
parent | 424912040a7e68b6d07cd4ae40763d9bcd98de28 (diff) | |
download | dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar.gz dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar.bz2 dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar.lz dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar.xz dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.tar.zst dexon-sol-tools-d789aa24aa2c9f4e0d17a382fe9cb8d56ab27957.zip |
Make ZeroEx constructor accept Web3Provider instead of Web3 instance
Diffstat (limited to 'src/web3_wrapper.ts')
-rw-r--r-- | src/web3_wrapper.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index 05a8dc063..5bff25233 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -2,16 +2,15 @@ import * as _ from 'lodash'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; import promisify = require('es6-promisify'); -import {ZeroExError} from './types'; -import {assert} from './utils/assert'; +import {Web3Provider} from './types'; export class Web3Wrapper { private web3: Web3; - constructor(web3: Web3) { + constructor(provider: Web3Provider) { this.web3 = new Web3(); - this.web3.setProvider(web3.currentProvider); + this.web3.setProvider(provider); } - public setProvider(provider: Web3.Provider) { + public setProvider(provider: Web3Provider) { this.web3.setProvider(provider); } public isAddress(address: string): boolean { @@ -25,7 +24,7 @@ export class Web3Wrapper { const nodeVersion = await promisify(this.web3.version.getNode)(); return nodeVersion; } - public getCurrentProvider(): Web3.Provider { + public getCurrentProvider(): Web3Provider { return this.web3.currentProvider; } public async getNetworkIdIfExistsAsync(): Promise<number|undefined> { |