From 96c28321903e354a0ff17cc8e0542ff83c30a429 Mon Sep 17 00:00:00 2001 From: alvrs Date: Tue, 18 Jul 2023 17:01:43 +0100 Subject: [PATCH] fix(cli): pass in schema to read system table --- packages/cli/package.json | 1 + packages/cli/src/commands/trace.ts | 9 ++++++++- pnpm-lock.yaml | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 9fea153713..ac0fb73cb3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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:*", diff --git a/packages/cli/src/commands/trace.ts b/packages/cli/src/commands/trace.ts index ff2b1c210e..026577c7d9 100644 --- a/packages/cli/src/commands/trace.ts +++ b/packages/cli/src/commands/trace.ts @@ -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; @@ -74,7 +76,12 @@ const commandModule: CommandModule = { 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 }); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab5561955b..aca704c657 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -111,6 +111,9 @@ importers: '@latticexyz/gas-report': specifier: workspace:* version: link:../gas-report + '@latticexyz/protocol-parser': + specifier: workspace:* + version: link:../protocol-parser '@latticexyz/schema-type': specifier: workspace:* version: link:../schema-type