diff options
author | Dan J Miller <danjm.com@gmail.com> | 2019-04-29 14:18:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 14:18:40 +0800 |
commit | 4fea9d0cc2ec9c6914931d5e310665aca8e273b6 (patch) | |
tree | c2ff2c9bdb90179c5583cd59a1e77631c25f3a35 /ui | |
parent | 00958894087a9af845f3746de6698130facd7654 (diff) | |
download | tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar.gz tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar.bz2 tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar.lz tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar.xz tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.tar.zst tangerine-wallet-browser-4fea9d0cc2ec9c6914931d5e310665aca8e273b6.zip |
Send metrics event from backend for on chain transaction failures (#6500)
* Send metrics event from backend for on chain transaction failures
* Passes state object to backEndMetaMetricsEvent, and adds getMetaMetricState selector
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/ducks/confirm-transaction/confirm-transaction.duck.js | 2 | ||||
-rw-r--r-- | ui/app/helpers/utils/metametrics.util.js | 4 | ||||
-rw-r--r-- | ui/app/selectors/selectors.js | 15 |
3 files changed, 17 insertions, 4 deletions
diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js index 169c9d543..58b0ec8e8 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js @@ -375,7 +375,7 @@ export function setTransactionToConfirm (transactionId) { dispatch(updateMethodData(methodData)) try { - const toSmartContract = await isSmartContractAddress(to) + const toSmartContract = await isSmartContractAddress(to || '') dispatch(updateToSmartContract(toSmartContract)) } catch (error) { log.error(error) diff --git a/ui/app/helpers/utils/metametrics.util.js b/ui/app/helpers/utils/metametrics.util.js index 5ae3e8937..62f5fd760 100644 --- a/ui/app/helpers/utils/metametrics.util.js +++ b/ui/app/helpers/utils/metametrics.util.js @@ -124,10 +124,10 @@ function composeUrl (config, permissionPreferences = {}) { numberOfTokens: customVariables && customVariables.numberOfTokens || numberOfTokens, numberOfAccounts: customVariables && customVariables.numberOfAccounts || numberOfAccounts, }) : '' - const url = configUrl || `&url=${encodeURIComponent(currentPath.replace(/chrome-extension:\/\/\w+/, METAMETRICS_TRACKING_URL))}` + const url = configUrl || currentPath ? `&url=${encodeURIComponent(currentPath.replace(/chrome-extension:\/\/\w+/, METAMETRICS_TRACKING_URL))}` : '' const _id = metaMetricsId && !excludeMetaMetricsId ? `&_id=${metaMetricsId.slice(2, 18)}` : '' const rand = `&rand=${String(Math.random()).slice(2)}` - const pv_id = `&pv_id=${ethUtil.bufferToHex(ethUtil.sha3(url || currentPath.match(/chrome-extension:\/\/\w+\/(.+)/)[0])).slice(2, 8)}` + const pv_id = (url || currentPath) && `&pv_id=${ethUtil.bufferToHex(ethUtil.sha3(url || currentPath.match(/chrome-extension:\/\/\w+\/(.+)/)[0])).slice(2, 8)}` || '' const uid = metaMetricsId && !excludeMetaMetricsId ? `&uid=${metaMetricsId.slice(2, 18)}` : excludeMetaMetricsId diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 2d25aa156..ce02d067e 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -48,6 +48,7 @@ const selectors = { getNumberOfAccounts, getNumberOfTokens, isEthereumNetwork, + getMetaMetricState, } module.exports = selectors @@ -165,7 +166,7 @@ function getSelectedToken (state) { const tokens = state.metamask.tokens || [] const selectedTokenAddress = state.metamask.selectedTokenAddress const selectedToken = tokens.filter(({ address }) => address === selectedTokenAddress)[0] - const sendToken = state.metamask.send.token + const sendToken = state.metamask.send && state.metamask.send.token return selectedToken || sendToken || null } @@ -314,3 +315,15 @@ function preferencesSelector ({ metamask }) { function getAdvancedInlineGasShown (state) { return Boolean(state.metamask.featureFlags.advancedInlineGas) } + +function getMetaMetricState (state) { + return { + network: getCurrentNetworkId(state), + activeCurrency: getSelectedAsset(state), + accountType: getAccountType(state), + metaMetricsId: state.metamask.metaMetricsId, + numberOfTokens: getNumberOfTokens(state), + numberOfAccounts: getNumberOfAccounts(state), + participateInMetaMetrics: state.metamask.participateInMetaMetrics, + } +} |