1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
This commit is contained in:
Bruno 2018-06-13 02:09:25 -04:00
parent bb4cc72646
commit 704e2a21f8

View File

@ -131,7 +131,7 @@ module.exports = class MetamaskController extends EventEmitter {
provider: this.provider, provider: this.provider,
blockTracker: this.blockTracker, blockTracker: this.blockTracker,
}) })
// key mgmt // key mgmt
const additionalKeyrings = [TrezorKeyring] const additionalKeyrings = [TrezorKeyring]
this.keyringController = new KeyringController({ this.keyringController = new KeyringController({
@ -423,7 +423,6 @@ module.exports = class MetamaskController extends EventEmitter {
} }
//============================================================================= //=============================================================================
// VAULT / KEYRING RELATED METHODS // VAULT / KEYRING RELATED METHODS
//============================================================================= //=============================================================================
@ -537,19 +536,23 @@ module.exports = class MetamaskController extends EventEmitter {
*/ */
async connectHardware (deviceName, page) { async connectHardware (deviceName, page) {
const keyringController = this.keyringController switch (deviceName) {
const keyring = await keyringController.getKeyringsByType( case 'trezor':
'Trezor Hardware' const keyringController = this.keyringController
)[0] const keyring = await keyringController.getKeyringsByType(
if (!keyring) { 'Trezor Hardware'
throw new Error('MetamaskController - No Trezor Hardware Keyring found') )[0]
if (!keyring) {
throw new Error('MetamaskController - No Trezor Hardware Keyring found')
}
const accounts = await keyring.getPage(page)
this.accountTracker.syncWithAddresses(accounts.map(a => a.address))
return accounts
default:
throw new Error('MetamaskController - Unknown device')
} }
const accounts = await keyring.getPage(page)
this.accountTracker.syncWithAddresses(accounts.map(a => a.address))
return accounts
} }
/** /**
@ -581,7 +584,7 @@ module.exports = class MetamaskController extends EventEmitter {
const { identities } = this.preferencesController.store.getState() const { identities } = this.preferencesController.store.getState()
return { ...keyState, identities } return { ...keyState, identities }
} }
// //
// Account Management // Account Management
@ -1037,7 +1040,7 @@ module.exports = class MetamaskController extends EventEmitter {
* Allows a user to begin the seed phrase recovery process. * Allows a user to begin the seed phrase recovery process.
* @param {Function} cb - A callback function called when complete. * @param {Function} cb - A callback function called when complete.
*/ */
markPasswordForgotten(cb) { markPasswordForgotten (cb) {
this.configManager.setPasswordForgotten(true) this.configManager.setPasswordForgotten(true)
this.sendUpdate() this.sendUpdate()
cb() cb()
@ -1047,7 +1050,7 @@ module.exports = class MetamaskController extends EventEmitter {
* Allows a user to end the seed phrase recovery process. * Allows a user to end the seed phrase recovery process.
* @param {Function} cb - A callback function called when complete. * @param {Function} cb - A callback function called when complete.
*/ */
unMarkPasswordForgotten(cb) { unMarkPasswordForgotten (cb) {
this.configManager.setPasswordForgotten(false) this.configManager.setPasswordForgotten(false)
this.sendUpdate() this.sendUpdate()
cb() cb()