diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-01-20 02:58:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-20 02:58:33 +0800 |
commit | a09332f9379400204cae885345a8fd975e887098 (patch) | |
tree | 253ad8b40a129b85e7603d43d9edb5b650dbbeb4 /ui/app/actions.js | |
parent | 29cbfd1ea28e4408dd79cb1b2769b53ba01913c4 (diff) | |
parent | b478ce5b778bd70a3ebfc89f2c680daa25a6f395 (diff) | |
download | tangerine-wallet-browser-a09332f9379400204cae885345a8fd975e887098.tar.gz tangerine-wallet-browser-a09332f9379400204cae885345a8fd975e887098.tar.zst tangerine-wallet-browser-a09332f9379400204cae885345a8fd975e887098.zip |
Merge pull request #1029 from MetaMask/i715-AddJsonImport
Add JSON file account import
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 7934a329a..bf3617310 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -43,6 +43,7 @@ var actions = { createNewVaultAndRestore: createNewVaultAndRestore, createNewVaultInProgress: createNewVaultInProgress, addNewKeyring, + importNewAccount, addNewAccount, NEW_ACCOUNT_SCREEN: 'NEW_ACCOUNT_SCREEN', navigateToNewAccountScreen, @@ -264,6 +265,21 @@ function addNewKeyring (type, opts) { } } +function importNewAccount (strategy, args) { + return (dispatch) => { + dispatch(actions.showLoadingIndication('This may take a while, be patient.')) + background.importAccountWithStrategy(strategy, args, (err, newState) => { + dispatch(actions.hideLoadingIndication()) + if (err) return dispatch(actions.displayWarning(err.message)) + dispatch(actions.updateMetamaskState(newState)) + dispatch({ + type: actions.SHOW_ACCOUNT_DETAIL, + value: newState.selectedAccount, + }) + }) + } +} + function navigateToNewAccountScreen() { return { type: this.NEW_ACCOUNT_SCREEN, @@ -614,9 +630,10 @@ function useEtherscanProvider () { } } -function showLoadingIndication () { +function showLoadingIndication (message) { return { type: actions.SHOW_LOADING, + value: message, } } |