aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/transactions.util.js
diff options
context:
space:
mode:
authorhackyminer <hackyminer@gmail.com>2018-10-26 19:37:35 +0800
committerhackyminer <hackyminer@gmail.com>2018-10-26 19:37:35 +0800
commitbc7f8d0a5bf42b73ee1d1102362fc0a94dc80c0d (patch)
tree96fc1c969b49c66081ff1a042a6e2e3e787723c7 /ui/app/helpers/transactions.util.js
parentb62d07f3a5bdfde7e295f17b7f601c6f2d5314ef (diff)
parent54a8ade2669cb5f8f046509873bc2a9c25425847 (diff)
downloadtangerine-wallet-browser-bc7f8d0a5bf42b73ee1d1102362fc0a94dc80c0d.tar.gz
tangerine-wallet-browser-bc7f8d0a5bf42b73ee1d1102362fc0a94dc80c0d.tar.zst
tangerine-wallet-browser-bc7f8d0a5bf42b73ee1d1102362fc0a94dc80c0d.zip
Merge branch 'develop' into eth_chainid
Diffstat (limited to 'ui/app/helpers/transactions.util.js')
-rw-r--r--ui/app/helpers/transactions.util.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js
index e50196196..64ec82225 100644
--- a/ui/app/helpers/transactions.util.js
+++ b/ui/app/helpers/transactions.util.js
@@ -27,10 +27,21 @@ export function getTokenData (data = '') {
const registry = new MethodRegistry({ provider: global.ethereumProvider })
+/**
+ * Attempts to return the method data from the MethodRegistry library, if the method exists in the
+ * registry. Otherwise, returns an empty object.
+ * @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 {}
+ }
+
const parsedResult = registry.parse(sig)
return {