@latticexyz/cli 2.0.7-main-78a94d71 → 2.0.7-main-189050bd

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.
package/dist/mud.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import*as i from"dotenv";i.config();async function l(){let{default:r}=await import("yargs"),{default:o}=await import("chalk"),{hideBin:e}=await import("yargs/helpers"),{logError:s}=await import("./errors-MZURIB7V.js"),{commands:t}=await import("./commands-DQ6S6QOF.js");r(e(process.argv)).scriptName("mud").command(t).strict().fail((a,n)=>{console.error(o.red(a)),a.includes("Missing required argument")&&console.log(o.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`)),console.log(""),n!=null&&(s(n),console.log("")),process.exit(1)}).alias({h:"help"}).argv}l();
2
+ import*as i from"dotenv";i.config();async function l(){let{default:r}=await import("yargs"),{default:o}=await import("chalk"),{hideBin:e}=await import("yargs/helpers"),{logError:s}=await import("./errors-MZURIB7V.js"),{commands:t}=await import("./commands-DBHY7GFM.js");r(e(process.argv)).scriptName("mud").command(t).strict().fail((a,n)=>{console.error(o.red(a)),a.includes("Missing required argument")&&console.log(o.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`)),console.log(""),n!=null&&(s(n),console.log("")),process.exit(1)}).alias({h:"help"}).argv}l();
3
3
  //# sourceMappingURL=mud.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/cli",
3
- "version": "2.0.7-main-78a94d71",
3
+ "version": "2.0.7-main-189050bd",
4
4
  "description": "Command line interface for mud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,17 +41,17 @@
41
41
  "yargs": "^17.7.1",
42
42
  "zod": "^3.21.4",
43
43
  "zod-validation-error": "^1.3.0",
44
- "@latticexyz/abi-ts": "2.0.7-main-78a94d71",
45
- "@latticexyz/common": "2.0.7-main-78a94d71",
46
- "@latticexyz/config": "2.0.7-main-78a94d71",
47
- "@latticexyz/gas-report": "2.0.7-main-78a94d71",
48
- "@latticexyz/protocol-parser": "2.0.7-main-78a94d71",
49
- "@latticexyz/schema-type": "2.0.7-main-78a94d71",
50
- "@latticexyz/services": "2.0.7-main-78a94d71",
51
- "@latticexyz/store": "2.0.7-main-78a94d71",
52
- "@latticexyz/utils": "2.0.7-main-78a94d71",
53
- "@latticexyz/world": "2.0.7-main-78a94d71",
54
- "@latticexyz/world-modules": "2.0.7-main-78a94d71"
44
+ "@latticexyz/abi-ts": "2.0.7-main-189050bd",
45
+ "@latticexyz/common": "2.0.7-main-189050bd",
46
+ "@latticexyz/config": "2.0.7-main-189050bd",
47
+ "@latticexyz/gas-report": "2.0.7-main-189050bd",
48
+ "@latticexyz/protocol-parser": "2.0.7-main-189050bd",
49
+ "@latticexyz/schema-type": "2.0.7-main-189050bd",
50
+ "@latticexyz/services": "2.0.7-main-189050bd",
51
+ "@latticexyz/store": "2.0.7-main-189050bd",
52
+ "@latticexyz/utils": "2.0.7-main-189050bd",
53
+ "@latticexyz/world": "2.0.7-main-189050bd",
54
+ "@latticexyz/world-modules": "2.0.7-main-189050bd"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/debug": "^4.1.7",
@@ -2,6 +2,8 @@ import { existsSync } from "fs";
2
2
  import path from "path";
3
3
  import chalk from "chalk";
4
4
  import { getScriptDirectory, forge } from "@latticexyz/common/foundry";
5
+ import { execSync } from "child_process";
6
+ import { formatGwei } from "viem";
5
7
 
6
8
  export async function postDeploy(
7
9
  postDeployScript: string,
@@ -9,17 +11,35 @@ export async function postDeploy(
9
11
  rpc: string,
10
12
  profile: string | undefined,
11
13
  ): Promise<void> {
12
- // Execute postDeploy forge script
13
14
  const postDeployPath = path.join(await getScriptDirectory(), postDeployScript + ".s.sol");
14
- if (existsSync(postDeployPath)) {
15
- console.log(chalk.blue(`Executing post deploy script at ${postDeployPath}`));
16
- await forge(
17
- ["script", postDeployScript, "--sig", "run(address)", worldAddress, "--broadcast", "--rpc-url", rpc, "-vvv"],
18
- {
19
- profile: profile,
20
- },
21
- );
22
- } else {
15
+ if (!existsSync(postDeployPath)) {
23
16
  console.log(`No script at ${postDeployPath}, skipping post deploy hook`);
17
+ return;
24
18
  }
19
+
20
+ // TODO: replace this with a viem call
21
+ const gasPrice = BigInt(execSync(`cast gas-price --rpc-url ${rpc}`, { encoding: "utf-8" }).trim());
22
+
23
+ console.log(chalk.blue(`Executing post deploy script at ${postDeployPath}`));
24
+ console.log(chalk.blue(` using gas price of ${formatGwei(gasPrice)} gwei`));
25
+
26
+ await forge(
27
+ [
28
+ "script",
29
+ postDeployScript,
30
+ "--broadcast",
31
+ "--sig",
32
+ "run(address)",
33
+ worldAddress,
34
+ // TODO: also set priority fee?
35
+ "--with-gas-price",
36
+ gasPrice.toString(),
37
+ "--rpc-url",
38
+ rpc,
39
+ "-vvv",
40
+ ],
41
+ {
42
+ profile: profile,
43
+ },
44
+ );
25
45
  }