aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-01-20 02:58:33 +0800
committerGitHub <noreply@github.com>2017-01-20 02:58:33 +0800
commita09332f9379400204cae885345a8fd975e887098 (patch)
tree253ad8b40a129b85e7603d43d9edb5b650dbbeb4 /ui/app/actions.js
parent29cbfd1ea28e4408dd79cb1b2769b53ba01913c4 (diff)
parentb478ce5b778bd70a3ebfc89f2c680daa25a6f395 (diff)
downloadtangerine-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.js19
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,
}
}