Skip to content

Commit

Permalink
fix: fixed error pulling abi from sourcify
Browse files Browse the repository at this point in the history
  • Loading branch information
xtools-at committed Sep 9, 2024
1 parent 012966e commit 2f3be93
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/SourceBrowser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ export const SourceBrowser = ({
toggleImportStatus(true);

try {
data = await (await fetch(urlFull, {})).json();
data = JSON.parse(data);
const req = await fetch(urlFull, {});
if (!req.ok) throw new Error("Network response was not ok (full)");
data = await req.json();
} catch (e1) {
console.error(e1);
try {
data = await (await fetch(urlPartial, {})).json();
data = JSON.parse(data);
} catch (e2) {}
const req = await fetch(urlPartial, {});
if (!req.ok) throw new Error("Network response was not ok (partial)");
data = await req.json();
} catch (e2) {
console.error(e1);
}
}

if (data?.output?.abi) {
Expand Down

0 comments on commit 2f3be93

Please sign in to comment.