mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix UnknownFunction showing as Confirm (#5590)
This commit is contained in:
parent
7852269ed1
commit
315028ec53
@ -27,10 +27,21 @@ export function getTokenData (data = '') {
|
|||||||
|
|
||||||
const registry = new MethodRegistry({ provider: global.ethereumProvider })
|
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 = '') {
|
export async function getMethodData (data = '') {
|
||||||
const prefixedData = ethUtil.addHexPrefix(data)
|
const prefixedData = ethUtil.addHexPrefix(data)
|
||||||
const fourBytePrefix = prefixedData.slice(0, 10)
|
const fourBytePrefix = prefixedData.slice(0, 10)
|
||||||
const sig = await registry.lookup(fourBytePrefix)
|
const sig = await registry.lookup(fourBytePrefix)
|
||||||
|
|
||||||
|
if (!sig) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
const parsedResult = registry.parse(sig)
|
const parsedResult = registry.parse(sig)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user