aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-12-21 06:46:12 +0800
committerDan <danjm.com@gmail.com>2017-12-21 06:46:12 +0800
commit7915e62d65de1bbc3419cba58f69e6d55a4df3ea (patch)
treeb1b9c006bac35381619eccde235d66e0a4c0bf1f /app/scripts/metamask-controller.js
parentbccbf14b39ab2b1670c9c30b276404fe4f949cd7 (diff)
parentd3f5ad874e4bf90cda4e440f9b0635c6ac416382 (diff)
downloadtangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar.gz
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar.bz2
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar.lz
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar.xz
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.tar.zst
tangerine-wallet-browser-7915e62d65de1bbc3419cba58f69e6d55a4df3ea.zip
Merge branch 'master' into NewUI-flat
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js48
1 files changed, 34 insertions, 14 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 018eb2c76..54e73d180 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -23,6 +23,7 @@ const ShapeShiftController = require('./controllers/shapeshift')
const AddressBookController = require('./controllers/address-book')
const InfuraController = require('./controllers/infura')
const BlacklistController = require('./controllers/blacklist')
+const RecentBlocksController = require('./controllers/recent-blocks')
const MessageManager = require('./lib/message-manager')
const PersonalMessageManager = require('./lib/personal-message-manager')
const TypedMessageManager = require('./lib/typed-message-manager')
@@ -91,6 +92,10 @@ module.exports = class MetamaskController extends EventEmitter {
this.provider = this.initializeProvider()
this.blockTracker = this.provider._blockTracker
+ this.recentBlocksController = new RecentBlocksController({
+ blockTracker: this.blockTracker,
+ })
+
// eth data query tools
this.ethQuery = new EthQuery(this.provider)
// account tracker watches balances, nonces, and any code at their address.
@@ -196,25 +201,30 @@ module.exports = class MetamaskController extends EventEmitter {
this.blacklistController.store.subscribe((state) => {
this.store.updateState({ BlacklistController: state })
})
+ this.recentBlocksController.store.subscribe((state) => {
+ this.store.updateState({ RecentBlocks: state })
+ })
this.infuraController.store.subscribe((state) => {
this.store.updateState({ InfuraController: state })
})
// manual mem state subscriptions
- this.networkController.store.subscribe(this.sendUpdate.bind(this))
- this.accountTracker.store.subscribe(this.sendUpdate.bind(this))
- this.txController.memStore.subscribe(this.sendUpdate.bind(this))
- this.balancesController.store.subscribe(this.sendUpdate.bind(this))
- this.messageManager.memStore.subscribe(this.sendUpdate.bind(this))
- this.personalMessageManager.memStore.subscribe(this.sendUpdate.bind(this))
- this.typedMessageManager.memStore.subscribe(this.sendUpdate.bind(this))
- this.keyringController.memStore.subscribe(this.sendUpdate.bind(this))
- this.preferencesController.store.subscribe(this.sendUpdate.bind(this))
- this.addressBookController.store.subscribe(this.sendUpdate.bind(this))
- this.currencyController.store.subscribe(this.sendUpdate.bind(this))
- this.noticeController.memStore.subscribe(this.sendUpdate.bind(this))
- this.shapeshiftController.store.subscribe(this.sendUpdate.bind(this))
- this.infuraController.store.subscribe(this.sendUpdate.bind(this))
+ const sendUpdate = this.sendUpdate.bind(this)
+ this.networkController.store.subscribe(sendUpdate)
+ this.accountTracker.store.subscribe(sendUpdate)
+ this.txController.memStore.subscribe(sendUpdate)
+ this.balancesController.store.subscribe(sendUpdate)
+ this.messageManager.memStore.subscribe(sendUpdate)
+ this.personalMessageManager.memStore.subscribe(sendUpdate)
+ this.typedMessageManager.memStore.subscribe(sendUpdate)
+ this.keyringController.memStore.subscribe(sendUpdate)
+ this.preferencesController.store.subscribe(sendUpdate)
+ this.recentBlocksController.store.subscribe(sendUpdate)
+ this.addressBookController.store.subscribe(sendUpdate)
+ this.currencyController.store.subscribe(sendUpdate)
+ this.noticeController.memStore.subscribe(sendUpdate)
+ this.shapeshiftController.store.subscribe(sendUpdate)
+ this.infuraController.store.subscribe(sendUpdate)
}
//
@@ -298,6 +308,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.currencyController.store.getState(),
this.noticeController.memStore.getState(),
this.infuraController.store.getState(),
+ this.recentBlocksController.store.getState(),
// config manager
this.configManager.getConfig(),
this.shapeshiftController.store.getState(),
@@ -366,6 +377,7 @@ module.exports = class MetamaskController extends EventEmitter {
// txController
cancelTransaction: nodeify(txController.cancelTransaction, txController),
updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController),
+ retryTransaction: nodeify(this.retryTransaction, this),
// messageManager
signMessage: nodeify(this.signMessage, this),
@@ -576,6 +588,14 @@ module.exports = class MetamaskController extends EventEmitter {
//
// Identity Management
//
+ //
+
+ async retryTransaction (txId, cb) {
+ await this.txController.retryTransaction(txId)
+ const state = await this.getState()
+ return state
+ }
+
newUnsignedMessage (msgParams, cb) {
const msgId = this.messageManager.addUnapprovedMessage(msgParams)