From 17aac2dbc54b733aeed5f16ef2e7bd8378060ca9 Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 10 Nov 2016 19:07:12 -0800 Subject: [PATCH] fix tx data so it has the network id --- app/scripts/keyring-controller.js | 5 +++-- app/scripts/metamask-controller.js | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 3ebf02c44..5d9dd51a4 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -38,7 +38,7 @@ module.exports = class KeyringController extends EventEmitter { this._unconfTxCbs = {} this._unconfMsgCbs = {} - this.network = opts.network + this.getNetwork = opts.getNetwork // TEMPORARY UNTIL FULL DEPRECATION: this.idStoreMigrator = new IdStoreMigrator({ @@ -344,13 +344,14 @@ module.exports = class KeyringController extends EventEmitter { var time = (new Date()).getTime() var txId = createId() txParams.metamaskId = txId - txParams.metamaskNetworkId = this.network + txParams.metamaskNetworkId = this.getNetwork() var txData = { id: txId, txParams: txParams, time: time, status: 'unconfirmed', gasMultiplier: configManager.getGasMultiplier() || 1, + metamaskNetworkId: this.getNetwork(), } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 4c01b23d8..07d365283 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -17,6 +17,7 @@ module.exports = class MetamaskController { this.configManager = new ConfigManager(opts) this.keyringController = new KeyringController({ configManager: this.configManager, + getNetwork: this.getStateNetwork.bind(this), }) this.provider = this.initializeProvider(opts) this.ethStore = new EthStore(this.provider) @@ -399,4 +400,9 @@ module.exports = class MetamaskController { cb(e) } } + + getStateNetwork () { + return this.state.network + } } +