From aea67c5804efb2a8b919f5aa3a053d9b04184e84 Mon Sep 17 00:00:00 2001 From: alvarius Date: Thu, 14 Sep 2023 20:08:45 +0100 Subject: [PATCH] fix: release bytecode on npm and import abi in cli deploy (#1490) --- .changeset/clever-items-appear.md | 7 +++++++ packages/cli/src/commands/trace.ts | 2 +- packages/cli/src/utils/deploy.ts | 6 +++--- packages/store/.npmignore | 1 + packages/world/.npmignore | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/clever-items-appear.md diff --git a/.changeset/clever-items-appear.md b/.changeset/clever-items-appear.md new file mode 100644 index 0000000000..4dee214dca --- /dev/null +++ b/.changeset/clever-items-appear.md @@ -0,0 +1,7 @@ +--- +"@latticexyz/cli": patch +"@latticexyz/store": patch +"@latticexyz/world": patch +--- + +Include bytecode for `World` and `Store` in npm packages. diff --git a/packages/cli/src/commands/trace.ts b/packages/cli/src/commands/trace.ts index 25e88b4ef3..8762d5072c 100644 --- a/packages/cli/src/commands/trace.ts +++ b/packages/cli/src/commands/trace.ts @@ -7,7 +7,7 @@ import { MUDError } from "@latticexyz/common/errors"; import { cast, getRpcUrl, getSrcDirectory } from "@latticexyz/common/foundry"; import { StoreConfig } from "@latticexyz/store"; import { resolveWorldConfig, WorldConfig } from "@latticexyz/world"; -import IBaseWorldData from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.json" assert { type: "json" }; +import IBaseWorldData from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json" assert { type: "json" }; import worldConfig from "@latticexyz/world/mud.config.js"; import { tableIdToHex } from "@latticexyz/common"; import { getChainId, getExistingContracts } from "../utils"; diff --git a/packages/cli/src/utils/deploy.ts b/packages/cli/src/utils/deploy.ts index 5a7088d578..e9079dfd39 100644 --- a/packages/cli/src/utils/deploy.ts +++ b/packages/cli/src/utils/deploy.ts @@ -11,7 +11,7 @@ import { encodeSchema, getStaticByteLength } from "@latticexyz/schema-type/depre import { StoreConfig } from "@latticexyz/store"; import { resolveAbiOrUserType } from "@latticexyz/store/codegen"; import { WorldConfig, resolveWorldConfig } from "@latticexyz/world"; -import IBaseWorldData from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.json" assert { type: "json" }; +import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json" assert { type: "json" }; import WorldData from "@latticexyz/world/out/World.sol/World.json" assert { type: "json" }; import CoreModuleData from "@latticexyz/world/out/CoreModule.sol/CoreModule.json" assert { type: "json" }; import KeysWithValueModuleData from "@latticexyz/world/out/KeysWithValueModule.sol/KeysWithValueModule.json" assert { type: "json" }; @@ -81,7 +81,7 @@ export async function deploy( ? Promise.resolve(worldAddress) : worldContractName ? deployContractByName(worldContractName, disableTxWait) - : deployContract(IBaseWorldData.abi, WorldData.bytecode, disableTxWait, "World"), + : deployContract(IBaseWorldAbi, WorldData.bytecode, disableTxWait, "World"), }; // Deploy Systems @@ -129,7 +129,7 @@ export async function deploy( const contractPromises: Record> = { ...worldPromise, ...systemPromises, ...modulePromises }; // Create World contract instance from deployed address - const WorldContract = new ethers.Contract(await contractPromises.World, IBaseWorldData.abi, signer); + const WorldContract = new ethers.Contract(await contractPromises.World, IBaseWorldAbi, signer); const confirmations = disableTxWait ? 0 : 1; diff --git a/packages/store/.npmignore b/packages/store/.npmignore index 6a148ace5b..bf5a89e600 100644 --- a/packages/store/.npmignore +++ b/packages/store/.npmignore @@ -1,5 +1,6 @@ * +!out/**/*.json !out/**/*.abi.json !out/**/*.abi.json.d.ts !src/** diff --git a/packages/world/.npmignore b/packages/world/.npmignore index fcbdac2c99..97e2f21b8a 100644 --- a/packages/world/.npmignore +++ b/packages/world/.npmignore @@ -1,5 +1,6 @@ * +!out/**/*.json !out/**/*.abi.json !out/**/*.abi.json.d.ts !src/**