Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-bats-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/store-sync": patch
---

Invalid registered system ABIs are now handled by displaying an empty ABI.
14 changes: 10 additions & 4 deletions packages/store-sync/src/world/getSystemAbis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Client, Abi, Address, Hex, hexToString, parseAbi, stringToHex, toFuncti
import metadataConfig from "@latticexyz/world-module-metadata/mud.config";
import { getRecords } from "../getRecords";
import { getFunctions } from "./getFunctions";
import { groupBy } from "@latticexyz/common/utils";
import { groupBy, isNotNull } from "@latticexyz/common/utils";
import { functionSignatureToAbiItem } from "./functionSignatureToAbiItem";
import { hexToResource } from "@latticexyz/common";
import { isAbiFunction } from "./common";
Expand Down Expand Up @@ -52,9 +52,15 @@ export async function getSystemAbis({
return isAbiTag && matchesSystemId;
})
.map(({ resource, value }) => {
const abi = value === "0x" ? [] : parseAbi(hexToString(value).split("\n"));
return [resource, abi] as const;
}),
try {
const abi = value === "0x" ? [] : parseAbi(hexToString(value).split("\n"));
return [resource, abi] as const;
} catch (error) {
console.error("error parsing system abi", error);
return [resource, []] as const;
}
})
.filter(isNotNull),
);

const systemFunctions = Object.fromEntries(
Expand Down
Loading