aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-10-24 23:27:16 +0800
committerGitHub <noreply@github.com>2018-10-24 23:27:16 +0800
commit315028ec53654c4ad7817741330627eae742e59d (patch)
tree2cf69de21acda8042b69e54e0678d17ae256562b
parent7852269ed156787eb279e0b55d643c4c13c04020 (diff)
downloadtangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar.gz
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar.bz2
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar.lz
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar.xz
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.tar.zst
tangerine-wallet-browser-315028ec53654c4ad7817741330627eae742e59d.zip
Fix UnknownFunction showing as Confirm (#5590)
-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 {