@latticexyz/cli 1.34.0 → 1.35.0
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/commands/bulkupload.js +4 -24
- package/dist/commands/call-system.js +15 -38
- package/dist/commands/codegen-libdeploy.js +18 -39
- package/dist/commands/create.js +13 -35
- package/dist/commands/deploy-contracts.js +1220 -799
- package/dist/commands/deploy.js +750 -471
- package/dist/commands/devnode.js +12 -34
- package/dist/commands/diamond-abi.js +5 -25
- package/dist/commands/faucet.js +1063 -907
- package/dist/commands/gas-report.js +8065 -0
- package/dist/commands/sync-art.js +22 -44
- package/dist/commands/system-types.js +78 -98
- package/dist/commands/test.js +30 -55
- package/dist/commands/trace.js +20 -42
- package/dist/commands/types.js +2324 -1919
- package/package.json +10 -7
- package/src/commands/deploy-contracts.ts +35 -14
- package/src/commands/deploy.ts +1 -0
- package/src/commands/faucet.ts +2 -1
- package/src/commands/gas-report.ts +219 -0
- package/src/contracts/BulkUpload.sol +7 -9
- package/src/contracts/Deploy.sol +4 -8
- package/src/contracts/LibDeploy.ejs +18 -1
- package/src/utils/build.ts +9 -3
- package/src/utils/codegen.ts +3 -0
- package/src/utils/deploy.ts +2 -5
- package/src/contracts/Cheats.sol +0 -320
|
@@ -16,26 +16,6 @@ var __copyProps = (to, from, except, desc2) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __async = (__this, __arguments, generator) => {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
var fulfilled = (value) => {
|
|
22
|
-
try {
|
|
23
|
-
step(generator.next(value));
|
|
24
|
-
} catch (e) {
|
|
25
|
-
reject(e);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var rejected = (value) => {
|
|
29
|
-
try {
|
|
30
|
-
step(generator.throw(value));
|
|
31
|
-
} catch (e) {
|
|
32
|
-
reject(e);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
19
|
|
|
40
20
|
// src/commands/bulkupload.ts
|
|
41
21
|
var bulkupload_exports = {};
|
|
@@ -54,14 +34,14 @@ var builder = (yargs) => yargs.options({
|
|
|
54
34
|
worldAddress: { type: "string", demandOption: true, desc: "Contract address of the World to upload to" },
|
|
55
35
|
rpc: { type: "string", demandOption: true, desc: "JSON RPC endpoint" }
|
|
56
36
|
});
|
|
57
|
-
var handler = (argv) =>
|
|
58
|
-
const { execa } =
|
|
37
|
+
var handler = async (argv) => {
|
|
38
|
+
const { execa } = await importExeca;
|
|
59
39
|
const { statePath, worldAddress, rpc } = argv;
|
|
60
40
|
console.log("Uploading state at ", statePath, "to", worldAddress, "on", rpc);
|
|
61
41
|
const url = __dirname + "/../../src/contracts/BulkUpload.sol";
|
|
62
42
|
console.log("Using BulkUpload script from", url);
|
|
63
43
|
try {
|
|
64
|
-
|
|
44
|
+
await execa("forge", [
|
|
65
45
|
"script",
|
|
66
46
|
"--sig",
|
|
67
47
|
'"run(string, address)"',
|
|
@@ -75,7 +55,7 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
75
55
|
console.error(e);
|
|
76
56
|
}
|
|
77
57
|
process.exit(0);
|
|
78
|
-
}
|
|
58
|
+
};
|
|
79
59
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
60
|
0 && (module.exports = {
|
|
81
61
|
builder,
|
|
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
28
|
|
|
49
29
|
// ../../node_modules/bn.js/lib/bn.js
|
|
50
30
|
var require_bn = __commonJS({
|
|
@@ -204014,19 +203994,17 @@ function deferred() {
|
|
|
204014
203994
|
}
|
|
204015
203995
|
|
|
204016
203996
|
// src/utils/exec.ts
|
|
204017
|
-
function execLog(command2, options) {
|
|
204018
|
-
|
|
204019
|
-
|
|
204020
|
-
|
|
204021
|
-
|
|
204022
|
-
|
|
204023
|
-
|
|
204024
|
-
return promise;
|
|
204025
|
-
});
|
|
203997
|
+
async function execLog(command2, options) {
|
|
203998
|
+
console.log("Cmd:");
|
|
203999
|
+
console.log([command2, ...options].join(" "));
|
|
204000
|
+
const [resolve, , promise] = deferred();
|
|
204001
|
+
const child = (0, import_child_process.spawn)(command2, options, { stdio: [process.stdin, process.stdout, process.stderr] });
|
|
204002
|
+
child.on("exit", (code) => resolve({ exitCode: code ?? 0, child }));
|
|
204003
|
+
return promise;
|
|
204026
204004
|
}
|
|
204027
204005
|
|
|
204028
204006
|
// src/utils/ids.ts
|
|
204029
|
-
var IDregex = new RegExp(
|
|
204007
|
+
var IDregex = new RegExp(/(?<=uint256 constant ID = uint256\(keccak256\(")(.*)(?="\))/);
|
|
204030
204008
|
|
|
204031
204009
|
// src/utils/codegen.ts
|
|
204032
204010
|
var import_promises = require("fs/promises");
|
|
@@ -204504,7 +204482,7 @@ var contractsDir2 = __dirname + "/../../src/contracts";
|
|
|
204504
204482
|
|
|
204505
204483
|
// src/utils/hsr.ts
|
|
204506
204484
|
var import_chokidar = __toESM(require_chokidar());
|
|
204507
|
-
var ImportsRegex = new RegExp(
|
|
204485
|
+
var ImportsRegex = new RegExp(/(?<=import ").*(?=";)|(?<=from ").*(?=";)/g);
|
|
204508
204486
|
|
|
204509
204487
|
// src/commands/call-system.ts
|
|
204510
204488
|
var command = "call-system";
|
|
@@ -204525,18 +204503,17 @@ var builder = (yargs) => yargs.options({
|
|
|
204525
204503
|
},
|
|
204526
204504
|
debug: { type: "boolean", description: "open debugger" }
|
|
204527
204505
|
});
|
|
204528
|
-
var handler = (argv) =>
|
|
204529
|
-
var _a;
|
|
204506
|
+
var handler = async (argv) => {
|
|
204530
204507
|
const { rpc, caller, world, systemId, argTypes, args, calldata, broadcast, callerPrivateKey, debug } = argv;
|
|
204531
|
-
const encodedArgs =
|
|
204532
|
-
|
|
204508
|
+
const encodedArgs = calldata ?? (argTypes && args && import_utils.defaultAbiCoder.encode(argTypes, args)) ?? "";
|
|
204509
|
+
await execLog("forge", [
|
|
204533
204510
|
"script",
|
|
204534
204511
|
"--fork-url",
|
|
204535
|
-
rpc
|
|
204512
|
+
rpc ?? "http://localhost:8545",
|
|
204536
204513
|
"--sig",
|
|
204537
204514
|
"debug(address,address,string,bytes,bool)",
|
|
204538
204515
|
"src/test/utils/Debug.sol",
|
|
204539
|
-
caller
|
|
204516
|
+
caller ?? "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
|
|
204540
204517
|
world,
|
|
204541
204518
|
systemId || "",
|
|
204542
204519
|
encodedArgs,
|
|
@@ -204547,7 +204524,7 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
204547
204524
|
debug ? "--debug" : ""
|
|
204548
204525
|
]);
|
|
204549
204526
|
process.exit(0);
|
|
204550
|
-
}
|
|
204527
|
+
};
|
|
204551
204528
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204552
204529
|
0 && (module.exports = {
|
|
204553
204530
|
builder,
|
|
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
28
|
|
|
49
29
|
// ../../node_modules/ejs/lib/utils.js
|
|
50
30
|
var require_utils = __commonJS({
|
|
@@ -180792,7 +180772,7 @@ __export(codegen_libdeploy_exports, {
|
|
|
180792
180772
|
module.exports = __toCommonJS(codegen_libdeploy_exports);
|
|
180793
180773
|
|
|
180794
180774
|
// src/utils/ids.ts
|
|
180795
|
-
var IDregex = new RegExp(
|
|
180775
|
+
var IDregex = new RegExp(/(?<=uint256 constant ID = uint256\(keccak256\(")(.*)(?="\))/);
|
|
180796
180776
|
|
|
180797
180777
|
// src/utils/codegen.ts
|
|
180798
180778
|
var import_promises = require("fs/promises");
|
|
@@ -180800,21 +180780,20 @@ var import_ejs = __toESM(require_ejs());
|
|
|
180800
180780
|
var import_path = __toESM(require("path"));
|
|
180801
180781
|
var contractsDir = import_path.default.join(__dirname, "../../src/contracts");
|
|
180802
180782
|
var stubLibDeploy = (0, import_promises.readFile)(import_path.default.join(contractsDir, "LibDeployStub.sol"));
|
|
180803
|
-
function generateLibDeploy(configPath, out, systems) {
|
|
180804
|
-
|
|
180805
|
-
|
|
180806
|
-
|
|
180807
|
-
|
|
180808
|
-
|
|
180809
|
-
|
|
180810
|
-
|
|
180783
|
+
async function generateLibDeploy(configPath, out, systems) {
|
|
180784
|
+
const config = JSON.parse(await (0, import_promises.readFile)(configPath, { encoding: "utf8" }));
|
|
180785
|
+
config.initializers ??= [];
|
|
180786
|
+
if (systems) {
|
|
180787
|
+
const systemsArray = Array.isArray(systems) ? systems : [systems];
|
|
180788
|
+
config.systems = config.systems.filter((system) => systemsArray.includes(system.name));
|
|
180789
|
+
}
|
|
180790
|
+
console.log(`Deploy config:
|
|
180811
180791
|
`, JSON.stringify(config, null, 2));
|
|
180812
|
-
|
|
180813
|
-
|
|
180814
|
-
|
|
180815
|
-
|
|
180816
|
-
|
|
180817
|
-
});
|
|
180792
|
+
console.log("Generating deployment script");
|
|
180793
|
+
const LibDeploy = await import_ejs.default.renderFile(import_path.default.join(contractsDir, "LibDeploy.ejs"), config, { async: true });
|
|
180794
|
+
const libDeployPath = import_path.default.join(out, "LibDeploy.sol");
|
|
180795
|
+
await (0, import_promises.writeFile)(libDeployPath, LibDeploy);
|
|
180796
|
+
return libDeployPath;
|
|
180818
180797
|
}
|
|
180819
180798
|
|
|
180820
180799
|
// src/utils/types.ts
|
|
@@ -181286,7 +181265,7 @@ var contractsDir2 = __dirname + "/../../src/contracts";
|
|
|
181286
181265
|
|
|
181287
181266
|
// src/utils/hsr.ts
|
|
181288
181267
|
var import_chokidar = __toESM(require_chokidar());
|
|
181289
|
-
var ImportsRegex = new RegExp(
|
|
181268
|
+
var ImportsRegex = new RegExp(/(?<=import ").*(?=";)|(?<=from ").*(?=";)/g);
|
|
181290
181269
|
|
|
181291
181270
|
// src/commands/codegen-libdeploy.ts
|
|
181292
181271
|
var command = "codegen-libdeploy";
|
|
@@ -181296,11 +181275,11 @@ var builder = (yargs) => yargs.options({
|
|
|
181296
181275
|
out: { type: "string", default: ".", desc: "Output directory for LibDeploy.sol" },
|
|
181297
181276
|
systems: { type: "string", desc: "Only generate deploy code for the given systems" }
|
|
181298
181277
|
});
|
|
181299
|
-
var handler = (args) =>
|
|
181278
|
+
var handler = async (args) => {
|
|
181300
181279
|
const { config, out, systems } = args;
|
|
181301
|
-
|
|
181280
|
+
await generateLibDeploy(config, out, systems);
|
|
181302
181281
|
process.exit(0);
|
|
181303
|
-
}
|
|
181282
|
+
};
|
|
181304
181283
|
// Annotate the CommonJS export names for ESM import in node:
|
|
181305
181284
|
0 && (module.exports = {
|
|
181306
181285
|
builder,
|
package/dist/commands/create.js
CHANGED
|
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
28
|
|
|
49
29
|
// ../../node_modules/ejs/lib/utils.js
|
|
50
30
|
var require_utils = __commonJS({
|
|
@@ -180806,19 +180786,17 @@ function deferred() {
|
|
|
180806
180786
|
}
|
|
180807
180787
|
|
|
180808
180788
|
// src/utils/exec.ts
|
|
180809
|
-
function execLog(command2, options) {
|
|
180810
|
-
|
|
180811
|
-
|
|
180812
|
-
|
|
180813
|
-
|
|
180814
|
-
|
|
180815
|
-
|
|
180816
|
-
return promise;
|
|
180817
|
-
});
|
|
180789
|
+
async function execLog(command2, options) {
|
|
180790
|
+
console.log("Cmd:");
|
|
180791
|
+
console.log([command2, ...options].join(" "));
|
|
180792
|
+
const [resolve, , promise] = deferred();
|
|
180793
|
+
const child = (0, import_child_process.spawn)(command2, options, { stdio: [process.stdin, process.stdout, process.stderr] });
|
|
180794
|
+
child.on("exit", (code) => resolve({ exitCode: code ?? 0, child }));
|
|
180795
|
+
return promise;
|
|
180818
180796
|
}
|
|
180819
180797
|
|
|
180820
180798
|
// src/utils/ids.ts
|
|
180821
|
-
var IDregex = new RegExp(
|
|
180799
|
+
var IDregex = new RegExp(/(?<=uint256 constant ID = uint256\(keccak256\(")(.*)(?="\))/);
|
|
180822
180800
|
|
|
180823
180801
|
// src/utils/codegen.ts
|
|
180824
180802
|
var import_promises = require("fs/promises");
|
|
@@ -181296,7 +181274,7 @@ var contractsDir2 = __dirname + "/../../src/contracts";
|
|
|
181296
181274
|
|
|
181297
181275
|
// src/utils/hsr.ts
|
|
181298
181276
|
var import_chokidar = __toESM(require_chokidar());
|
|
181299
|
-
var ImportsRegex = new RegExp(
|
|
181277
|
+
var ImportsRegex = new RegExp(/(?<=import ").*(?=";)|(?<=from ").*(?=";)/g);
|
|
181300
181278
|
|
|
181301
181279
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
181302
181280
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -181772,19 +181750,19 @@ var desc = "Sets up a mud project into <name>. Requires yarn.";
|
|
|
181772
181750
|
var builder = (yargs) => yargs.options({
|
|
181773
181751
|
template: { type: "string", desc: "Template to be used (available: [minimal])", default: "minimal" }
|
|
181774
181752
|
}).positional("name", { type: "string", default: "mud-app" });
|
|
181775
|
-
var handler = (argv) =>
|
|
181753
|
+
var handler = async (argv) => {
|
|
181776
181754
|
const { name, template } = argv;
|
|
181777
181755
|
console.log(source_default.yellow.bold("Creating new mud project in", name));
|
|
181778
|
-
let result =
|
|
181756
|
+
let result = await execLog("git", ["clone", `https://github.com/latticexyz/mud-template-${template}`, name]);
|
|
181779
181757
|
if (result.exitCode != 0)
|
|
181780
181758
|
process.exit(result.exitCode);
|
|
181781
181759
|
console.log(source_default.yellow.bold("Installing dependencies..."));
|
|
181782
|
-
result =
|
|
181760
|
+
result = await execLog("yarn", ["--cwd", `./${name}`]);
|
|
181783
181761
|
if (result.exitCode != 0)
|
|
181784
181762
|
process.exit(result.exitCode);
|
|
181785
181763
|
console.log(source_default.yellow.bold(`Done! Run \`yarn dev\` in ${name} to get started.`));
|
|
181786
181764
|
process.exit(0);
|
|
181787
|
-
}
|
|
181765
|
+
};
|
|
181788
181766
|
// Annotate the CommonJS export names for ESM import in node:
|
|
181789
181767
|
0 && (module.exports = {
|
|
181790
181768
|
builder,
|