|
|
@ -20,7 +20,6 @@ class ThreeBoxController { |
|
|
|
addressBookController, |
|
|
|
addressBookController, |
|
|
|
version, |
|
|
|
version, |
|
|
|
getKeyringControllerState, |
|
|
|
getKeyringControllerState, |
|
|
|
getSelectedAddress, |
|
|
|
|
|
|
|
} = opts |
|
|
|
} = opts |
|
|
|
|
|
|
|
|
|
|
|
this.preferencesController = preferencesController |
|
|
|
this.preferencesController = preferencesController |
|
|
@ -32,18 +31,20 @@ class ThreeBoxController { |
|
|
|
if (origin !== '3Box') { return [] } |
|
|
|
if (origin !== '3Box') { return [] } |
|
|
|
const isUnlocked = getKeyringControllerState().isUnlocked |
|
|
|
const isUnlocked = getKeyringControllerState().isUnlocked |
|
|
|
|
|
|
|
|
|
|
|
const selectedAddress = getSelectedAddress() |
|
|
|
const accounts = await this.keyringController.getAccounts() |
|
|
|
|
|
|
|
|
|
|
|
if (isUnlocked && selectedAddress) { |
|
|
|
if (isUnlocked && accounts[0]) { |
|
|
|
return [selectedAddress] |
|
|
|
const appKeyAddress = await this.keyringController.getAppKeyAddress(accounts[0], 'wallet://3box.metamask.io') |
|
|
|
|
|
|
|
return [appKeyAddress] |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return [] |
|
|
|
return [] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
processPersonalMessage: (msgParams) => { |
|
|
|
processPersonalMessage: async (msgParams) => { |
|
|
|
return Promise.resolve(keyringController.signPersonalMessage(msgParams, { |
|
|
|
const accounts = await this.keyringController.getAccounts() |
|
|
|
|
|
|
|
return keyringController.signPersonalMessage({ ...msgParams, from: accounts[0] }, { |
|
|
|
withAppKeyOrigin: 'wallet://3box.metamask.io', |
|
|
|
withAppKeyOrigin: 'wallet://3box.metamask.io', |
|
|
|
})) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|