@latticexyz/cli 2.0.0-main-bf79ed5d → 2.0.0-main-db314a74

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.
@@ -12,7 +12,7 @@ export async function ensureDeployer(client: Client<Transport, Chain | undefined
12
12
  debug("found CREATE2 deployer at", deployer);
13
13
  if (bytecode !== deployerBytecode) {
14
14
  console.warn(
15
- `\n ⚠️ Bytecode for deployer at ${deployer} did not match the expected CREATE2 bytecode. You may have unexpected results.\n`
15
+ `\n ⚠️ Bytecode for deployer at ${deployer} did not match the expected CREATE2 bytecode. You may have unexpected results.\n`,
16
16
  );
17
17
  }
18
18
  return deployer;
@@ -48,7 +48,7 @@ export async function ensureDeployer(client: Client<Transport, Chain | undefined
48
48
  if (String(error).includes("only replay-protected (EIP-155) transactions allowed over RPC")) {
49
49
  console.warn(
50
50
  // eslint-disable-next-line max-len
51
- `\n ⚠️ Your chain or RPC does not allow for non EIP-155 signed transactions, so your deploys will not be determinstic and contract addresses may change between deploys.\n\n We recommend running your chain's node with \`--rpc.allow-unprotected-txs\` to enable determinstic deployments.\n`
51
+ `\n ⚠️ Your chain or RPC does not allow for non EIP-155 signed transactions, so your deploys will not be determinstic and contract addresses may change between deploys.\n\n We recommend running your chain's node with \`--rpc.allow-unprotected-txs\` to enable determinstic deployments.\n`,
52
52
  );
53
53
  debug("deploying CREATE2 deployer");
54
54
  return sendTransaction(client, {
@@ -57,7 +57,7 @@ export async function ensureDeployer(client: Client<Transport, Chain | undefined
57
57
  });
58
58
  }
59
59
  throw error;
60
- }
60
+ },
61
61
  );
62
62
 
63
63
  const deployReceipt = await waitForTransactionReceipt(client, { hash: deployTx });
@@ -67,7 +67,7 @@ export async function ensureDeployer(client: Client<Transport, Chain | undefined
67
67
 
68
68
  if (deployReceipt.contractAddress !== deployer) {
69
69
  console.warn(
70
- `\n ⚠️ CREATE2 deployer created at ${deployReceipt.contractAddress} does not match the CREATE2 determinstic deployer we expected (${deployer})`
70
+ `\n ⚠️ CREATE2 deployer created at ${deployReceipt.contractAddress} does not match the CREATE2 determinstic deployer we expected (${deployer})`,
71
71
  );
72
72
  }
73
73
 
@@ -29,7 +29,7 @@ export async function ensureFunctions({
29
29
  "found",
30
30
  wrongSystem.length,
31
31
  "functions already registered but pointing at a different system ID:",
32
- wrongSystem.map((func) => func.signature).join(", ")
32
+ wrongSystem.map((func) => func.signature).join(", "),
33
33
  );
34
34
  }
35
35
  }
@@ -59,7 +59,7 @@ export async function ensureFunctions({
59
59
  debug(`failed to register function ${func.signature}, retrying in ${delay}ms...`);
60
60
  await wait(delay);
61
61
  },
62
- }
62
+ },
63
63
  );
64
64
  }
65
65
  return pRetry(
@@ -79,8 +79,8 @@ export async function ensureFunctions({
79
79
  debug(`failed to register function ${func.signature}, retrying in ${delay}ms...`);
80
80
  await wait(delay);
81
81
  },
82
- }
82
+ },
83
83
  );
84
- })
84
+ }),
85
85
  );
86
86
  }
@@ -68,9 +68,9 @@ export async function ensureModules({
68
68
  debug(`failed to install module ${mod.name}, retrying in ${delay}ms...`);
69
69
  await wait(delay);
70
70
  },
71
- }
72
- )
73
- )
71
+ },
72
+ ),
73
+ ),
74
74
  )
75
75
  ).filter(isDefined);
76
76
  }
@@ -24,7 +24,7 @@ export async function ensureNamespaceOwner({
24
24
  "existing namespaces:",
25
25
  Array.from(existingNamespaces)
26
26
  .map((namespace) => (namespace === "" ? "<root>" : namespace))
27
- .join(", ")
27
+ .join(", "),
28
28
  );
29
29
  }
30
30
 
