diff options
author | Dan J Miller <danjm.com@gmail.com> | 2019-03-29 22:48:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-29 22:48:08 +0800 |
commit | 19c2b298f13c088553e3498ef4425fb66df04098 (patch) | |
tree | b77f121fbe4ff0ec0fe95cdad56176df1d7402f6 /ui/app | |
parent | 125a95ba711f110cec40b79eafc798a31413eef3 (diff) | |
download | tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar.gz tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar.bz2 tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar.lz tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar.xz tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.tar.zst tangerine-wallet-browser-19c2b298f13c088553e3498ef4425fb66df04098.zip |
Further e2e fixes in wake of #6364 and #6367 (#6374)
* getMethodData() default to abi decoded method if registry lookup errors
* Update e2e tests to work with getMethodData() fallback changes
* Remove indeterminency in gas input key entering in send token e2e test.
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/ducks/confirm-transaction/confirm-transaction.duck.js | 17 | ||||
-rw-r--r-- | ui/app/helpers/utils/transactions.util.js | 37 |
2 files changed, 30 insertions, 24 deletions
diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js index 4edf8a70c..169c9d543 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js @@ -1,3 +1,4 @@ +import log from 'loglevel' import { conversionRateSelector, currentCurrencySelector, @@ -369,23 +370,17 @@ export function setTransactionToConfirm (transactionId) { const { tokens: existingTokens } = state const { data, to: tokenAddress } = txParams - try { - dispatch(setFetchingData(true)) - const methodData = await getMethodData(data) - - dispatch(updateMethodData(methodData)) - } catch (error) { - dispatch(updateMethodData({})) - dispatch(setFetchingData(false)) - } + dispatch(setFetchingData(true)) + const methodData = await getMethodData(data) + dispatch(updateMethodData(methodData)) try { const toSmartContract = await isSmartContractAddress(to) dispatch(updateToSmartContract(toSmartContract)) - dispatch(setFetchingData(false)) } catch (error) { - dispatch(setFetchingData(false)) + log.error(error) } + dispatch(setFetchingData(false)) const tokenData = getTokenData(data) dispatch(updateTokenData(tokenData)) diff --git a/ui/app/helpers/utils/transactions.util.js b/ui/app/helpers/utils/transactions.util.js index edf2e24f6..cb6c9536c 100644 --- a/ui/app/helpers/utils/transactions.util.js +++ b/ui/app/helpers/utils/transactions.util.js @@ -21,6 +21,7 @@ import { CANCEL_ATTEMPT_ACTION_KEY, } from '../constants/transactions' +import log from 'loglevel' import { addCurrencies } from './conversion-util' abiDecoder.addABI(abi) @@ -37,21 +38,31 @@ const registry = new MethodRegistry({ provider: global.ethereumProvider }) * @param {string} data - The hex data (@code txParams.data) of a transaction * @returns {Object} */ -export async function getMethodData (data = '') { - const prefixedData = ethUtil.addHexPrefix(data) - const fourBytePrefix = prefixedData.slice(0, 10) - const sig = await registry.lookup(fourBytePrefix) - - if (!sig) { - return {} - } + export async function getMethodData (data = '') { + const prefixedData = ethUtil.addHexPrefix(data) + const fourBytePrefix = prefixedData.slice(0, 10) + + try { + const sig = await registry.lookup(fourBytePrefix) + + if (!sig) { + return {} + } + + const parsedResult = registry.parse(sig) + + return { + name: parsedResult.name, + params: parsedResult.args, + } + } catch (error) { + log.error(error) + const contractData = getTokenData(data) + const { name } = contractData || {} + return { name } + } - const parsedResult = registry.parse(sig) - return { - name: parsedResult.name, - params: parsedResult.args, - } } export function isConfirmDeployContract (txData = {}) { |