aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-10-11 01:39:31 +0800
committerkumavis <aaron@kumavis.me>2017-10-11 01:39:31 +0800
commitf7c1bc804d12cfae4ff99b958b793a6fb68f4aa0 (patch)
treeeb245ef5a1fb65fac0ef69f4ccf47cb7c3c77b1e /app
parente79037261ec4b232299dbef14e6c30fc46c48ac7 (diff)
downloadtangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar.gz
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar.bz2
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar.lz
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar.xz
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.tar.zst
tangerine-wallet-browser-f7c1bc804d12cfae4ff99b958b793a6fb68f4aa0.zip
metamask controller - simplify provider init
Diffstat (limited to 'app')
-rw-r--r--app/scripts/metamask-controller.js38
1 files changed, 16 insertions, 22 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 840012e81..df5784571 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -81,8 +81,22 @@ module.exports = class MetamaskController extends EventEmitter {
})
this.blacklistController.scheduleUpdates()
- // rpc provider
- this.provider = this.initializeProvider()
+ // rpc provider and block tracker
+ this.provider = this.networkController.initializeProvider({
+ static: {
+ eth_syncing: false,
+ web3_clientVersion: `MetaMask/v${version}`,
+ },
+ // account mgmt
+ getAccounts: nodeify(this.getAccounts, this),
+ // tx signing
+ processTransaction: nodeify(this.txController.newUnapprovedTransaction, this.txController),
+ // old style msg signing
+ processMessage: this.newUnsignedMessage.bind(this),
+ // personal_sign msg signing
+ processPersonalMessage: this.newUnsignedPersonalMessage.bind(this),
+ processTypedMessage: this.newUnsignedTypedMessage.bind(this),
+ })
this.blockTracker = this.provider._blockTracker
// eth data query tools
@@ -218,26 +232,6 @@ module.exports = class MetamaskController extends EventEmitter {
// Constructor helpers
//
- initializeProvider () {
- const providerOpts = {
- static: {
- eth_syncing: false,
- web3_clientVersion: `MetaMask/v${version}`,
- },
- // account mgmt
- getAccounts: nodeify(this.getAccounts, this),
- // tx signing
- processTransaction: nodeify(this.txController.newUnapprovedTransaction, this.txController),
- // old style msg signing
- processMessage: this.newUnsignedMessage.bind(this),
- // personal_sign msg signing
- processPersonalMessage: this.newUnsignedPersonalMessage.bind(this),
- processTypedMessage: this.newUnsignedTypedMessage.bind(this),
- }
- const providerProxy = this.networkController.initializeProvider(providerOpts)
- return providerProxy
- }
-
initPublicConfigStore () {
// get init state
const publicConfigStore = new ObservableStore()