@@ -39,7 +39,7 @@ export async function ensureNamespaceOwner({
39
39
  key: { namespaceId: resourceToHex({ type: "namespace", namespace, name: "" }) },
40
40
  });
41
41
  return [namespace, owner];
42
- })
42
+ }),
43
43
  );
44
44
 
45
45
  const unauthorizedNamespaces = namespaceOwners
@@ -63,8 +63,8 @@ export async function ensureNamespaceOwner({
63
63
  abi: worldAbi,
64
64
  functionName: "registerNamespace",
65
65
  args: [resourceToHex({ namespace, type: "namespace", name: "" })],
66
- })
67
- )
66
+ }),
67
+ ),
68
68
  );
69
69
 
70
70
  return registrationTxs;
@@ -32,8 +32,8 @@ export async function ensureSystems({
32
32
  worldSystems.some(
33
33
  (worldSystem) =>
34
34
  worldSystem.systemId === system.systemId &&
35
- getAddress(worldSystem.address) === getAddress(system.getAddress(deployerAddress))
36
- )
35
+ getAddress(worldSystem.address) === getAddress(system.getAddress(deployerAddress)),
36
+ ),
37
37
  );
38
38
  if (existingSystems.length) {
39
39
  debug("existing systems", existingSystems.map(resourceToLabel).join(", "));
@@ -47,15 +47,15 @@ export async function ensureSystems({
47
47
  worldSystems.some(
48
48
  (worldSystem) =>
49
49
  worldSystem.systemId === system.systemId &&
50
- getAddress(worldSystem.address) !== getAddress(system.getAddress(deployerAddress))
51
- )
50
+ getAddress(worldSystem.address) !== getAddress(system.getAddress(deployerAddress)),
51
+ ),
52
52
  );
53
53
  if (systemsToUpgrade.length) {
54
54
  debug("upgrading systems", systemsToUpgrade.map(resourceToLabel).join(", "));
55
55
  }
56
56
 
57
57
  const systemsToAdd = missingSystems.filter(
58
- (system) => !worldSystems.some((worldSystem) => worldSystem.systemId === system.systemId)
58
+ (system) => !worldSystems.some((worldSystem) => worldSystem.systemId === system.systemId),
59
59
  );
60
60
  if (systemsToAdd.length) {
61
61
  debug("registering new systems", systemsToAdd.map(resourceToLabel).join(", "));
@@ -90,9 +90,9 @@ export async function ensureSystems({
90
90
  debug(`failed to register system ${resourceToLabel(system)}, retrying in ${delay}ms...`);
91
91
  await wait(delay);
92
92
  },
93
- }
94
- )
95
- )
93
+ },
94
+ ),
95
+ ),
96
96
  );
97
97
 
98
98
  // Adjust system access
@@ -101,7 +101,7 @@ export async function ensureSystems({
101
101
  const currentAccess = worldAccess.filter(({ resourceId }) => systemIds.includes(resourceId));
102
102
  const desiredAccess = [
103
103
  ...systems.flatMap((system) =>
104
- system.allowedAddresses.map((address) => ({ resourceId: system.systemId, address }))
104
+ system.allowedAddresses.map((address) => ({ resourceId: system.systemId, address })),
105
105
  ),
106
106
  ...systems.flatMap((system) =>
107
107
  system.allowedSystemIds
@@ -111,7 +111,7 @@ export async function ensureSystems({
111
111
  worldSystems.find((s) => s.systemId === systemId)?.address ??
112
112
  systems.find((s) => s.systemId === systemId)?.getAddress(deployerAddress),
113
113
  }))
114
- .filter((access): access is typeof access & { address: Address } => access.address != null)
114
+ .filter((access): access is typeof access & { address: Address } => access.address != null),
115
115
  ),
116
116
  ];
117
117
 
@@ -119,16 +119,16 @@ export async function ensureSystems({
119
119
  (access) =>
120
120
  !currentAccess.some(
121
121
  ({ resourceId, address }) =>
122
- resourceId === access.resourceId && getAddress(address) === getAddress(access.address)
123
- )
122
+ resourceId === access.resourceId && getAddress(address) === getAddress(access.address),
123
+ ),
124
124
  );
125
125
 
126
126
  const accessToRemove = currentAccess.filter(
127
127
  (access) =>
128
128
  !desiredAccess.some(
129
129
  ({ resourceId, address }) =>
130
- resourceId === access.resourceId && getAddress(address) === getAddress(access.address)
131
- )
130
+ resourceId === access.resourceId && getAddress(address) === getAddress(access.address),
131
+ ),
132
132
  );
