|
|
@ -16,10 +16,6 @@ var actions = { |
|
|
|
SHOW_INIT_MENU: 'SHOW_INIT_MENU', |
|
|
|
SHOW_INIT_MENU: 'SHOW_INIT_MENU', |
|
|
|
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED', |
|
|
|
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED', |
|
|
|
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE', |
|
|
|
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE', |
|
|
|
RECOVER_FROM_SEED: 'RECOVER_FROM_SEED', |
|
|
|
|
|
|
|
CLEAR_SEED_WORD_CACHE: 'CLEAR_SEED_WORD_CACHE', |
|
|
|
|
|
|
|
clearSeedWordCache: clearSeedWordCache, |
|
|
|
|
|
|
|
recoverFromSeed: recoverFromSeed, |
|
|
|
|
|
|
|
unlockMetamask: unlockMetamask, |
|
|
|
unlockMetamask: unlockMetamask, |
|
|
|
unlockFailed: unlockFailed, |
|
|
|
unlockFailed: unlockFailed, |
|
|
|
showCreateVault: showCreateVault, |
|
|
|
showCreateVault: showCreateVault, |
|
|
@ -29,10 +25,6 @@ var actions = { |
|
|
|
createNewVaultInProgress: createNewVaultInProgress, |
|
|
|
createNewVaultInProgress: createNewVaultInProgress, |
|
|
|
showNewVaultSeed: showNewVaultSeed, |
|
|
|
showNewVaultSeed: showNewVaultSeed, |
|
|
|
showInfoPage: showInfoPage, |
|
|
|
showInfoPage: showInfoPage, |
|
|
|
// seed recovery actions
|
|
|
|
|
|
|
|
REVEAL_SEED_CONFIRMATION: 'REVEAL_SEED_CONFIRMATION', |
|
|
|
|
|
|
|
revealSeedConfirmation: revealSeedConfirmation, |
|
|
|
|
|
|
|
requestRevealSeed: requestRevealSeed, |
|
|
|
|
|
|
|
// unlock screen
|
|
|
|
// unlock screen
|
|
|
|
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', |
|
|
|
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', |
|
|
|
UNLOCK_FAILED: 'UNLOCK_FAILED', |
|
|
|
UNLOCK_FAILED: 'UNLOCK_FAILED', |
|
|
@ -95,7 +87,6 @@ var actions = { |
|
|
|
backToAccountDetail: backToAccountDetail, |
|
|
|
backToAccountDetail: backToAccountDetail, |
|
|
|
showAccountsPage: showAccountsPage, |
|
|
|
showAccountsPage: showAccountsPage, |
|
|
|
showConfTxPage: showConfTxPage, |
|
|
|
showConfTxPage: showConfTxPage, |
|
|
|
confirmSeedWords: confirmSeedWords, |
|
|
|
|
|
|
|
// config screen
|
|
|
|
// config screen
|
|
|
|
SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE', |
|
|
|
SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE', |
|
|
|
SET_RPC_TARGET: 'SET_RPC_TARGET', |
|
|
|
SET_RPC_TARGET: 'SET_RPC_TARGET', |
|
|
@ -182,41 +173,7 @@ function createNewVault (password, entropy) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
return dispatch(actions.showWarning(err.message)) |
|
|
|
return dispatch(actions.showWarning(err.message)) |
|
|
|
} |
|
|
|
} |
|
|
|
dispatch(actions.showNewVaultSeed(result)) |
|
|
|
dispatch(actions.goHome()) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function revealSeedConfirmation () { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
type: this.REVEAL_SEED_CONFIRMATION, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function requestRevealSeed (password) { |
|
|
|
|
|
|
|
return (dispatch) => { |
|
|
|
|
|
|
|
dispatch(actions.showLoadingIndication()) |
|
|
|
|
|
|
|
_accountManager.tryPassword(password, (err, seed) => { |
|
|
|
|
|
|
|
dispatch(actions.hideLoadingIndication()) |
|
|
|
|
|
|
|
if (err) return dispatch(actions.displayWarning(err.message)) |
|
|
|
|
|
|
|
_accountManager.recoverSeed((err, seed) => { |
|
|
|
|
|
|
|
if (err) return dispatch(actions.displayWarning(err.message)) |
|
|
|
|
|
|
|
dispatch(actions.showNewVaultSeed(seed)) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function recoverFromSeed (password, seed) { |
|
|
|
|
|
|
|
return (dispatch) => { |
|
|
|
|
|
|
|
// dispatch(actions.createNewVaultInProgress())
|
|
|
|
|
|
|
|
dispatch(actions.showLoadingIndication()) |
|
|
|
|
|
|
|
_accountManager.recoverFromSeed(password, seed, (err, metamaskState) => { |
|
|
|
|
|
|
|
dispatch(actions.hideLoadingIndication()) |
|
|
|
|
|
|
|
if (err) return dispatch(actions.displayWarning(err.message)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var account = Object.keys(metamaskState.identities)[0] |
|
|
|
|
|
|
|
dispatch(actions.unlockMetamask(account)) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -451,27 +408,6 @@ function backToAccountDetail (address) { |
|
|
|
value: address, |
|
|
|
value: address, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function clearSeedWordCache (account) { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
type: actions.CLEAR_SEED_WORD_CACHE, |
|
|
|
|
|
|
|
value: account, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function confirmSeedWords () { |
|
|
|
|
|
|
|
return (dispatch) => { |
|
|
|
|
|
|
|
dispatch(actions.showLoadingIndication()) |
|
|
|
|
|
|
|
_accountManager.clearSeedWordCache((err, account) => { |
|
|
|
|
|
|
|
dispatch(actions.hideLoadingIndication()) |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
return dispatch(actions.showWarning(err.message)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Seed word cache cleared. ' + account) |
|
|
|
|
|
|
|
dispatch(actions.showAccountDetail(account)) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showAccountsPage () { |
|
|
|
function showAccountsPage () { |
|
|
|
return { |
|
|
|
return { |
|
|
|