@latticexyz/cli 2.2.20-b774ab28b3de6cefcbfce5e1bb6fcb68b9374abf → 2.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,13 +125,13 @@ var commandModule4 = {
125
125
  var tablegen_default = commandModule4;
126
126
 
127
127
  // src/runDeploy.ts
128
- import path8 from "node:path";
128
+ import path9 from "node:path";
129
129
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync3, writeFileSync } from "node:fs";
130
130
 
131
131
  // package.json
132
132
  var package_default = {
133
133
  name: "@latticexyz/cli",
134
- version: "2.2.19",
134
+ version: "2.2.20",
135
135
  description: "Command line interface for mud",
136
136
  repository: {
137
137
  type: "git",
@@ -983,10 +983,12 @@ async function ensureFunctions({
983
983
 
984
984
  // src/deploy/ensureModules.ts
985
985
  import { BaseError } from "viem";
986
- import { writeContract as writeContract5 } from "@latticexyz/common";
986
+ import { resourceToHex, writeContract as writeContract5 } from "@latticexyz/common";
987
987
  import { isDefined as isDefined3 } from "@latticexyz/common/utils";
988
988
  import pRetry4 from "p-retry";
989
989
  import { ensureContractsDeployed as ensureContractsDeployed3 } from "@latticexyz/common/internal";
990
+ import { encodeSystemCalls } from "@latticexyz/world/internal";
991
+ import { systemsConfig as worldSystemsConfig } from "@latticexyz/world/mud.config";
990
992
  async function ensureModules({
991
993
  client,
992
994
  deployerAddress,
@@ -1010,13 +1012,49 @@ async function ensureModules({
1010
1012
  (mod) => pRetry4(
1011
1013
  async () => {
1012
1014
  try {
1013
- const abi = [...worldAbi, ...mod.abi];
1014
1015
  const moduleAddress = mod.prepareDeploy(deployerAddress, libraryMap).address;
1015
- const params = mod.installAsRoot ? { functionName: "installRootModule", args: [moduleAddress, mod.installData] } : { functionName: "installModule", args: [moduleAddress, mod.installData] };
1016
+ const params = (() => {
1017
+ if (mod.installStrategy === "root") {
1018
+ return {
1019
+ functionName: "installRootModule",
1020
+ args: [moduleAddress, mod.installData]
1021
+ };
1022
+ }
1023
+ if (mod.installStrategy === "delegation") {
1024
+ return {
1025
+ functionName: "batchCall",
1026
+ args: encodeSystemCalls([
1027
+ {
1028
+ abi: registrationSystemAbi,
1029
+ systemId: registrationSystemId,
1030
+ functionName: "registerDelegation",
1031
+ args: [moduleAddress, unlimitedDelegationControlId, "0x"]
1032
+ },
1033
+ {
1034
+ abi: registrationSystemAbi,
1035
+ systemId: registrationSystemId,
1036
+ functionName: "installModule",
1037
+ args: [moduleAddress, mod.installData]
1038
+ },
1039
+ {
1040
+ abi: registrationSystemAbi,
1041
+ systemId: registrationSystemId,
1042
+ functionName: "unregisterDelegation",
1043
+ args: [moduleAddress]
1044
+ }
1045
+ ])
1046
+ };
1047
+ }
1048
+ return {
1049
+ functionName: "installModule",
1050
+ args: [moduleAddress, mod.installData]
1051
+ };
1052
+ })();
1016
1053
  return await writeContract5(client, {
1017
1054
  chain: client.chain ?? null,
1018
1055
  address: worldDeploy.address,
1019
- abi,
1056
+ // append module's ABI so that we can decode any custom errors
1057
+ abi: [...worldAbi, ...mod.abi],
1020
1058
  ...params
1021
1059
  });
1022
1060
  } catch (error4) {
@@ -1040,10 +1078,68 @@ async function ensureModules({
1040
1078
  )
1041
1079
  )).filter(isDefined3);
1042
1080
  }
1081
+ var unlimitedDelegationControlId = resourceToHex({ type: "system", namespace: "", name: "unlimited" });
1082
+ var registrationSystemId = worldSystemsConfig.systems.RegistrationSystem.systemId;
1083
+ var registrationSystemAbi = [
1084
+ {
1085
+ type: "function",
1086
+ name: "installModule",
1087
+ inputs: [
1088
+ {
1089
+ name: "module",
1090
+ type: "address",
1091
+ internalType: "contract IModule"
1092
+ },
1093
+ {
1094
+ name: "encodedArgs",
1095
+ type: "bytes",
1096
+ internalType: "bytes"
1097
+ }
1098
+ ],
1099
+ outputs: [],
1100
+ stateMutability: "nonpayable"
1101
+ },
1102
+ {
1103
+ type: "function",
1104
+ name: "registerDelegation",
1105
+ inputs: [
1106
+ {
1107
+ name: "delegatee",
1108
+ type: "address",
1109
+ internalType: "address"
1110
+ },
1111
+ {
1112
+ name: "delegationControlId",
1113
+ type: "bytes32",
1114
+ internalType: "ResourceId"
1115
+ },
1116
+ {
1117
+ name: "initCallData",
1118
+ type: "bytes",
1119
+ internalType: "bytes"
1120
+ }
1121
+ ],
1122
+ outputs: [],
1123
+ stateMutability: "nonpayable"
1124
+ },
1125
+ {
1126
+ type: "function",
1127
+ name: "unregisterDelegation",
1128
+ inputs: [
1129
+ {
1130
+ name: "delegatee",
1131
+ type: "address",
1132
+ internalType: "address"
1133
+ }
1134
+ ],
1135
+ outputs: [],
1136
+ stateMutability: "nonpayable"
1137
+ }
1138
+ ];
1043
1139
 
1044
1140
  // src/deploy/ensureNamespaceOwner.ts
1045
1141
  import { getAddress as getAddress5 } from "viem";
1046
- import { hexToResource as hexToResource4, resourceToHex, writeContract as writeContract6 } from "@latticexyz/common";
1142
+ import { hexToResource as hexToResource4, resourceToHex as resourceToHex2, writeContract as writeContract6 } from "@latticexyz/common";
1047
1143
  import worldConfig3 from "@latticexyz/world/mud.config";
1048
1144
  async function ensureNamespaceOwner({
1049
1145
  client,
@@ -1070,7 +1166,7 @@ async function ensureNamespaceOwner({
1070
1166
  client,
1071
1167
  worldDeploy,
1072
1168
  table: worldConfig3.namespaces.world.tables.NamespaceOwner,
1073
- key: { namespaceId: resourceToHex({ type: "namespace", namespace, name: "" }) }
1169
+ key: { namespaceId: resourceToHex2({ type: "namespace", namespace, name: "" }) }
1074
1170
  });
1075
1171
  return [namespace, owner];
1076
1172
  })
@@ -1090,7 +1186,7 @@ async function ensureNamespaceOwner({
1090
1186
  address: worldDeploy.address,
1091
1187
  abi: worldAbi,
1092
1188
  functionName: "registerNamespace",
1093
- args: [resourceToHex({ namespace, type: "namespace", name: "" })]
1189
+ args: [resourceToHex2({ namespace, type: "namespace", name: "" })]
1094
1190
  })
1095
1191
  )
1096
1192
  );
@@ -1098,7 +1194,7 @@ async function ensureNamespaceOwner({
1098
1194
  }
1099
1195
 
1100
1196
  // src/deploy/deploy.ts
1101
- import { resourceToHex as resourceToHex3, resourceToLabel as resourceToLabel4 } from "@latticexyz/common";
1197
+ import { resourceToHex as resourceToHex4, resourceToLabel as resourceToLabel4 } from "@latticexyz/common";
1102
1198
  import { randomBytes } from "crypto";
1103
1199
 
1104
1200
  // src/deploy/ensureResourceTags.ts
@@ -1115,10 +1211,10 @@ import { isHex, size as size4 } from "viem";
1115
1211
  // src/utils/findPlaceholders.ts
1116
1212
  function findPlaceholders(linkReferences) {
1117
1213
  return Object.entries(linkReferences).flatMap(
1118
- ([path16, contracts]) => Object.entries(contracts).flatMap(
1214
+ ([path17, contracts]) => Object.entries(contracts).flatMap(
1119
1215
  ([contractName, locations]) => locations.map(
1120
1216
  (location) => ({
1121
- path: path16,
1217
+ path: path17,
1122
1218
  name: contractName,
1123
1219
  start: location.start,
1124
1220
  length: location.length
@@ -1244,7 +1340,7 @@ async function ensureResourceTags({
1244
1340
  {
1245
1341
  optional: true,
1246
1342
  name: "MetadataModule",
1247
- installAsRoot: false,
1343
+ installStrategy: "delegation",
1248
1344
  installData: "0x",
1249
1345
  prepareDeploy: createPrepareDeploy(metadataModuleArtifact.bytecode, metadataModuleArtifact.placeholders),
1250
1346
  deployedBytecodeSize: metadataModuleArtifact.deployedBytecodeSize,
@@ -1285,7 +1381,7 @@ async function ensureResourceTags({
1285
1381
  // src/deploy/deployCustomWorld.ts
1286
1382
  import { concatHex as concatHex2, encodeDeployData as encodeDeployData4, isHex as isHex2 } from "viem";
1287
1383
  import { waitForTransactionReceipt as waitForTransactionReceipt2 } from "viem/actions";
1288
- import { resourceToHex as resourceToHex2, sendTransaction, writeContract as writeContract8 } from "@latticexyz/common";
1384
+ import { resourceToHex as resourceToHex3, sendTransaction, writeContract as writeContract8 } from "@latticexyz/common";
1289
1385
  import { ensureContractsDeployed as ensureContractsDeployed4, getContractAddress as getContractAddress5, waitForTransactions as waitForTransactions2 } from "@latticexyz/common/internal";
1290
1386
  function findArtifact(ref, artifacts) {
1291
1387
  const artifact = artifacts.find((a) => a.sourcePath === ref.sourcePath && a.name === ref.name);
@@ -1361,7 +1457,7 @@ async function deployCustomWorld({
1361
1457
  address: deploy2.address,
1362
1458
  abi: worldAbi,
1363
1459
  functionName: "transferOwnership",
1364
- args: [resourceToHex2({ type: "namespace", namespace: "", name: "" }), client.account.address]
1460
+ args: [resourceToHex3({ type: "namespace", namespace: "", name: "" }), client.account.address]
1365
1461
  });
1366
1462
  await waitForTransactions2({ client, hashes: [transferOwnershipTx], debugLabel: "world ownership transfer" });
1367
1463
  return { ...deploy2, stateBlock: deploy2.deployBlock };
@@ -1371,16 +1467,16 @@ async function deployCustomWorld({
1371
1467
  import { uniqueBy } from "@latticexyz/common/utils";
1372
1468
 
1373
1469
  // src/deploy/getLibraryMap.ts
1374
- function getLibraryKey({ path: path16, name }) {
1375
- return `${path16}:${name}`;
1470
+ function getLibraryKey({ path: path17, name }) {
1471
+ return `${path17}:${name}`;
1376
1472
  }
1377
1473
  function getLibraryMap(libraries) {
1378
1474
  const cache = Object.fromEntries(libraries.map((library) => [getLibraryKey(library), library]));
1379
1475
  const libraryMap = {
1380
- getAddress: ({ path: path16, name, deployer }) => {
1381
- const library = cache[getLibraryKey({ path: path16, name })];
1476
+ getAddress: ({ path: path17, name, deployer }) => {
1477
+ const library = cache[getLibraryKey({ path: path17, name })];
1382
1478
  if (!library) {
1383
- throw new Error(`Could not find library for bytecode placeholder ${path16}:${name}`);
1479
+ throw new Error(`Could not find library for bytecode placeholder ${path17}:${name}`);
1384
1480
  }
1385
1481
  library.address ??= {};
1386
1482
  library.address[deployer] ??= library.prepareDeploy(deployer, libraryMap).address;
@@ -1485,7 +1581,7 @@ async function deploy({
1485
1581
  });
1486
1582
  const namespaceTags = uniqueBy(
1487
1583
  [...tables, ...systems].filter(({ namespace, namespaceLabel }) => namespaceLabel !== namespace).map(({ namespace, namespaceLabel }) => ({
1488
- resourceId: resourceToHex3({ type: "namespace", namespace, name: "" }),
1584
+ resourceId: resourceToHex4({ type: "namespace", namespace, name: "" }),
1489
1585
  tag: "label",
1490
1586
  value: namespaceLabel
1491
1587
  })),
@@ -1568,7 +1664,7 @@ function orderByDependencies(items, itemKey, dependencyKeys) {
1568
1664
 
1569
1665
  // src/deploy/findLibraries.ts
1570
1666
  function findLibraries(forgeOutDir) {
1571
- const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json" }).sort().map((path16) => JSON.parse(readFileSync2(path16, "utf8")));
1667
+ const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json" }).sort().map((path17) => JSON.parse(readFileSync2(path17, "utf8")));
1572
1668
  const libraries = artifacts.flatMap((artifact) => {
1573
1669
  if (!artifact.metadata) return [];
1574
1670
  const contractPath = Object.keys(artifact.metadata.settings.compilationTarget)[0];
@@ -1739,7 +1835,7 @@ async function postDeploy(postDeployScript, worldAddress, rpc, profile, forgeOpt
1739
1835
  import { kmsKeyToAccount } from "@latticexyz/common/kms";
1740
1836
 
1741
1837
  // src/deploy/configToModules.ts
1742
- import path7 from "node:path";
1838
+ import path8 from "node:path";
1743
1839
  import { encodeField } from "@latticexyz/protocol-parser/internal";
1744
1840
  import { bytesToHex } from "viem";
1745
1841
 
@@ -1768,12 +1864,40 @@ async function importContractArtifact({
1768
1864
  // src/deploy/configToModules.ts
1769
1865
  import { resolveWithContext } from "@latticexyz/world/internal";
1770
1866
  import callWithSignatureModule from "@latticexyz/world-module-callwithsignature/out/CallWithSignatureModule.sol/CallWithSignatureModule.json" assert { type: "json" };
1771
- var callWithSignatureModuleArtifact = getContractArtifact(callWithSignatureModule);
1867
+
1868
+ // src/deploy/compat/moduleArtifactPathFromName.ts
1869
+ import path7 from "node:path";
1772
1870
  var knownModuleArtifacts = {
1773
1871
  KeysWithValueModule: "@latticexyz/world-modules/out/KeysWithValueModule.sol/KeysWithValueModule.json",
1774
1872
  KeysInTableModule: "@latticexyz/world-modules/out/KeysInTableModule.sol/KeysInTableModule.json",
1775
1873
  UniqueEntityModule: "@latticexyz/world-modules/out/UniqueEntityModule.sol/UniqueEntityModule.json"
1776
1874
  };
1875
+ function moduleArtifactPathFromName(forgeOutDir) {
1876
+ return (mod) => {
1877
+ if (mod.artifactPath) return mod;
1878
+ if (!mod.name) throw new Error("No `artifactPath` provided for module.");
1879
+ const artifactPath = knownModuleArtifacts[mod.name] ?? path7.join(forgeOutDir, `${mod.name}.sol`, `${mod.name}.json`);
1880
+ console.warn(
1881
+ [
1882
+ "",
1883
+ `\u26A0\uFE0F Your \`mud.config.ts\` is using a module with a \`name\`, but this option is deprecated.`,
1884
+ "",
1885
+ "To resolve this, you can replace this:",
1886
+ "",
1887
+ ` name: ${JSON.stringify(mod.name)}`,
1888
+ "",
1889
+ "with this:",
1890
+ "",
1891
+ ` artifactPath: ${JSON.stringify(artifactPath)}`,
1892
+ ""
1893
+ ].join("\n")
1894
+ );
1895
+ return { ...mod, artifactPath };
1896
+ };
1897
+ }
1898
+
1899
+ // src/deploy/configToModules.ts
1900
+ var callWithSignatureModuleArtifact = getContractArtifact(callWithSignatureModule);
1777
1901
  async function configToModules(config, forgeOutDir) {
1778
1902
  const defaultModules = [
1779
1903
  {
@@ -1781,7 +1905,7 @@ async function configToModules(config, forgeOutDir) {
1781
1905
  // TODO: figure out approach to install on existing worlds where deployer may not own root namespace
1782
1906
  optional: true,
1783
1907
  name: "CallWithSignatureModule",
1784
- installAsRoot: true,
1908
+ installStrategy: "root",
1785
1909
  installData: "0x",
1786
1910
  prepareDeploy: createPrepareDeploy(
1787
1911
  callWithSignatureModuleArtifact.bytecode,
@@ -1792,32 +1916,9 @@ async function configToModules(config, forgeOutDir) {
1792
1916
  }
1793
1917
  ];
1794
1918
  const modules = await Promise.all(
1795
- config.modules.filter(excludeCallWithSignatureModule).map(async (mod) => {
1796
- let artifactPath = mod.artifactPath;
1797
- if (!artifactPath) {
1798
- if (mod.name) {
1799
- artifactPath = knownModuleArtifacts[mod.name] ?? path7.join(forgeOutDir, `${mod.name}.sol`, `${mod.name}.json`);
1800
- console.warn(
1801
- [
1802
- "",
1803
- `\u26A0\uFE0F Your \`mud.config.ts\` is using a module with a \`name\`, but this option is deprecated.`,
1804
- "",
1805
- "To resolve this, you can replace this:",
1806
- "",
1807
- ` name: ${JSON.stringify(mod.name)}`,
1808
- "",
1809
- "with this:",
1810
- "",
1811
- ` artifactPath: ${JSON.stringify(artifactPath)}`,
1812
- ""
1813
- ].join("\n")
1814
- );
1815
- } else {
1816
- throw new Error("No `artifactPath` provided for module.");
1817
- }
1818
- }
1819
- const name = path7.basename(artifactPath, ".json");
1820
- const artifact = await importContractArtifact({ artifactPath });
1919
+ config.modules.filter(excludeCallWithSignatureModule).map(moduleArtifactPathFromName(forgeOutDir)).map(async (mod) => {
1920
+ const name = path8.basename(mod.artifactPath, ".json");
1921
+ const artifact = await importContractArtifact({ artifactPath: mod.artifactPath });
1821
1922
  const installArgs = mod.args.map((arg) => resolveWithContext(arg, { config })).map((arg) => {
1822
1923
  const value = arg.value instanceof Uint8Array ? bytesToHex(arg.value) : arg.value;
1823
1924
  return encodeField(arg.type, value);
@@ -1827,7 +1928,7 @@ async function configToModules(config, forgeOutDir) {
1827
1928
  }
1828
1929
  return {
1829
1930
  name,
1830
- installAsRoot: mod.root,
1931
+ installStrategy: mod.root ? "root" : mod.useDelegation ? "delegation" : "default",
1831
1932
  installData: installArgs.length === 0 ? "0x" : installArgs[0],
1832
1933
  prepareDeploy: createPrepareDeploy(artifact.bytecode, artifact.placeholders),
1833
1934
  deployedBytecodeSize: artifact.deployedBytecodeSize,
@@ -1924,7 +2025,7 @@ async function runDeploy(opts) {
1924
2025
  const profile = opts.profile;
1925
2026
  const configPath = await resolveConfigPath3(opts.configPath);
1926
2027
  const config = await loadConfig3(configPath);
1927
- const rootDir = path8.dirname(configPath);
2028
+ const rootDir = path9.dirname(configPath);
1928
2029
  console.log(chalk2.green(`
1929
2030
  Using ${package_default.name}@${package_default.version}`));
1930
2031
  if (opts.printConfig) {
@@ -2022,10 +2123,10 @@ Using ${package_default.name}@${package_default.version}`));
2022
2123
  blockNumber: Number(worldDeploy.deployBlock)
2023
2124
  };
2024
2125
  if (opts.saveDeployment) {
2025
- const deploysDir = path8.join(config.deploy.deploysDirectory, chainId.toString());
2126
+ const deploysDir = path9.join(config.deploy.deploysDirectory, chainId.toString());
2026
2127
  mkdirSync(deploysDir, { recursive: true });
2027
- writeFileSync(path8.join(deploysDir, "latest.json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
2028
- writeFileSync(path8.join(deploysDir, Date.now() + ".json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
2128
+ writeFileSync(path9.join(deploysDir, "latest.json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
2129
+ writeFileSync(path9.join(deploysDir, Date.now() + ".json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
2029
2130
  const localChains = [1337, 31337];
2030
2131
  const deploys2 = existsSync2(config.deploy.worldsFile) ? JSON.parse(readFileSync3(config.deploy.worldsFile, "utf-8")) : {};
2031
2132
  deploys2[chainId] = {
@@ -2076,7 +2177,7 @@ var commandModule5 = {
2076
2177
  var deploy_default = commandModule5;
2077
2178
 
2078
2179
  // src/commands/worldgen.ts
2079
- import path9 from "node:path";
2180
+ import path10 from "node:path";
2080
2181
  import { loadConfig as loadConfig4, resolveConfigPath as resolveConfigPath4 } from "@latticexyz/config/node";
2081
2182
  import { worldgen as worldgen2 } from "@latticexyz/world/node";
2082
2183
  var commandModule6 = {
@@ -2100,7 +2201,7 @@ var commandModule6 = {
2100
2201
  async function worldgenHandler(args) {
2101
2202
  const configPath = await resolveConfigPath4(args.configPath);
2102
2203
  const config = await loadConfig4(configPath);
2103
- const rootDir = path9.dirname(configPath);
2204
+ const rootDir = path10.dirname(configPath);
2104
2205
  await worldgen2({ rootDir, config, clean: args.clean });
2105
2206
  }
2106
2207
  var worldgen_default = commandModule6;
@@ -2108,7 +2209,7 @@ var worldgen_default = commandModule6;
2108
2209
  // src/commands/set-version.ts
2109
2210
  import chalk3 from "chalk";
2110
2211
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
2111
- import path10 from "path";
2212
+ import path11 from "path";
2112
2213
  import { MUDError as MUDError3 } from "@latticexyz/common/errors";
2113
2214
  import { globSync as globSync2 } from "glob";
2114
2215
 
@@ -2251,12 +2352,12 @@ function updatePackageJson(filePath, options2) {
2251
2352
  return mudVersion;
2252
2353
  }
2253
2354
  }
2254
- function readPackageJson(path16) {
2355
+ function readPackageJson(path17) {
2255
2356
  try {
2256
- const jsonString = readFileSync4(path16, "utf8");
2357
+ const jsonString = readFileSync4(path17, "utf8");
2257
2358
  return JSON.parse(jsonString);
2258
2359
  } catch {
2259
- throw new MUDError3("Could not read JSON at " + path16);
2360
+ throw new MUDError3("Could not read JSON at " + path17);
2260
2361
  }
2261
2362
  }
2262
2363
  function logComparison(prev, curr) {
@@ -2267,8 +2368,8 @@ function logComparison(prev, curr) {
2267
2368
  }
2268
2369
  }
2269
2370
  function resolveLinkPath(packageJsonPath, mudLinkPath, packageName) {
2270
- const packageJsonToRootPath = path10.relative(path10.dirname(packageJsonPath), process.cwd());
2271
- const linkPath = path10.join(packageJsonToRootPath, mudLinkPath, mudPackages[packageName].localPath);
2371
+ const packageJsonToRootPath = path11.relative(path11.dirname(packageJsonPath), process.cwd());
2372
+ const linkPath = path11.join(packageJsonToRootPath, mudLinkPath, mudPackages[packageName].localPath);
2272
2373
  return "link:" + linkPath;
2273
2374
  }
2274
2375
  var set_version_default = commandModule7;
@@ -2329,7 +2430,7 @@ var commandModule8 = {
2329
2430
  var test_default = commandModule8;
2330
2431
 
2331
2432
  // src/commands/trace.ts
2332
- import path11 from "node:path";
2433
+ import path12 from "node:path";
2333
2434
  import fs from "node:fs";
2334
2435
  import { loadConfig as loadConfig5, resolveConfigPath as resolveConfigPath5 } from "@latticexyz/config/node";
2335
2436
  import { MUDError as MUDError4 } from "@latticexyz/common/errors";
@@ -2367,7 +2468,7 @@ var commandModule9 = {
2367
2468
  },
2368
2469
  async handler(args) {
2369
2470
  const configPath = await resolveConfigPath5(args.configPath);
2370
- const rootDir = path11.dirname(configPath);
2471
+ const rootDir = path12.dirname(configPath);
2371
2472
  const profile = args.profile;
2372
2473
  const rpc = args.rpc ?? await getRpcUrl3(profile);
2373
2474
  const config = await loadConfig5(configPath);
@@ -2410,7 +2511,7 @@ import { getScriptDirectory as getScriptDirectory2, getSrcDirectory } from "@lat
2410
2511
  import chalk5 from "chalk";
2411
2512
  import chokidar from "chokidar";
2412
2513
  import { loadConfig as loadConfig6, resolveConfigPath as resolveConfigPath6 } from "@latticexyz/config/node";
2413
- import path12 from "path";
2514
+ import path13 from "path";
2414
2515
  import { homedir as homedir2 } from "os";
2415
2516
  import { rmSync as rmSync2 } from "fs";
2416
2517
  import { BehaviorSubject, debounceTime, exhaustMap, filter } from "rxjs";
@@ -2438,7 +2539,7 @@ var commandModule10 = {
2438
2539
  if (!opts.rpc) {
2439
2540
  console.log(chalk5.gray("Cleaning devnode cache"));
2440
2541
  const userHomeDir = homedir2();
2441
- rmSync2(path12.join(userHomeDir, ".foundry", "anvil", "tmp"), { recursive: true, force: true });
2542
+ rmSync2(path13.join(userHomeDir, ".foundry", "anvil", "tmp"), { recursive: true, force: true });
2442
2543
  await printCommand(
2443
2544
  execa6("anvil", ["--quiet", ["--block-time", "2"], ["--block-base-fee-per-gas", "0"]].flat(), {
2444
2545
  stdio: "inherit"
@@ -2670,7 +2771,7 @@ import { loadConfig as loadConfig7, resolveConfigPath as resolveConfigPath7 } fr
2670
2771
  import { getOutDirectory as getOutDirectory2, getRpcUrl as getRpcUrl4 } from "@latticexyz/common/foundry";
2671
2772
  import { createWalletClient as createWalletClient2, http as http3 } from "viem";
2672
2773
  import chalk6 from "chalk";
2673
- import path13 from "node:path";
2774
+ import path14 from "node:path";
2674
2775
  var verifyOptions = {
2675
2776
  deployerAddress: {
2676
2777
  type: "string",
@@ -2699,7 +2800,7 @@ var commandModule11 = {
2699
2800
  async handler(opts) {
2700
2801
  const profile = opts.profile;
2701
2802
  const configPath = await resolveConfigPath7(opts.configPath);
2702
- const rootDir = path13.dirname(configPath);
2803
+ const rootDir = path14.dirname(configPath);
2703
2804
  const config = await loadConfig7(configPath);
2704
2805
  const outDir = await getOutDirectory2(profile);
2705
2806
  const modules = await configToModules(config, outDir);
@@ -2747,7 +2848,7 @@ import chalk7 from "chalk";
2747
2848
  // src/pull/pull.ts
2748
2849
  import { hexToString as hexToString2, parseAbiItem, stringToHex as stringToHex4 } from "viem";
2749
2850
  import { getSchemaTypes as getSchemaTypes4 } from "@latticexyz/protocol-parser/internal";
2750
- import { hexToResource as hexToResource6, resourceToHex as resourceToHex4 } from "@latticexyz/common";
2851
+ import { hexToResource as hexToResource6, resourceToHex as resourceToHex5 } from "@latticexyz/common";
2751
2852
  import metadataConfig2 from "@latticexyz/world-module-metadata/mud.config";
2752
2853
 
2753
2854
  // src/deploy/getRecord.ts
@@ -2786,7 +2887,7 @@ async function getRecord({
2786
2887
  }
2787
2888
 
2788
2889
  // src/pull/pull.ts
2789
- import path14 from "node:path";
2890
+ import path15 from "node:path";
2790
2891
  import fs2 from "node:fs/promises";
2791
2892
  import { getFunctions as getFunctions3 } from "@latticexyz/store-sync/world";
2792
2893
  import { abiToInterface, formatSolidity, formatTypescript } from "@latticexyz/common/codegen";
@@ -2803,7 +2904,7 @@ import { findUp as findUp3 } from "find-up";
2803
2904
  import { isDefined as isDefined6 } from "@latticexyz/common/utils";
2804
2905
  var ignoredNamespaces = /* @__PURE__ */ new Set(["store", "world", "metadata"]);
2805
2906
  function namespaceToHex(namespace) {
2806
- return resourceToHex4({ type: "namespace", namespace, name: "" });
2907
+ return resourceToHex5({ type: "namespace", namespace, name: "" });
2807
2908
  }
2808
2909
  var WriteFileExistsError = class extends Error {
2809
2910
  constructor(filename) {
@@ -2920,7 +3021,7 @@ async function pull({ rootDir, client, worldAddress, replace, indexerUrl, chainI
2920
3021
  const config = defineWorld(configInput);
2921
3022
  debug3("writing config");
2922
3023
  await writeFile(
2923
- path14.join(rootDir, "mud.config.ts"),
3024
+ path15.join(rootDir, "mud.config.ts"),
2924
3025
  await formatTypescript(`
2925
3026
  import { defineWorld } from "@latticexyz/world";
2926
3027
 
@@ -2928,24 +3029,24 @@ async function pull({ rootDir, client, worldAddress, replace, indexerUrl, chainI
2928
3029
  `),
2929
3030
  { overwrite: replaceFiles }
2930
3031
  );
2931
- const remoteDir = path14.join(config.sourceDirectory, "remote");
3032
+ const remoteDir = path15.join(config.sourceDirectory, "remote");
2932
3033
  if (replaceFiles) {
2933
3034
  await fs2.rm(remoteDir, { recursive: true, force: true });
2934
3035
  }
2935
3036
  for (const system of systems.filter((system2) => system2.abi.length)) {
2936
3037
  const interfaceName = `I${system.label}`;
2937
- const interfaceFile = path14.join(remoteDir, "namespaces", system.namespaceLabel, `${interfaceName}.sol`);
3038
+ const interfaceFile = path15.join(remoteDir, "namespaces", system.namespaceLabel, `${interfaceName}.sol`);
2938
3039
  debug3("writing system interface", interfaceName, "to", interfaceFile);
2939
3040
  const source = abiToInterface({ name: interfaceName, systemId: system.systemId, abi: system.abi });
2940
- await writeFile(path14.join(rootDir, interfaceFile), await formatSolidity(source), { overwrite: replaceFiles });
3041
+ await writeFile(path15.join(rootDir, interfaceFile), await formatSolidity(source), { overwrite: replaceFiles });
2941
3042
  }
2942
3043
  const worldAbi2 = systems.flatMap((system) => system.worldAbi);
2943
3044
  if (worldAbi2.length) {
2944
3045
  const interfaceName = "IWorldSystems";
2945
- const interfaceFile = path14.join(remoteDir, `${interfaceName}.sol`);
3046
+ const interfaceFile = path15.join(remoteDir, `${interfaceName}.sol`);
2946
3047
  debug3("writing world systems interface to", interfaceFile);
2947
3048
  const source = abiToInterface({ name: interfaceName, abi: worldAbi2 });
2948
- await writeFile(path14.join(rootDir, interfaceFile), await formatSolidity(source), { overwrite: replaceFiles });
3049
+ await writeFile(path15.join(rootDir, interfaceFile), await formatSolidity(source), { overwrite: replaceFiles });
2949
3050
  }
2950
3051
  return { config };
2951
3052
  }
@@ -2959,12 +3060,12 @@ async function writeFile(filename, contents, opts = {}) {
2959
3060
  if (!opts.overwrite && await exists(filename)) {
2960
3061
  throw new WriteFileExistsError(filename);
2961
3062
  }
2962
- await fs2.mkdir(path14.dirname(filename), { recursive: true });
3063
+ await fs2.mkdir(path15.dirname(filename), { recursive: true });
2963
3064
  await fs2.writeFile(filename, contents);
2964
3065
  }
2965
3066
 
2966
3067
  // src/commands/pull.ts
2967
- import path15 from "node:path";
3068
+ import path16 from "node:path";
2968
3069
  import { getChainId as getChainId3 } from "viem/actions";
2969
3070
  var options = {
2970
3071
  worldAddress: { type: "string", required: true, desc: "Remote world address" },
@@ -3021,7 +3122,7 @@ var commandModule12 = {
3021
3122
  if (error4 instanceof WriteFileExistsError) {
3022
3123
  console.log();
3023
3124
  console.log(chalk7.bgRed(chalk7.whiteBright(" Error ")));
3024
- console.log(` Attempted to write file at "${path15.relative(rootDir, error4.filename)}", but it already exists.`);
3125
+ console.log(` Attempted to write file at "${path16.relative(rootDir, error4.filename)}", but it already exists.`);
3025
3126
  console.log();
3026
3127
  console.log(" To overwrite files, use `--replace` when running this command.");
3027
3128
  console.log();
@@ -3053,4 +3154,4 @@ var commands = [
3053
3154
  export {
3054
3155
  commands
3055
3156
  };
3056
- //# sourceMappingURL=commands-HHOXMM76.js.map
3157
+ //# sourceMappingURL=commands-S5XBCJLZ.js.map