@latticexyz/cli 1.30.1 → 1.31.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/LICENSE +1 -1
- package/dist/commands/devnode.js +8 -1
- package/dist/commands/faucet.js +1 -41
- package/dist/commands/trace.js +4 -1
- package/package.json +6 -6
- package/src/commands/devnode.ts +8 -1
- package/src/commands/trace.ts +4 -2
- package/src/contracts/Cheats.sol +1 -1
- package/src/contracts/LibDeploy.ejs +8 -7
- package/src/contracts/LibDeploy.sol +8 -66
package/LICENSE
CHANGED
package/dist/commands/devnode.js
CHANGED
|
@@ -181304,7 +181304,14 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
181304
181304
|
console.log("Clearing devnode history");
|
|
181305
181305
|
const userHomeDir = (0, import_os3.homedir)();
|
|
181306
181306
|
(0, import_fs.rmSync)(import_path2.default.join(userHomeDir, ".foundry", "anvil", "tmp"), { recursive: true, force: true });
|
|
181307
|
-
const { child } = yield execLog("anvil", [
|
|
181307
|
+
const { child } = yield execLog("anvil", [
|
|
181308
|
+
"-b",
|
|
181309
|
+
String(blocktime),
|
|
181310
|
+
"--block-base-fee-per-gas",
|
|
181311
|
+
"0",
|
|
181312
|
+
"--gas-limit",
|
|
181313
|
+
"100000000"
|
|
181314
|
+
]);
|
|
181308
181315
|
process.on("SIGINT", () => {
|
|
181309
181316
|
console.log("\ngracefully shutting down from SIGINT (Crtl-C)");
|
|
181310
181317
|
child.kill();
|
package/dist/commands/faucet.js
CHANGED
|
@@ -5083,46 +5083,6 @@ var DripRequest = {
|
|
|
5083
5083
|
return message;
|
|
5084
5084
|
}
|
|
5085
5085
|
};
|
|
5086
|
-
function createBaseDripVerifyTweetRequest() {
|
|
5087
|
-
return { username: "", address: "" };
|
|
5088
|
-
}
|
|
5089
|
-
var DripVerifyTweetRequest = {
|
|
5090
|
-
encode(message, writer = import_minimal.default.Writer.create()) {
|
|
5091
|
-
if (message.username !== "") {
|
|
5092
|
-
writer.uint32(10).string(message.username);
|
|
5093
|
-
}
|
|
5094
|
-
if (message.address !== "") {
|
|
5095
|
-
writer.uint32(18).string(message.address);
|
|
5096
|
-
}
|
|
5097
|
-
return writer;
|
|
5098
|
-
},
|
|
5099
|
-
decode(input, length) {
|
|
5100
|
-
const reader = input instanceof import_minimal.default.Reader ? input : new import_minimal.default.Reader(input);
|
|
5101
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5102
|
-
const message = createBaseDripVerifyTweetRequest();
|
|
5103
|
-
while (reader.pos < end) {
|
|
5104
|
-
const tag = reader.uint32();
|
|
5105
|
-
switch (tag >>> 3) {
|
|
5106
|
-
case 1:
|
|
5107
|
-
message.username = reader.string();
|
|
5108
|
-
break;
|
|
5109
|
-
case 2:
|
|
5110
|
-
message.address = reader.string();
|
|
5111
|
-
break;
|
|
5112
|
-
default:
|
|
5113
|
-
reader.skipType(tag & 7);
|
|
5114
|
-
break;
|
|
5115
|
-
}
|
|
5116
|
-
}
|
|
5117
|
-
return message;
|
|
5118
|
-
},
|
|
5119
|
-
fromPartial(object) {
|
|
5120
|
-
const message = createBaseDripVerifyTweetRequest();
|
|
5121
|
-
message.username = object.username ?? "";
|
|
5122
|
-
message.address = object.address ?? "";
|
|
5123
|
-
return message;
|
|
5124
|
-
}
|
|
5125
|
-
};
|
|
5126
5086
|
function createBaseDripDevRequest() {
|
|
5127
5087
|
return { address: "" };
|
|
5128
5088
|
}
|
|
@@ -5522,7 +5482,7 @@ var FaucetServiceDefinition = {
|
|
|
5522
5482
|
},
|
|
5523
5483
|
dripVerifyTweet: {
|
|
5524
5484
|
name: "DripVerifyTweet",
|
|
5525
|
-
requestType:
|
|
5485
|
+
requestType: DripRequest,
|
|
5526
5486
|
requestStream: false,
|
|
5527
5487
|
responseType: DripResponse,
|
|
5528
5488
|
responseStream: false,
|
package/dist/commands/trace.js
CHANGED
|
@@ -217058,7 +217058,8 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
217058
217058
|
const wd = process.cwd();
|
|
217059
217059
|
const deployData = config && JSON.parse((0, import_fs2.readFileSync)(config, { encoding: "utf8" }));
|
|
217060
217060
|
const labels = [];
|
|
217061
|
-
const
|
|
217061
|
+
const rpcUrl = rpc || "http://localhost:8545";
|
|
217062
|
+
const provider = new import_providers.JsonRpcProvider(rpcUrl);
|
|
217062
217063
|
const World = new import_ethers.Contract(world, abi, provider);
|
|
217063
217064
|
if (deployData) {
|
|
217064
217065
|
const componentPromises = deployData.components.map((component) => __async(void 0, null, function* () {
|
|
@@ -217085,6 +217086,8 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
217085
217086
|
"run",
|
|
217086
217087
|
...labels.map((label) => ["--label", `${label[1]}:${label[0]}`]).flat(),
|
|
217087
217088
|
...debug ? ["--debug"] : [],
|
|
217089
|
+
`--rpc-url`,
|
|
217090
|
+
`${rpcUrl}`,
|
|
217088
217091
|
`${tx}`
|
|
217089
217092
|
]);
|
|
217090
217093
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Command line interface for mud",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"typescript": "^4.6.4"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@latticexyz/services": "^1.
|
|
41
|
-
"@latticexyz/solecs": "^1.
|
|
42
|
-
"@latticexyz/std-contracts": "^1.
|
|
43
|
-
"@latticexyz/utils": "^1.
|
|
40
|
+
"@latticexyz/services": "^1.31.0",
|
|
41
|
+
"@latticexyz/solecs": "^1.31.0",
|
|
42
|
+
"@latticexyz/std-contracts": "^1.31.0",
|
|
43
|
+
"@latticexyz/utils": "^1.31.0",
|
|
44
44
|
"@typechain/ethers-v5": "^10.1.1",
|
|
45
45
|
"chalk": "^5.0.1",
|
|
46
46
|
"chokidar": "^3.5.3",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"pkg": {
|
|
71
71
|
"scripts": "build/**/*.js"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "a1a0d627e3800039b3b9179a23927aa599bc6e2a"
|
|
74
74
|
}
|
package/src/commands/devnode.ts
CHANGED
|
@@ -21,7 +21,14 @@ export const handler = async (argv: Arguments<Options>): Promise<void> => {
|
|
|
21
21
|
console.log("Clearing devnode history");
|
|
22
22
|
const userHomeDir = homedir();
|
|
23
23
|
rmSync(path.join(userHomeDir, ".foundry", "anvil", "tmp"), { recursive: true, force: true });
|
|
24
|
-
const { child } = await execLog("anvil", [
|
|
24
|
+
const { child } = await execLog("anvil", [
|
|
25
|
+
"-b",
|
|
26
|
+
String(blocktime),
|
|
27
|
+
"--block-base-fee-per-gas",
|
|
28
|
+
"0",
|
|
29
|
+
"--gas-limit",
|
|
30
|
+
"100000000",
|
|
31
|
+
]);
|
|
25
32
|
|
|
26
33
|
process.on("SIGINT", () => {
|
|
27
34
|
console.log("\ngracefully shutting down from SIGINT (Crtl-C)");
|
package/src/commands/trace.ts
CHANGED
|
@@ -31,7 +31,8 @@ export const handler = async (argv: Arguments<Options>): Promise<void> => {
|
|
|
31
31
|
const deployData = config && JSON.parse(readFileSync(config, { encoding: "utf8" }));
|
|
32
32
|
const labels = [];
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const rpcUrl = rpc || "http://localhost:8545";
|
|
35
|
+
const provider = new JsonRpcProvider(rpcUrl);
|
|
35
36
|
const World = new Contract(world, WorldAbi, provider);
|
|
36
37
|
|
|
37
38
|
if (deployData) {
|
|
@@ -57,11 +58,12 @@ export const handler = async (argv: Arguments<Options>): Promise<void> => {
|
|
|
57
58
|
|
|
58
59
|
labels.push(...components, ...systems);
|
|
59
60
|
}
|
|
60
|
-
|
|
61
61
|
await execLog("cast", [
|
|
62
62
|
"run",
|
|
63
63
|
...labels.map((label) => ["--label", `${label[1]}:${label[0]}`]).flat(),
|
|
64
64
|
...(debug ? ["--debug"] : []),
|
|
65
|
+
`--rpc-url`,
|
|
66
|
+
`${rpcUrl}`,
|
|
65
67
|
`${tx}`,
|
|
66
68
|
]);
|
|
67
69
|
|
package/src/contracts/Cheats.sol
CHANGED
|
@@ -8,8 +8,9 @@ import { DSTest } from "ds-test/test.sol";
|
|
|
8
8
|
import { console } from "forge-std/console.sol";
|
|
9
9
|
|
|
10
10
|
// Solecs
|
|
11
|
+
import { IWorld } from "solecs/interfaces/IWorld.sol";
|
|
11
12
|
import { World } from "solecs/World.sol";
|
|
12
|
-
import {
|
|
13
|
+
import { IComponent } from "solecs/interfaces/IComponent.sol";
|
|
13
14
|
import { getAddressById } from "solecs/utils.sol";
|
|
14
15
|
import { IUint256Component } from "solecs/interfaces/IUint256Component.sol";
|
|
15
16
|
import { ISystem } from "solecs/interfaces/ISystem.sol";
|
|
@@ -25,7 +26,7 @@ import { <%= system.name %>, ID as <%= system.name %>ID } from "systems/<%- syst
|
|
|
25
26
|
<% }); -%>
|
|
26
27
|
|
|
27
28
|
struct DeployResult {
|
|
28
|
-
|
|
29
|
+
IWorld world;
|
|
29
30
|
address deployer;
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -42,12 +43,12 @@ library LibDeploy {
|
|
|
42
43
|
// ------------------------
|
|
43
44
|
|
|
44
45
|
// Deploy world
|
|
45
|
-
result.world = _world == address(0) ? new World() :
|
|
46
|
+
result.world = _world == address(0) ? new World() : IWorld(_world);
|
|
46
47
|
if (_world == address(0)) result.world.init(); // Init if it's a fresh world
|
|
47
48
|
|
|
48
49
|
// Deploy components
|
|
49
50
|
if (!_reuseComponents) {
|
|
50
|
-
|
|
51
|
+
IComponent comp;
|
|
51
52
|
<% components.forEach(component => { -%>
|
|
52
53
|
|
|
53
54
|
console.log("Deploying <%= component %>");
|
|
@@ -65,7 +66,7 @@ library LibDeploy {
|
|
|
65
66
|
uint256 componentId,
|
|
66
67
|
address writer
|
|
67
68
|
) internal {
|
|
68
|
-
|
|
69
|
+
IComponent(getAddressById(components, componentId)).authorizeWriter(writer);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -76,7 +77,7 @@ library LibDeploy {
|
|
|
76
77
|
address _world,
|
|
77
78
|
bool init
|
|
78
79
|
) internal {
|
|
79
|
-
|
|
80
|
+
IWorld world = IWorld(_world);
|
|
80
81
|
// Deploy systems
|
|
81
82
|
ISystem system;
|
|
82
83
|
IUint256Component components = world.components();
|
|
@@ -100,4 +101,4 @@ library LibDeploy {
|
|
|
100
101
|
console.log(address(system));
|
|
101
102
|
<% });-%>
|
|
102
103
|
}
|
|
103
|
-
}
|
|
104
|
+
}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity >=0.8.0;
|
|
3
3
|
|
|
4
|
-
// NOTE:
|
|
4
|
+
// NOTE: THIS IS A STUB TO MAKE IMPORTS WORK.
|
|
5
|
+
// The real LibDeploy.sol is generated automatically
|
|
6
|
+
// when calling `mud test` or `mud deploy-contracts`.
|
|
7
|
+
// To manually generate the real LibDeploy.sol use
|
|
8
|
+
// `mud codegen-libdeploy`.
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
import {DSTest} from "ds-test/test.sol";
|
|
8
|
-
import {console} from "forge-std/console.sol";
|
|
9
|
-
|
|
10
|
-
// Solecs
|
|
11
|
-
import {World} from "solecs/World.sol";
|
|
12
|
-
import {Component} from "solecs/Component.sol";
|
|
13
|
-
import {getAddressById} from "solecs/utils.sol";
|
|
14
|
-
import {IUint256Component} from "solecs/interfaces/IUint256Component.sol";
|
|
15
|
-
import {ISystem} from "solecs/interfaces/ISystem.sol";
|
|
16
|
-
|
|
17
|
-
// Components (requires 'components=...' remapping in project's remappings.txt)
|
|
18
|
-
import {CounterComponent, ID as CounterComponentID} from "components/CounterComponent.sol";
|
|
19
|
-
|
|
20
|
-
// Systems (requires 'systems=...' remapping in project's remappings.txt)
|
|
21
|
-
import {IncrementSystem, ID as IncrementSystemID} from "systems/IncrementSystem.sol";
|
|
10
|
+
import {IWorld} from "solecs/interfaces/IWorld.sol";
|
|
22
11
|
|
|
23
12
|
struct DeployResult {
|
|
24
|
-
|
|
13
|
+
IWorld world;
|
|
25
14
|
address deployer;
|
|
26
15
|
}
|
|
27
16
|
|
|
@@ -30,52 +19,5 @@ library LibDeploy {
|
|
|
30
19
|
address _deployer,
|
|
31
20
|
address _world,
|
|
32
21
|
bool _reuseComponents
|
|
33
|
-
) internal returns (DeployResult memory result) {
|
|
34
|
-
result.deployer = _deployer;
|
|
35
|
-
|
|
36
|
-
// ------------------------
|
|
37
|
-
// Deploy
|
|
38
|
-
// ------------------------
|
|
39
|
-
|
|
40
|
-
// Deploy world
|
|
41
|
-
result.world = _world == address(0) ? new World() : World(_world);
|
|
42
|
-
if (_world == address(0)) result.world.init(); // Init if it's a fresh world
|
|
43
|
-
|
|
44
|
-
// Deploy components
|
|
45
|
-
if (!_reuseComponents) {
|
|
46
|
-
Component comp;
|
|
47
|
-
|
|
48
|
-
console.log("Deploying CounterComponent");
|
|
49
|
-
comp = new CounterComponent(address(result.world));
|
|
50
|
-
console.log(address(comp));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Deploy systems
|
|
54
|
-
deploySystems(address(result.world), true);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function authorizeWriter(
|
|
58
|
-
IUint256Component components,
|
|
59
|
-
uint256 componentId,
|
|
60
|
-
address writer
|
|
61
|
-
) internal {
|
|
62
|
-
Component(getAddressById(components, componentId)).authorizeWriter(writer);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Deploy systems to the given world.
|
|
67
|
-
* If `init` flag is set, systems with `initialize` setting in `deploy.json` will be executed.
|
|
68
|
-
*/
|
|
69
|
-
function deploySystems(address _world, bool init) internal {
|
|
70
|
-
World world = World(_world);
|
|
71
|
-
// Deploy systems
|
|
72
|
-
ISystem system;
|
|
73
|
-
IUint256Component components = world.components();
|
|
74
|
-
|
|
75
|
-
console.log("Deploying IncrementSystem");
|
|
76
|
-
system = new IncrementSystem(world, address(components));
|
|
77
|
-
world.registerSystem(address(system), IncrementSystemID);
|
|
78
|
-
authorizeWriter(components, CounterComponentID, address(system));
|
|
79
|
-
console.log(address(system));
|
|
80
|
-
}
|
|
22
|
+
) internal returns (DeployResult memory result) {}
|
|
81
23
|
}
|