diff options
author | kumavis <aaron@kumavis.me> | 2018-10-30 08:25:05 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-10-30 08:25:05 +0800 |
commit | ccbc2332829569b6bb416ced624ee3123c54b939 (patch) | |
tree | b865d8b499a00921b4b38f2839dfc6c631aa4666 /ui/app/helpers/transactions.util.js | |
parent | f0602ca354a6d352c13a79a1cba884f54e5b9a83 (diff) | |
parent | 1bb4a8428c73c1f1137793b25900db159eec3fa8 (diff) | |
download | tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.gz tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.zst tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.zip |
Merge branch 'develop' of github.com:MetaMask/metamask-extension into sentry-enhancements2
Diffstat (limited to 'ui/app/helpers/transactions.util.js')
-rw-r--r-- | ui/app/helpers/transactions.util.js | 11 |
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 { |