aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-08-14 07:29:43 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-08-14 07:29:43 +0800
commit4e1d8ba19db729f5c282c4e3c6b43433b562a45e (patch)
tree6d8470f9289247a9f4998e44de075674486c6125 /app/scripts/metamask-controller.js
parent77ad856730d5b54974b86e9bed7952ff1dc10fe0 (diff)
downloadtangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar.gz
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar.bz2
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar.lz
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar.xz
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.tar.zst
tangerine-wallet-browser-4e1d8ba19db729f5c282c4e3c6b43433b562a45e.zip
good progress adding paths
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index fed00077e..beaf04c0d 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -539,7 +539,7 @@ module.exports = class MetamaskController extends EventEmitter {
// Hardware
//
- async getKeyringForDevice (deviceName) {
+ async getKeyringForDevice (deviceName, hdPath = null) {
let keyringName = null
switch (deviceName) {
case 'trezor':
@@ -555,6 +555,10 @@ module.exports = class MetamaskController extends EventEmitter {
if (!keyring) {
keyring = await this.keyringController.addNewKeyring(keyringName)
}
+ if (hdPath) {
+ console.log('[LEDGER]: HDPATH set', hdPath)
+ keyring.hdPath = hdPath
+ }
return keyring
@@ -565,9 +569,8 @@ module.exports = class MetamaskController extends EventEmitter {
*
* @returns [] accounts
*/
- async connectHardware (deviceName, page) {
-
- const keyring = await this.getKeyringForDevice(deviceName)
+ async connectHardware (deviceName, page, hdPath) {
+ const keyring = await this.getKeyringForDevice(deviceName, hdPath)
let accounts = []
switch (page) {
case -1:
@@ -593,8 +596,8 @@ module.exports = class MetamaskController extends EventEmitter {
*
* @returns {Promise<boolean>}
*/
- async checkHardwareStatus (deviceName) {
- const keyring = await this.getKeyringForDevice(deviceName)
+ async checkHardwareStatus (deviceName, hdPath) {
+ const keyring = await this.getKeyringForDevice(deviceName, hdPath)
return keyring.isUnlocked()
}
@@ -615,8 +618,8 @@ module.exports = class MetamaskController extends EventEmitter {
*
* @returns {} keyState
*/
- async unlockHardwareWalletAccount (index, deviceName) {
- const keyring = await this.getKeyringForDevice(deviceName)
+ async unlockHardwareWalletAccount (index, deviceName, hdPath) {
+ const keyring = await this.getKeyringForDevice(deviceName, hdPath)
keyring.setAccountToUnlock(index)
const oldAccounts = await this.keyringController.getAccounts()