aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-24 02:33:15 +0800
committerDan <danjm.com@gmail.com>2018-05-24 02:33:15 +0800
commit440905125d77d1d5d72d1aceac2940925a8ac38f (patch)
treed5418384983f9de8092d2dfdd1ddddec2ffd555e /ui/app/actions.js
parent3dec7cb52443b24d6a24f75434ee41a54f4cfd0b (diff)
parented01c6c8264a860cdc4248991839954bdf22e2ef (diff)
downloadtangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.gz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.bz2
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.lz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.xz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.zst
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.zip
Merge branch 'develop' into i3725-refactor-send-component-
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js51
1 files changed, 28 insertions, 23 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 8b9928d5b..071f56209 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -129,8 +129,8 @@ var actions = {
SHOW_PRIVATE_KEY: 'SHOW_PRIVATE_KEY',
showPrivateKey: showPrivateKey,
exportAccountComplete,
- SAVE_ACCOUNT_LABEL: 'SAVE_ACCOUNT_LABEL',
- saveAccountLabel: saveAccountLabel,
+ SET_ACCOUNT_LABEL: 'SET_ACCOUNT_LABEL',
+ setAccountLabel,
// tx conf screen
COMPLETED_TX: 'COMPLETED_TX',
TRANSACTION_ERROR: 'TRANSACTION_ERROR',
@@ -280,11 +280,14 @@ var actions = {
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
// Network
- setNetworkEndpoints,
updateNetworkEndpointType,
UPDATE_NETWORK_ENDPOINT_TYPE: 'UPDATE_NETWORK_ENDPOINT_TYPE',
retryTransaction,
+ SET_PENDING_TOKENS: 'SET_PENDING_TOKENS',
+ CLEAR_PENDING_TOKENS: 'CLEAR_PENDING_TOKENS',
+ setPendingTokens,
+ clearPendingTokens,
}
module.exports = actions
@@ -1651,13 +1654,13 @@ function showPrivateKey (key) {
}
}
-function saveAccountLabel (account, label) {
+function setAccountLabel (account, label) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
- log.debug(`background.saveAccountLabel`)
+ log.debug(`background.setAccountLabel`)
return new Promise((resolve, reject) => {
- background.saveAccountLabel(account, label, (err) => {
+ background.setAccountLabel(account, label, (err) => {
dispatch(actions.hideLoadingIndication())
if (err) {
@@ -1666,7 +1669,7 @@ function saveAccountLabel (account, label) {
}
dispatch({
- type: actions.SAVE_ACCOUNT_LABEL,
+ type: actions.SET_ACCOUNT_LABEL,
value: { account, label },
})
@@ -1976,26 +1979,28 @@ function setLocaleMessages (localeMessages) {
}
}
-function setNetworkEndpoints (networkEndpointType) {
- return dispatch => {
- log.debug('background.setNetworkEndpoints')
- return new Promise((resolve, reject) => {
- background.setNetworkEndpoints(networkEndpointType, err => {
- if (err) {
- dispatch(actions.displayWarning(err.message))
- return reject(err)
- }
+function updateNetworkEndpointType (networkEndpointType) {
+ return {
+ type: actions.UPDATE_NETWORK_ENDPOINT_TYPE,
+ value: networkEndpointType,
+ }
+}
- dispatch(actions.updateNetworkEndpointType(networkEndpointType))
- resolve(networkEndpointType)
- })
- })
+function setPendingTokens (pendingTokens) {
+ const { customToken = {}, selectedTokens = {} } = pendingTokens
+ const { address, symbol, decimals } = customToken
+ const tokens = address && symbol && decimals
+ ? { ...selectedTokens, [address]: { ...customToken, isCustom: true } }
+ : selectedTokens
+
+ return {
+ type: actions.SET_PENDING_TOKENS,
+ payload: tokens,
}
}
-function updateNetworkEndpointType (networkEndpointType) {
+function clearPendingTokens () {
return {
- type: actions.UPDATE_NETWORK_ENDPOINT_TYPE,
- value: networkEndpointType,
+ type: actions.CLEAR_PENDING_TOKENS,
}
}