diff options
author | Jacob Evans <jacob@dekz.net> | 2018-02-03 06:44:29 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-02-03 06:44:29 +0800 |
commit | 7f257e258f5d5dedc9bc1edbd38180cc872bc2a0 (patch) | |
tree | 3323c4bd10217d54c6dab774b7e97e421c0c168e /packages | |
parent | 6a9d3de0f98dee20963f0f70a9b7ad08b9508100 (diff) | |
download | dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar.gz dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar.bz2 dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar.lz dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar.xz dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.tar.zst dexon-sol-tools-7f257e258f5d5dedc9bc1edbd38180cc872bc2a0.zip |
Change the InjectedWeb3Subprovider to accept Web3.Provider
Diffstat (limited to 'packages')
-rw-r--r-- | packages/subproviders/src/subproviders/injected_web3.ts | 9 | ||||
-rw-r--r-- | packages/website/ts/blockchain.ts | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index bd29acb22..238ba89f8 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. + * MetamaskInpageProvider 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, @@ -43,7 +42,7 @@ export class InjectedWeb3Subprovider { } // Required to implement this method despite not needing it for this subprovider // 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(); |