Skip to content

Commit

Permalink
fix(cli): pass in schema to read system table
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Aug 15, 2023
1 parent 2be039a commit 96c2832
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@latticexyz/common": "workspace:*",
"@latticexyz/config": "workspace:*",
"@latticexyz/gas-report": "workspace:*",
"@latticexyz/protocol-parser": "workspace:*",
"@latticexyz/schema-type": "workspace:*",
"@latticexyz/services": "workspace:*",
"@latticexyz/solecs": "workspace:*",
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/commands/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import { resolveWorldConfig, WorldConfig } from "@latticexyz/world";
import { IBaseWorld } from "@latticexyz/world/types/ethers-contracts/IBaseWorld";
import IBaseWorldData from "@latticexyz/world/abi/IBaseWorld.sol/IBaseWorld.json" assert { type: "json" };
import { getChainId, getExistingContracts } from "../utils";
import { schemaToHex } from "@latticexyz/protocol-parser";

const systemsTableId = new TableId("", "Systems");
const systemTableSchema = schemaToHex({ staticFields: ["address", "bool"], dynamicFields: [] });

type Options = {
tx: string;
Expand Down Expand Up @@ -74,7 +76,12 @@ const commandModule: CommandModule<Options, Options> = {
for (const name of names) {
const systemSelector = new TableId(namespace, name);
// Get the first field of `Systems` table (the table maps system name to its address and other data)
const address = await WorldContract.getField(systemsTableId.toHex(), [systemSelector.toHex()], 0);
const address = await WorldContract.getField(
systemsTableId.toHex(),
[systemSelector.toHex()],
0,
systemTableSchema
);
labels.push({ name, address });
}

Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96c2832

Please sign in to comment.