aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-10 05:24:52 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-10 05:24:52 +0800
commit7cca7ace2ea4cd4b9d3a242067c9a7c344406aba (patch)
tree5203febbb77d924aba63295a1a42460c34144b92 /app/scripts
parent512760154528c47213cc8ff75475c21e3e674a23 (diff)
downloadtangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar.gz
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar.bz2
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar.lz
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar.xz
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.tar.zst
tangerine-wallet-browser-7cca7ace2ea4cd4b9d3a242067c9a7c344406aba.zip
fix all the account related bugs
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/metamask-controller.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index d70bac1c3..8104374bc 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -529,17 +529,28 @@ module.exports = class MetamaskController extends EventEmitter {
switch (deviceName) {
case 'trezor':
const keyringController = this.keyringController
+ const oldAccounts = await keyringController.getAccounts()
let keyring = await keyringController.getKeyringsByType(
'Trezor Hardware'
)[0]
if (!keyring) {
keyring = await this.keyringController.addNewKeyring('Trezor Hardware')
}
- if (page === 0) {
- keyring.page = 0
+ let accounts = []
+
+ switch (page) {
+ case -1:
+ accounts = await keyring.getPreviousPage()
+ break
+ case 1:
+ accounts = await keyring.getNextPage()
+ break
+ default:
+ accounts = await keyring.getFirstPage()
}
- const accounts = page === -1 ? await keyring.getPreviousPage() : await keyring.getNextPage()
- this.accountTracker.syncWithAddresses(accounts.map(a => a.address))
+
+ // Merge with existing accounts
+ this.accountTracker.syncWithAddresses(oldAccounts.concat(accounts.map(a => a.address)))
return accounts
default: