Merge pull request #444 from 0xProject/dedupWeb3Wrapper

Remove custom web3Wrapper from website
This commit is contained in:
Fabio Berger
2018-03-11 12:49:15 +01:00
committed by GitHub
21 changed files with 308 additions and 278 deletions

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.2.1 _TBD_
* Add a `getProvider` method (#444)
## v0.2.0 _March 4, 2018_
* Ensure all returned user addresses are lowercase (#373)

View File

@@ -11,7 +11,7 @@ export class Web3Wrapper {
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
// We re-assign the send method so that Web3@1.0 providers work with @0xproject/web3-wrapper
(provider as any).sendAsync = (provider as any).send;
}
this._web3 = new Web3();
@@ -22,6 +22,9 @@ export class Web3Wrapper {
public getContractDefaults(): Partial<TxData> {
return this._defaults;
}
public getProvider(): Web3.Provider {
return this._web3.currentProvider;
}
public setProvider(provider: Web3.Provider) {
this._web3.setProvider(provider);
}