aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/transactions.util.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-10-26 10:24:30 +0800
committerkumavis <aaron@kumavis.me>2018-10-26 10:24:30 +0800
commit9b42416fc0d92662d1a21759db357e7f439d7a7b (patch)
tree4fb658d739a7127d4c18a22b4abe556bfc3a194e /ui/app/helpers/transactions.util.js
parent9b501b7c42ebebb61ac3130d1e84d36efcac9b7e (diff)
parent55c66b0d988fac6b2ed5948cf4dcd20fd486070e (diff)
downloadtangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar.gz
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar.bz2
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar.lz
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar.xz
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.tar.zst
tangerine-wallet-browser-9b42416fc0d92662d1a21759db357e7f439d7a7b.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into HowardBraham-develop
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 cfe2c4229..2f4b1d095 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 {