diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-06-26 03:06:57 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-07-07 07:27:08 +0800 |
commit | e89549846fd3bd520b99740c7845f48f368c3afa (patch) | |
tree | 6e248d21c75c4336890229aaae4e07c261a59b8e /ui/app/ducks/confirm-transaction.duck.js | |
parent | ea9d51e427b8e607e612a01629bebf153e516ad9 (diff) | |
download | tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar.gz tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar.bz2 tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar.lz tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar.xz tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.tar.zst tangerine-wallet-browser-e89549846fd3bd520b99740c7845f48f368c3afa.zip |
Refactor data flow, signature request routing
Diffstat (limited to 'ui/app/ducks/confirm-transaction.duck.js')
-rw-r--r-- | ui/app/ducks/confirm-transaction.duck.js | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/ui/app/ducks/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction.duck.js index 6df1333dd..c4557bf2f 100644 --- a/ui/app/ducks/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction.duck.js @@ -284,30 +284,34 @@ export function setTransactionToConfirm (transactionId) { return } - const { lastGasPrice } = transaction - const txData = lastGasPrice ? increaseFromLastGasPrice(transaction) : transaction - dispatch(updateTxDataAndCalculate(txData)) - - const { txParams } = transaction - - if (txParams.data) { - const { tokens: existingTokens } = state - const { data, to: tokenAddress } = txParams - const tokenData = getTokenData(data) - dispatch(updateTokenData(tokenData)) - - const tokenSymbolData = await getSymbolAndDecimals(tokenAddress, existingTokens) || {} - const { symbol: tokenSymbol = '', decimals: tokenDecimals = '' } = tokenSymbolData - dispatch(updateTokenProps({ tokenSymbol, tokenDecimals })) - } + if (transaction.txParams) { + const { lastGasPrice } = transaction + const txData = lastGasPrice ? increaseFromLastGasPrice(transaction) : transaction + dispatch(updateTxDataAndCalculate(txData)) + + const { txParams } = transaction + + if (txParams.data) { + const { tokens: existingTokens } = state + const { data, to: tokenAddress } = txParams + const tokenData = getTokenData(data) + dispatch(updateTokenData(tokenData)) + + const tokenSymbolData = await getSymbolAndDecimals(tokenAddress, existingTokens) || {} + const { symbol: tokenSymbol = '', decimals: tokenDecimals = '' } = tokenSymbolData + dispatch(updateTokenProps({ tokenSymbol, tokenDecimals })) + } - if (txParams.nonce) { - const nonce = conversionUtil(txParams.nonce, { - fromNumericBase: 'hex', - toNumericBase: 'dec', - }) + if (txParams.nonce) { + const nonce = conversionUtil(txParams.nonce, { + fromNumericBase: 'hex', + toNumericBase: 'dec', + }) - dispatch(updateNonce(nonce)) + dispatch(updateNonce(nonce)) + } + } else { + dispatch(updateTxData(transaction)) } } } |