@latticexyz/cli 2.0.8-not-npmignore-cache-17f3bce8 → 2.0.8-not-npmignore-cache-193bc4da
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-PYQLPHGU.js → commands-4HBR2ZUA.js} +16 -16
- package/dist/{commands-PYQLPHGU.js.map → commands-4HBR2ZUA.js.map} +1 -1
- package/dist/mud.js +1 -1
- package/package.json +12 -12
- package/src/commands/verify.ts +1 -2
- package/src/verify/verifyContract.ts +3 -4
- package/src/verify.ts +68 -68
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-
|
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-4HBR2ZUA.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.8-not-npmignore-cache-
|
3
|
+
"version": "2.0.8-not-npmignore-cache-193bc4da",
|
4
4
|
"description": "Command line interface for mud",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -44,17 +44,17 @@
|
|
44
44
|
"yargs": "^17.7.1",
|
45
45
|
"zod": "^3.21.4",
|
46
46
|
"zod-validation-error": "^1.3.0",
|
47
|
-
"@latticexyz/abi-ts": "2.0.8-not-npmignore-cache-
|
48
|
-
"@latticexyz/common": "2.0.8-not-npmignore-cache-
|
49
|
-
"@latticexyz/config": "2.0.8-not-npmignore-cache-
|
50
|
-
"@latticexyz/gas-report": "2.0.8-not-npmignore-cache-
|
51
|
-
"@latticexyz/protocol-parser": "2.0.8-not-npmignore-cache-
|
52
|
-
"@latticexyz/schema-type": "2.0.8-not-npmignore-cache-
|
53
|
-
"@latticexyz/services": "2.0.8-not-npmignore-cache-
|
54
|
-
"@latticexyz/store": "2.0.8-not-npmignore-cache-
|
55
|
-
"@latticexyz/utils": "2.0.8-not-npmignore-cache-
|
56
|
-
"@latticexyz/world": "2.0.8-not-npmignore-cache-
|
57
|
-
"@latticexyz/world-modules": "2.0.8-not-npmignore-cache-
|
47
|
+
"@latticexyz/abi-ts": "2.0.8-not-npmignore-cache-193bc4da",
|
48
|
+
"@latticexyz/common": "2.0.8-not-npmignore-cache-193bc4da",
|
49
|
+
"@latticexyz/config": "2.0.8-not-npmignore-cache-193bc4da",
|
50
|
+
"@latticexyz/gas-report": "2.0.8-not-npmignore-cache-193bc4da",
|
51
|
+
"@latticexyz/protocol-parser": "2.0.8-not-npmignore-cache-193bc4da",
|
52
|
+
"@latticexyz/schema-type": "2.0.8-not-npmignore-cache-193bc4da",
|
53
|
+
"@latticexyz/services": "2.0.8-not-npmignore-cache-193bc4da",
|
54
|
+
"@latticexyz/store": "2.0.8-not-npmignore-cache-193bc4da",
|
55
|
+
"@latticexyz/utils": "2.0.8-not-npmignore-cache-193bc4da",
|
56
|
+
"@latticexyz/world": "2.0.8-not-npmignore-cache-193bc4da",
|
57
|
+
"@latticexyz/world-modules": "2.0.8-not-npmignore-cache-193bc4da"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
60
|
"@types/debug": "^4.1.7",
|
package/src/commands/verify.ts
CHANGED
@@ -25,7 +25,7 @@ const verifyOptions = {
|
|
25
25
|
desc: "Enable batch processing of RPC requests in viem client (defaults to batch size of 100 and wait of 1s)",
|
26
26
|
},
|
27
27
|
srcDir: { type: "string", desc: "Source directory. Defaults to foundry src directory." },
|
28
|
-
verifier: { type: "string", desc: "The verifier to use" },
|
28
|
+
verifier: { type: "string", desc: "The verifier to use. Default to sourcify", default: "sourcify" },
|
29
29
|
verifierUrl: {
|
30
30
|
type: "string",
|
31
31
|
desc: "The verification provider.",
|
@@ -97,7 +97,6 @@ const commandModule: CommandModule<Options, Options> = {
|
|
97
97
|
await verify({
|
98
98
|
client,
|
99
99
|
rpc,
|
100
|
-
foundryProfile: profile,
|
101
100
|
systems,
|
102
101
|
modules,
|
103
102
|
deployerAddress: opts.deployerAddress as Hex | undefined,
|
@@ -7,11 +7,10 @@ type VerifyContractOptions = {
|
|
7
7
|
verifier?: string;
|
8
8
|
verifierUrl?: string;
|
9
9
|
address: Address;
|
10
|
+
cwd?: string;
|
10
11
|
};
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
export async function verifyContract(options: VerifyContractOptions, forgeOptions?: ForgeOptions) {
|
13
|
+
export async function verifyContract(options: VerifyContractOptions) {
|
15
14
|
const args = ["verify-contract", options.address, options.name, "--rpc-url", options.rpc];
|
16
15
|
|
17
16
|
if (options.verifier) {
|
@@ -20,5 +19,5 @@ export async function verifyContract(options: VerifyContractOptions, forgeOption
|
|
20
19
|
if (options.verifierUrl) {
|
21
20
|
args.push("--verifier-url", options.verifierUrl);
|
22
21
|
}
|
23
|
-
await forge(args,
|
22
|
+
await forge(args, { cwd: options.cwd });
|
24
23
|
}
|
package/src/verify.ts
CHANGED
@@ -12,8 +12,7 @@ import { execa } from "execa";
|
|
12
12
|
type VerifyOptions = {
|
13
13
|
client: Client<Transport, Chain | undefined>;
|
14
14
|
rpc: string;
|
15
|
-
|
16
|
-
verifier?: string;
|
15
|
+
verifier: string;
|
17
16
|
verifierUrl?: string;
|
18
17
|
systems: { name: string; bytecode: Hex }[];
|
19
18
|
modules: { name: string; bytecode: Hex }[];
|
@@ -31,7 +30,6 @@ const ERC1967_IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076c
|
|
31
30
|
export async function verify({
|
32
31
|
client,
|
33
32
|
rpc,
|
34
|
-
foundryProfile = process.env.FOUNDRY_PROFILE,
|
35
33
|
systems,
|
36
34
|
modules,
|
37
35
|
worldAddress,
|
@@ -51,30 +49,28 @@ export async function verify({
|
|
51
49
|
});
|
52
50
|
const usesProxy = implementationStorage && implementationStorage !== zeroHash;
|
53
51
|
|
54
|
-
const verifyQueue = new PQueue({ concurrency:
|
52
|
+
const verifyQueue = new PQueue({ concurrency: 4 });
|
55
53
|
|
56
54
|
systems.map(({ name, bytecode }) =>
|
57
55
|
verifyQueue.add(() =>
|
58
|
-
verifyContract(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
},
|
70
|
-
{ profile: foundryProfile },
|
71
|
-
).catch((error) => {
|
56
|
+
verifyContract({
|
57
|
+
name,
|
58
|
+
rpc,
|
59
|
+
verifier,
|
60
|
+
verifierUrl,
|
61
|
+
address: getCreate2Address({
|
62
|
+
from: deployerAddress,
|
63
|
+
bytecode: bytecode,
|
64
|
+
salt,
|
65
|
+
}),
|
66
|
+
}).catch((error) => {
|
72
67
|
console.error(`Error verifying system contract ${name}:`, error);
|
73
68
|
}),
|
74
69
|
),
|
75
70
|
);
|
76
71
|
|
77
72
|
// If the verifier is Sourcify, attempt to verify MUD core contracts
|
73
|
+
// There are path issues with verifying Blockscout and Etherscan
|
78
74
|
if (verifier === "sourcify") {
|
79
75
|
// Install subdependencies so contracts can compile
|
80
76
|
await execa("npm", ["install"], {
|
@@ -91,22 +87,18 @@ export async function verify({
|
|
91
87
|
usesProxy ? getWorldProxyFactoryContracts(deployerAddress) : getWorldFactoryContracts(deployerAddress),
|
92
88
|
).map(([name, { bytecode }]) =>
|
93
89
|
verifyQueue.add(() =>
|
94
|
-
verifyContract(
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
{
|
107
|
-
cwd: "node_modules/@latticexyz/world",
|
108
|
-
},
|
109
|
-
).catch((error) => {
|
90
|
+
verifyContract({
|
91
|
+
cwd: "node_modules/@latticexyz/world",
|
92
|
+
name,
|
93
|
+
rpc,
|
94
|
+
verifier,
|
95
|
+
verifierUrl,
|
96
|
+
address: getCreate2Address({
|
97
|
+
from: deployerAddress,
|
98
|
+
bytecode: bytecode,
|
99
|
+
salt,
|
100
|
+
}),
|
101
|
+
}).catch((error) => {
|
110
102
|
console.error(`Error verifying world factory contract ${name}:`, error);
|
111
103
|
}),
|
112
104
|
),
|
@@ -114,22 +106,18 @@ export async function verify({
|
|
114
106
|
|
115
107
|
modules.map(({ name, bytecode }) =>
|
116
108
|
verifyQueue.add(() =>
|
117
|
-
verifyContract(
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
{
|
130
|
-
cwd: "node_modules/@latticexyz/world-modules",
|
131
|
-
},
|
132
|
-
).catch((error) => {
|
109
|
+
verifyContract({
|
110
|
+
cwd: "node_modules/@latticexyz/world-modules",
|
111
|
+
name: name,
|
112
|
+
rpc,
|
113
|
+
verifier,
|
114
|
+
verifierUrl,
|
115
|
+
address: getCreate2Address({
|
116
|
+
from: deployerAddress,
|
117
|
+
bytecode: bytecode,
|
118
|
+
salt,
|
119
|
+
}),
|
120
|
+
}).catch((error) => {
|
133
121
|
console.error(`Error verifying module contract ${name}:`, error);
|
134
122
|
}),
|
135
123
|
),
|
@@ -140,37 +128,49 @@ export async function verify({
|
|
140
128
|
const implementationAddress = sliceHex(implementationStorage, -20);
|
141
129
|
|
142
130
|
verifyQueue.add(() =>
|
143
|
-
verifyContract(
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
131
|
+
verifyContract({
|
132
|
+
cwd: "node_modules/@latticexyz/world",
|
133
|
+
name: "WorldProxy",
|
134
|
+
rpc,
|
135
|
+
verifier,
|
136
|
+
verifierUrl,
|
137
|
+
address: worldAddress,
|
138
|
+
}).catch((error) => {
|
149
139
|
console.error(`Error verifying WorldProxy contract:`, error);
|
150
140
|
}),
|
151
141
|
);
|
152
142
|
|
153
143
|
verifyQueue.add(() =>
|
154
|
-
verifyContract(
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
144
|
+
verifyContract({
|
145
|
+
cwd: "node_modules/@latticexyz/world",
|
146
|
+
name: "World",
|
147
|
+
rpc,
|
148
|
+
verifier,
|
149
|
+
verifierUrl,
|
150
|
+
address: implementationAddress,
|
151
|
+
}).catch((error) => {
|
160
152
|
console.error(`Error verifying World contract:`, error);
|
161
153
|
}),
|
162
154
|
);
|
163
155
|
} else {
|
164
156
|
verifyQueue.add(() =>
|
165
|
-
verifyContract(
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
157
|
+
verifyContract({
|
158
|
+
cwd: "node_modules/@latticexyz/world",
|
159
|
+
name: "World",
|
160
|
+
rpc,
|
161
|
+
verifier,
|
162
|
+
verifierUrl,
|
163
|
+
address: worldAddress,
|
164
|
+
}).catch((error) => {
|
171
165
|
console.error(`Error verifying World contract:`, error);
|
172
166
|
}),
|
173
167
|
);
|
174
168
|
}
|
169
|
+
} else {
|
170
|
+
console.log("");
|
171
|
+
console.log(
|
172
|
+
`Note: MUD is currently unable to verify store, world, and world-modules contracts with ${verifier}. We are planning to expand support in a future version.`,
|
173
|
+
);
|
174
|
+
console.log("");
|
175
175
|
}
|
176
176
|
}
|