aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-18 06:56:54 +0800
committerGitHub <noreply@github.com>2018-10-18 06:56:54 +0800
commitc289baa17a299e3ba80ef00520d3bcf85048acc0 (patch)
tree0be7ee562c5c112961b3a03d5ae5e45ec49f2339 /app/scripts
parent03b0929a28048adab2d69f6c042cf8c7ca247ddb (diff)
parent59ab595b5ea6a4e24f2048d2ed43c1181bb5aa3e (diff)
downloadtangerine-wallet-browser-c289baa17a299e3ba80ef00520d3bcf85048acc0.tar.gz
tangerine-wallet-browser-c289baa17a299e3ba80ef00520d3bcf85048acc0.tar.zst
tangerine-wallet-browser-c289baa17a299e3ba80ef00520d3bcf85048acc0.zip
Merge pull request #5127 from MetaMask/account-tracker-network-change
Bug Fix: Force AccountTracker to update balances on network change
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/metamask-controller.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index ebf1749c6..32ceb6790 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -129,6 +129,7 @@ module.exports = class MetamaskController extends EventEmitter {
provider: this.provider,
blockTracker: this.blockTracker,
})
+
// start and stop polling for balances based on activeControllerConnections
this.on('controllerConnectionChanged', (activeControllerConnections) => {
if (activeControllerConnections > 0) {
@@ -137,7 +138,12 @@ module.exports = class MetamaskController extends EventEmitter {
this.accountTracker.stop()
}
})
-
+
+ // ensure accountTracker updates balances after network change
+ this.networkController.on('networkDidChange', () => {
+ this.accountTracker._updateAccounts()
+ })
+
// key mgmt
const additionalKeyrings = [TrezorKeyring, LedgerBridgeKeyring]
this.keyringController = new KeyringController({