133
133
 
134
134
  if (accessToRemove.length) {
@@ -156,8 +156,8 @@ export async function ensureSystems({
156
156
  debug(`failed to revoke access, retrying in ${delay}ms...`);
157
157
  await wait(delay);
158
158
  },
159
- }
160
- )
159
+ },
160
+ ),
161
161
  ),
162
162
  ...accessToAdd.map((access) =>
163
163
  pRetry(
@@ -176,8 +176,8 @@ export async function ensureSystems({
176
176
  debug(`failed to grant access, retrying in ${delay}ms...`);
177
177
  await wait(delay);
178
178
  },
179
- }
180
- )
179
+ },
180
+ ),
181
181
  ),
182
182
  ]);
183
183
 
@@ -54,9 +54,9 @@ export async function ensureTables({
54
54
  debug(`failed to register table ${resourceToLabel(table)}, retrying in ${delay}ms...`);
55
55
  await wait(delay);
56
56
  },
57
- }
58
- )
59
- )
57
+ },
58
+ ),
59
+ ),
60
60
  );
61
61
  }
62
62
 
@@ -13,7 +13,7 @@ import { Contract } from "./ensureContract";
13
13
 
14
14
  export async function ensureWorldFactory(
15
15
  client: Client<Transport, Chain | undefined, Account>,
16
- deployerAddress: Hex
16
+ deployerAddress: Hex,
17
17
  ): Promise<Address> {
18
18
  const accessManagementSystemDeployedBytecodeSize = size(accessManagementSystemBuild.deployedBytecode.object as Hex);
19
19
  const accessManagementSystemBytecode = accessManagementSystemBuild.bytecode.object as Hex;
@@ -51,7 +51,7 @@ export async function getFunctions({
51
51
  systemFunctionSignature,
52
52
  systemFunctionSelector,
53
53
  };
54
- })
54
+ }),
55
55
  );
56
56
 
57
57
  return functions;
@@ -35,8 +35,8 @@ export async function getResourceAccess({
35
35
  await Promise.all(
36
36
  keys.map(
37
37
  async (key) =>
38
- [key, await getTableValue({ client, worldDeploy, table: worldTables.world_ResourceAccess, key })] as const
39
- )
38
+ [key, await getTableValue({ client, worldDeploy, table: worldTables.world_ResourceAccess, key })] as const,
39
+ ),
40
40
  )
41
41
  )
42
42
  .filter(([, value]) => value.access)
@@ -42,6 +42,6 @@ export async function getSystems({
42
42
  .map(({ address }) => address),
43
43
  functions: systemFunctions,
44
44
  };
45
- })
45
+ }),
46
46
  );
47
47
  }
@@ -45,7 +45,7 @@ export async function getTables({
45
45
  const valueAbiTypes = [...valueSchemaFields.staticFields, ...valueSchemaFields.dynamicFields];
46
46
 
47
47
  const keySchema = Object.fromEntries(
48
- keySchemaFields.staticFields.map((abiType, i) => [keyNames[i], abiType])
48
+ keySchemaFields.staticFields.map((abiType, i) => [keyNames[i], abiType]),
49
49
  ) as KeySchema;
50
50
  const valueSchema = Object.fromEntries(valueAbiTypes.map((abiType, i) => [fieldNames[i], abiType])) as ValueSchema;
51
51
 
@@ -37,7 +37,7 @@ export function logsToWorldDeploy(logs: readonly Log<bigint, number, false>[]):
37
37
  ? { storeVersion: hexToString(trim(log.args.storeVersion, { dir: "right" })) }
38
38
  : null),
39
39
  }),
40
- {}
40
+ {},
41
41
  );
42
42
 
43
43
  if (address == null) throw new Error("could not find world address");
