aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors/selectors.js
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2019-06-18 20:17:14 +0800
committerDan J Miller <danjm.com@gmail.com>2019-06-18 20:17:14 +0800
commit748801f4179d353959f40049cf6ca27851eebd0e (patch)
tree5aa626393b14156281a1468d8dc0dfb135746517 /ui/app/selectors/selectors.js
parent2ff184d77ee33dc1c06256f160c97be714feec62 (diff)
downloadtangerine-wallet-browser-748801f4179d353959f40049cf6ca27851eebd0e.tar.gz
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/selectors/selectors.js')
-rw-r--r--ui/app/selectors/selectors.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js
index c7cb80024..56591b7b0 100644
--- a/ui/app/selectors/selectors.js
+++ b/ui/app/selectors/selectors.js
@@ -1,5 +1,6 @@
import { NETWORK_TYPES } from '../helpers/constants/common'
-import { stripHexPrefix } from 'ethereumjs-util'
+import { stripHexPrefix, addHexPrefix } from 'ethereumjs-util'
+
const abi = require('human-standard-token-abi')
import {
@@ -50,6 +51,7 @@ const selectors = {
isEthereumNetwork,
getMetaMetricState,
getRpcPrefsForCurrentProvider,
+ getKnownMethodData,
}
module.exports = selectors
@@ -335,3 +337,14 @@ function getRpcPrefsForCurrentProvider (state) {
const { rpcPrefs = {} } = selectRpcInfo || {}
return rpcPrefs
}
+
+function getKnownMethodData (state, data) {
+ if (!data) {
+ return null
+ }
+ const prefixedData = addHexPrefix(data)
+ const fourBytePrefix = prefixedData.slice(0, 10)
+ const { knownMethodData } = state.metamask
+
+ return knownMethodData && knownMethodData[fourBytePrefix]
+}