diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-06-18 20:17:14 +0800 |
---|---|---|
committer | Dan J Miller <danjm.com@gmail.com> | 2019-06-18 20:17:14 +0800 |
commit | 748801f4179d353959f40049cf6ca27851eebd0e (patch) | |
tree | 5aa626393b14156281a1468d8dc0dfb135746517 /ui/app/ducks/confirm-transaction | |
parent | 2ff184d77ee33dc1c06256f160c97be714feec62 (diff) | |
download | tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.gz tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.bz2 tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.lz tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.xz tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.zst tangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.zip |
4byte fallback (#6551)
* Adds 4byte registry fallback to getMethodData() (#6435)
* Adds fetchWithCache to guard against unnecessary API calls
* Add custom fetch wrapper with abort on timeout
* Use opts and cacheRefreshTime in fetch-with-cache util
* Use custom fetch wrapper with timeout for fetch-with-cache
* Improve contract method data fetching (#6623)
* Remove async call from getTransactionActionKey()
* Stop blocking confirm screen rendering on method data loading, and base screen route on transactionCategory
* Remove use of withMethodData, fix use of knownMethodData, in relation to transaction-list-item.component
* Load data contract method data progressively, making it non-blocking; requires simplifying conf-tx-base lifecycle logic.
* Allow editing of gas price while loading on the confirm screen.
* Fix transactionAction component and its unit tests.
* Fix confirm transaction components for cases of route transitions within metamask.
* Only call toString on id if truthy in getNavigateTxData()
* Fix knownMethodData retrieval and data fetching from fourbyte
Diffstat (limited to 'ui/app/ducks/confirm-transaction')
-rw-r--r-- | ui/app/ducks/confirm-transaction/confirm-transaction.duck.js | 28 | ||||
-rw-r--r-- | ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js | 11 |
2 files changed, 6 insertions, 33 deletions
diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js index 58b0ec8e8..b8d1a7e81 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js @@ -1,4 +1,3 @@ -import log from 'loglevel' import { conversionRateSelector, currentCurrencySelector, @@ -18,12 +17,9 @@ import { import { getTokenData, - getMethodData, - isSmartContractAddress, sumHexes, } from '../../helpers/utils/transactions.util' -import { getSymbolAndDecimals } from '../../helpers/utils/token-util' import { conversionUtil } from '../../helpers/utils/conversion-util' import { addHexPrefix } from 'ethereumjs-util' @@ -348,7 +344,7 @@ export function updateTxDataAndCalculate (txData) { } export function setTransactionToConfirm (transactionId) { - return async (dispatch, getState) => { + return (dispatch, getState) => { const state = getState() const unconfirmedTransactionsHash = unconfirmedTransactionsHashSelector(state) const transaction = unconfirmedTransactionsHash[transactionId] @@ -364,34 +360,14 @@ export function setTransactionToConfirm (transactionId) { dispatch(updateTxDataAndCalculate(txData)) const { txParams } = transaction - const { to } = txParams if (txParams.data) { - const { tokens: existingTokens } = state - const { data, to: tokenAddress } = txParams - - dispatch(setFetchingData(true)) - const methodData = await getMethodData(data) - dispatch(updateMethodData(methodData)) + const { data } = txParams - try { - const toSmartContract = await isSmartContractAddress(to || '') - dispatch(updateToSmartContract(toSmartContract)) - } catch (error) { - log.error(error) - } - dispatch(setFetchingData(false)) const tokenData = getTokenData(data) dispatch(updateTokenData(tokenData)) - try { - const tokenSymbolData = await getSymbolAndDecimals(tokenAddress, existingTokens) || {} - const { symbol: tokenSymbol = '', decimals: tokenDecimals = '' } = tokenSymbolData - dispatch(updateTokenProps({ tokenSymbol, tokenDecimals })) - } catch (error) { - dispatch(updateTokenProps({ tokenSymbol: '', tokenDecimals: '' })) - } } if (txParams.nonce) { diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js index d2e344663..9e26314e5 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js @@ -630,7 +630,7 @@ describe('Confirm Transaction Duck', () => { storeActions.forEach((action, index) => assert.equal(action.type, expectedActions[index])) }) - it('updates confirmTransaction transaction', done => { + it('updates confirmTransaction transaction', () => { const mockState = { metamask: { conversionRate: 468.58, @@ -673,13 +673,10 @@ describe('Confirm Transaction Duck', () => { ] store.dispatch(actions.setTransactionToConfirm(2603411941761054)) - .then(() => { - const storeActions = store.getActions() - assert.equal(storeActions.length, expectedActions.length) + const storeActions = store.getActions() + assert.equal(storeActions.length, expectedActions.length) - storeActions.forEach((action, index) => assert.equal(action.type, expectedActions[index])) - done() - }) + storeActions.forEach((action, index) => assert.equal(action.type, expectedActions[index])) }) }) }) |