@@ -61,7 +61,7 @@ export function resolveConfig<config extends ConfigInput>({
61
61
  allowAll: system.openAccess,
62
62
  allowedAddresses: system.accessListAddresses as Hex[],
63
63
  allowedSystemIds: system.accessListSystems.map((name) =>
64
- resourceToHex({ type: "system", namespace, name: resolvedConfig.systems[name].name })
64
+ resourceToHex({ type: "system", namespace, name: resolvedConfig.systems[name].name }),
65
65
  ),
66
66
  getAddress: (deployer: Address) => getCreate2Address({ from: deployer, bytecode: contractData.bytecode, salt }),
67
67
  bytecode: contractData.bytecode,
@@ -81,8 +81,8 @@ export function resolveConfig<config extends ConfigInput>({
81
81
  const names = overlappingSystems.map((system) => system.name);
82
82
  throw new Error(
83
83
  `Found systems with overlapping system ID: ${names.join(
84
- ", "
85
- )}.\n\nSystem IDs are generated from the first 16 bytes of the name, so you may need to rename them to avoid the overlap.`
84
+ ", ",
85
+ )}.\n\nSystem IDs are generated from the first 16 bytes of the name, so you may need to rename them to avoid the overlap.`,
86
86
  );
87
87
  }
88
88
 
@@ -96,9 +96,9 @@ export function resolveConfig<config extends ConfigInput>({
96
96
  type: table.offchainOnly ? "offchainTable" : "table",
97
97
  namespace: config.namespace,
98
98
  name: table.name,
99
- })
99
+ }),
100
100
  ),
101
- ])
101
+ ]),
102
102
  ),
103
103
  };
104
104
 
package/src/mud.ts CHANGED
@@ -26,7 +26,7 @@ async function run() {
26
26
  console.error(chalk.red(msg));
27
27
  if (msg.includes("Missing required argument")) {
28
28
  console.log(
29
- chalk.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`)
29
+ chalk.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`),
30
30
  );
31
31
  }
32
32
  console.log("");
package/src/runDeploy.ts CHANGED
@@ -64,8 +64,8 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
64
64
  const rpc = opts.rpc ?? (await getRpcUrl(profile));
65
65
  console.log(
66
66
  chalk.bgBlue(
67
- chalk.whiteBright(`\n Deploying MUD contracts${profile ? " with profile " + profile : ""} to RPC ${rpc} \n`)
68
- )
67
+ chalk.whiteBright(`\n Deploying MUD contracts${profile ? " with profile " + profile : ""} to RPC ${rpc} \n`),
68
+ ),
69
69
  );
70
70
 
71
71
  // Run build
@@ -78,7 +78,7 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
78
78
  throw new MUDError(
79
79
  `Missing PRIVATE_KEY environment variable.
80
80
  Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
81
- in your contracts directory to use the default anvil private key.`
81
+ in your contracts directory to use the default anvil private key.`,
82
82
  );
83
83
  }
84
84
 
@@ -126,7 +126,7 @@ in your contracts directory to use the default anvil private key.`
126
126
  writeFileSync(config.worldsFile, JSON.stringify(deploys, null, 2));
127
127
 
128
128
  console.log(
129
- chalk.bgGreen(chalk.whiteBright(`\n Deployment result (written to ${config.worldsFile} and ${deploysDir}): \n`))
129
+ chalk.bgGreen(chalk.whiteBright(`\n Deployment result (written to ${config.worldsFile} and ${deploysDir}): \n`)),
130
130
  );
131
131
  }
132
132
 
@@ -9,6 +9,6 @@ export function printMUD() {
9
9
  | :\\/: || :\\/: || (__) |
10
10
  | '--'M|| '--'U|| '--'D|
11
11
  '------''------''------'
12
- `)
12
+ `),
13
13
  );
14
14
  }
@@ -9,7 +9,7 @@ import { Abi, Hex, size } from "viem";
9
9
  */
10
10
  export function getContractData(
11
11
  contractName: string,
12
- forgeOutDirectory: string
12
+ forgeOutDirectory: string,
13
13
  ): { bytecode: Hex; abi: Abi; deployedBytecodeSize: number } {
14
14
  let data: any;
15
15
  const contractDataPath = path.join(forgeOutDirectory, contractName + ".sol", contractName + ".json");
@@ -7,7 +7,7 @@ export async function postDeploy(
7
7
  postDeployScript: string,
8
8
  worldAddress: string,
9
9
  rpc: string,
10
- profile: string | undefined
10
+ profile: string | undefined,
11
11
  ): Promise<void> {
12
12
  // Execute postDeploy forge script
13
13
  const postDeployPath = path.join(await getScriptDirectory(), postDeployScript + ".s.sol");
@@ -17,7 +17,7 @@ export async function postDeploy(
17
17
  ["script", postDeployScript, "--sig", "run(address)", worldAddress, "--broadcast", "--rpc-url", rpc, "-vvv"],
18
18
  {
19
19
  profile: profile,
20
- }
20
+ },
21
21
  );
22
22
  } else {
23
23
  console.log(`No script at ${postDeployPath}, skipping post deploy hook`);