Skip searching 4byte directory if we don't have a full 4 bytes of data (#15473)

* skip searching 4byte directory if we don't have a full 4bytes of data

* address feedback

* lint
feature/default_network_editable
Alex Donesky 2 years ago committed by GitHub
parent 7b04bf8b47
commit 0026966c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      ui/store/actions.js

@ -3257,13 +3257,14 @@ export function getContractMethodData(data = '') {
return (dispatch, getState) => {
const prefixedData = addHexPrefix(data);
const fourBytePrefix = prefixedData.slice(0, 10);
if (fourBytePrefix.length < 10) {
return Promise.resolve({});
}
const { knownMethodData } = getState().metamask;
if (
(knownMethodData &&
knownMethodData[fourBytePrefix] &&
Object.keys(knownMethodData[fourBytePrefix]).length !== 0) ||
fourBytePrefix === '0x'
knownMethodData &&
knownMethodData[fourBytePrefix] &&
Object.keys(knownMethodData[fourBytePrefix]).length !== 0
) {
return Promise.resolve(knownMethodData[fourBytePrefix]);
}

Loading…
Cancel
Save