aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-02-06 09:22:45 +0800
committerGitHub <noreply@github.com>2018-02-06 09:22:45 +0800
commit225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e (patch)
treee7e2c65443a809d0e12ac987b84b8c079f949bad /packages
parent20590b7d35208bf3fb79ce6f06198ea995b05f91 (diff)
parentcf171d28c70c49541a30534d2593a623dd126f24 (diff)
downloaddexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar.gz
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar.bz2
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar.lz
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar.xz
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.tar.zst
dexon-0x-contracts-225baeb5cb8aed85d3e94a1d82a3c42ff5820d0e.zip
Merge branch 'development' into feature/subproviders/nonce-tracker
Diffstat (limited to 'packages')
-rw-r--r--packages/subproviders/CHANGELOG.md3
-rw-r--r--packages/subproviders/README.md2
-rw-r--r--packages/subproviders/src/subproviders/injected_web3.ts11
-rw-r--r--packages/website/ts/blockchain.ts2
4 files changed, 11 insertions, 7 deletions
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 8adaa1c08..908272406 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -3,8 +3,9 @@
## v0.4.1 - _Febuary 2, 2018_
* Added NonceTrackerSubprovider (#355)
+ * InjectedWeb3Subprovider accepts a Provider in the constructor, previously it was a Web3 object (#363)
-## v0.4.0 - _January 28, 2018_
+## v0.3.5 - _January 28, 2018_
* Return a transaction hash from `_sendTransactionAsync` (#303)
diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md
index 78643ad55..0d8f85910 100644
--- a/packages/subproviders/README.md
+++ b/packages/subproviders/README.md
@@ -2,6 +2,8 @@
A few useful web3 subproviders including a LedgerSubprovider useful for adding Ledger Nano S support.
+We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) article detailing some use cases of this subprovider package.
+
## Installation
```
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts
index bd29acb22..0d70180c4 100644
--- a/packages/subproviders/src/subproviders/injected_web3.ts
+++ b/packages/subproviders/src/subproviders/injected_web3.ts
@@ -1,17 +1,16 @@
import * as _ from 'lodash';
import Web3 = require('web3');
-import Web3ProviderEngine = require('web3-provider-engine');
/*
* This class implements the web3-provider-engine subprovider interface and forwards
* requests involving user accounts (getAccounts, sendTransaction, etc...) to the injected
- * web3 instance in their browser.
+ * provider instance in their browser.
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
*/
export class InjectedWeb3Subprovider {
private _injectedWeb3: Web3;
- constructor(injectedWeb3: Web3) {
- this._injectedWeb3 = injectedWeb3;
+ constructor(subprovider: Web3.Provider) {
+ this._injectedWeb3 = new Web3(subprovider);
}
public handleRequest(
payload: Web3.JSONRPCRequestPayload,
@@ -42,8 +41,10 @@ export class InjectedWeb3Subprovider {
}
}
// Required to implement this method despite not needing it for this subprovider
+ // The engine argument type should be Web3ProviderEngine, but we've decided to keep it as type any
+ // to remove the provider engine depdency given this method is a noop
// tslint:disable-next-line:prefer-function-over-method
- public setEngine(engine: Web3ProviderEngine) {
+ public setEngine(engine: any) {
// noop
}
}
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 71995e2cd..099efb405 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -100,7 +100,7 @@ export class Blockchain {
// We catch all requests involving a users account and send it to the injectedWeb3
// instance. All other requests go to the public hosted node.
provider = new ProviderEngine();
- provider.addProvider(new InjectedWeb3Subprovider(injectedWeb3));
+ provider.addProvider(new InjectedWeb3Subprovider(injectedWeb3.currentProvider));
provider.addProvider(new FilterSubprovider());
provider.addProvider(new RedundantRPCSubprovider(publicNodeUrlsIfExistsForNetworkId));
provider.start();