aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-04-25 00:01:39 +0800
committerDan <danjm.com@gmail.com>2018-04-25 00:01:39 +0800
commit02a6d2089ede7d3faf4990c40b85b9f773f82c64 (patch)
treea46c581fae872d7ced368f067b8ae7b0df0778fd /ui/app/actions.js
parent59c887301aba5d746d669441ec78ef7ec5de3146 (diff)
parent66ae4a948abbebdb513f9bd60d47fda36095e8df (diff)
downloadtangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar.gz
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar.bz2
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar.lz
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar.xz
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.tar.zst
tangerine-wallet-browser-02a6d2089ede7d3faf4990c40b85b9f773f82c64.zip
Merge branch 'master' into i3725-refactor-send-component
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js59
1 files changed, 30 insertions, 29 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 4ac553812..674669eed 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -3,6 +3,7 @@ const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url')
const { getTokenAddressFromTokenObject } = require('./util')
const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
+const log = require('loglevel')
var actions = {
_setBackgroundConnection: _setBackgroundConnection,
@@ -222,8 +223,6 @@ var actions = {
coinBaseSubview: coinBaseSubview,
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
shapeShiftSubview: shapeShiftSubview,
- UPDATE_TOKEN_EXCHANGE_RATE: 'UPDATE_TOKEN_EXCHANGE_RATE',
- updateTokenExchangeRate,
PAIR_UPDATE: 'PAIR_UPDATE',
pairUpdate: pairUpdate,
coinShiftRquest: coinShiftRquest,
@@ -348,13 +347,11 @@ function transitionBackward () {
}
}
-function confirmSeedWords () {
+function clearSeedWordCache () {
+ log.debug(`background.clearSeedWordCache`)
return dispatch => {
- dispatch(actions.showLoadingIndication())
- log.debug(`background.clearSeedWordCache`)
return new Promise((resolve, reject) => {
background.clearSeedWordCache((err, account) => {
- dispatch(actions.hideLoadingIndication())
if (err) {
dispatch(actions.displayWarning(err.message))
return reject(err)
@@ -368,6 +365,22 @@ function confirmSeedWords () {
}
}
+function confirmSeedWords () {
+ return async dispatch => {
+ dispatch(actions.showLoadingIndication())
+ const account = await dispatch(clearSeedWordCache())
+ return dispatch(setIsRevealingSeedWords(false))
+ .then(() => {
+ dispatch(actions.hideLoadingIndication())
+ return account
+ })
+ .catch(() => {
+ dispatch(actions.hideLoadingIndication())
+ return account
+ })
+ }
+}
+
function createNewVaultAndRestore (password, seed) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@@ -449,11 +462,13 @@ function requestRevealSeed (password) {
}
dispatch(actions.showNewVaultSeed(result))
- dispatch(actions.hideLoadingIndication())
resolve()
})
})
})
+ .then(() => dispatch(setIsRevealingSeedWords(true)))
+ .then(() => dispatch(actions.hideLoadingIndication()))
+ .catch(() => dispatch(actions.hideLoadingIndication()))
}
}
@@ -1753,28 +1768,6 @@ function shapeShiftRequest (query, options, cb) {
}
}
-function updateTokenExchangeRate (token = '') {
- const pair = `${token.toLowerCase()}_eth`
-
- return dispatch => {
- if (!token) {
- return
- }
-
- shapeShiftRequest('marketinfo', { pair }, marketinfo => {
- if (!marketinfo.error) {
- dispatch({
- type: actions.UPDATE_TOKEN_EXCHANGE_RATE,
- payload: {
- pair,
- marketinfo,
- },
- })
- }
- })
- }
-}
-
function setFeatureFlag (feature, activated, notificationType) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@@ -1932,3 +1925,11 @@ function updateNetworkEndpointType (networkEndpointType) {
value: networkEndpointType,
}
}
+
+function setIsRevealingSeedWords (reveal) {
+ return dispatch => {
+ log.debug(`background.setIsRevealingSeedWords`)
+ background.setIsRevealingSeedWords(reveal)
+ return forceUpdateMetamaskState(dispatch)
+ }
+}