Dont try to fetch 4bytes again in case of network errors
This commit is contained in:
parent
d09fe7a023
commit
682549fa4c
@ -53,23 +53,29 @@ const fourBytesFetcher =
|
|||||||
const fourBytes = key.slice(2);
|
const fourBytes = key.slice(2);
|
||||||
const signatureURL = fourBytesURL(assetsURLPrefix, fourBytes);
|
const signatureURL = fourBytesURL(assetsURLPrefix, fourBytes);
|
||||||
|
|
||||||
const res = await fetch(signatureURL);
|
try {
|
||||||
if (!res.ok) {
|
const res = await fetch(signatureURL);
|
||||||
console.warn(`Signature does not exist in 4bytes DB: ${fourBytes}`);
|
if (!res.ok) {
|
||||||
|
console.warn(`Signature does not exist in 4bytes DB: ${fourBytes}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get only the first occurrence, for now ignore alternative param names
|
||||||
|
const sigs = await res.text();
|
||||||
|
const sig = sigs.split(";")[0];
|
||||||
|
const cut = sig.indexOf("(");
|
||||||
|
const method = sig.slice(0, cut);
|
||||||
|
|
||||||
|
const entry: FourBytesEntry = {
|
||||||
|
name: method,
|
||||||
|
signature: sig,
|
||||||
|
};
|
||||||
|
return entry;
|
||||||
|
} catch (err) {
|
||||||
|
// Network error or something wrong with URL config;
|
||||||
|
// silence and don't try it again
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get only the first occurrence, for now ignore alternative param names
|
|
||||||
const sigs = await res.text();
|
|
||||||
const sig = sigs.split(";")[0];
|
|
||||||
const cut = sig.indexOf("(");
|
|
||||||
const method = sig.slice(0, cut);
|
|
||||||
|
|
||||||
const entry: FourBytesEntry = {
|
|
||||||
name: method,
|
|
||||||
signature: sig,
|
|
||||||
};
|
|
||||||
return entry;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user