@latticexyz/cli 2.0.8-not-npmignore-cache-2d3a1a18 → 2.0.8-not-npmignore-cache-a91bf9e0
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-L6ZRKSMG.js → commands-NQNH6NTF.js} +22 -22
- package/dist/{commands-L6ZRKSMG.js.map → commands-NQNH6NTF.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 +77 -88
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-NQNH6NTF.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-a91bf9e0",
|
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-a91bf9e0",
|
48
|
+
"@latticexyz/common": "2.0.8-not-npmignore-cache-a91bf9e0",
|
49
|
+
"@latticexyz/config": "2.0.8-not-npmignore-cache-a91bf9e0",
|
50
|
+
"@latticexyz/gas-report": "2.0.8-not-npmignore-cache-a91bf9e0",
|
51
|
+
"@latticexyz/protocol-parser": "2.0.8-not-npmignore-cache-a91bf9e0",
|
52
|
+
"@latticexyz/schema-type": "2.0.8-not-npmignore-cache-a91bf9e0",
|
53
|
+
"@latticexyz/services": "2.0.8-not-npmignore-cache-a91bf9e0",
|
54
|
+
"@latticexyz/store": "2.0.8-not-npmignore-cache-a91bf9e0",
|
55
|
+
"@latticexyz/utils": "2.0.8-not-npmignore-cache-a91bf9e0",
|
56
|
+
"@latticexyz/world": "2.0.8-not-npmignore-cache-a91bf9e0",
|
57
|
+
"@latticexyz/world-modules": "2.0.8-not-npmignore-cache-a91bf9e0"
|
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,
|
@@ -55,133 +53,124 @@ export async function verify({
|
|
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
|
-
|
78
|
-
|
79
|
-
|
72
|
+
// If the verifier is Sourcify, attempt to verify MUD core contracts
|
73
|
+
// There are path issues with verifying Blockscout and Etherscan
|
74
|
+
if (verifier === "sourcify") {
|
75
|
+
// Install subdependencies so contracts can compile
|
76
|
+
await execa("npm", ["install"], {
|
77
|
+
cwd: "node_modules/@latticexyz/store",
|
78
|
+
});
|
80
79
|
await execa("npm", ["install"], {
|
81
|
-
cwd,
|
80
|
+
cwd: "node_modules/@latticexyz/world",
|
81
|
+
});
|
82
|
+
await execa("npm", ["install"], {
|
83
|
+
cwd: "node_modules/@latticexyz/world-modules",
|
82
84
|
});
|
83
85
|
|
84
86
|
Object.entries(
|
85
87
|
usesProxy ? getWorldProxyFactoryContracts(deployerAddress) : getWorldFactoryContracts(deployerAddress),
|
86
88
|
).map(([name, { bytecode }]) =>
|
87
89
|
verifyQueue.add(() =>
|
88
|
-
verifyContract(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
{
|
101
|
-
profile: foundryProfile,
|
102
|
-
cwd,
|
103
|
-
},
|
104
|
-
).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) => {
|
105
102
|
console.error(`Error verifying world factory contract ${name}:`, error);
|
106
103
|
}),
|
107
104
|
),
|
108
105
|
);
|
109
|
-
}
|
110
|
-
|
111
|
-
{
|
112
|
-
const cwd = "node_modules/@latticexyz/world-modules";
|
113
|
-
|
114
|
-
await execa("npm", ["install"], {
|
115
|
-
cwd,
|
116
|
-
});
|
117
106
|
|
118
107
|
modules.map(({ name, bytecode }) =>
|
119
108
|
verifyQueue.add(() =>
|
120
|
-
verifyContract(
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
{
|
133
|
-
profile: foundryProfile,
|
134
|
-
cwd,
|
135
|
-
},
|
136
|
-
).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) => {
|
137
121
|
console.error(`Error verifying module contract ${name}:`, error);
|
138
122
|
}),
|
139
123
|
),
|
140
124
|
);
|
141
|
-
}
|
142
|
-
|
143
|
-
{
|
144
|
-
const cwd = "node_modules/@latticexyz/world";
|
145
125
|
|
146
126
|
// If the world was deployed as a Proxy, verify the proxy and implementation.
|
147
127
|
if (usesProxy) {
|
148
128
|
const implementationAddress = sliceHex(implementationStorage, -20);
|
149
129
|
|
150
130
|
verifyQueue.add(() =>
|
151
|
-
verifyContract(
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
131
|
+
verifyContract({
|
132
|
+
cwd: "node_modules/@latticexyz/world",
|
133
|
+
name: "WorldProxy",
|
134
|
+
rpc,
|
135
|
+
verifier,
|
136
|
+
verifierUrl,
|
137
|
+
address: worldAddress,
|
138
|
+
}).catch((error) => {
|
158
139
|
console.error(`Error verifying WorldProxy contract:`, error);
|
159
140
|
}),
|
160
141
|
);
|
161
142
|
|
162
143
|
verifyQueue.add(() =>
|
163
|
-
verifyContract(
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
144
|
+
verifyContract({
|
145
|
+
cwd: "node_modules/@latticexyz/world",
|
146
|
+
name: "World",
|
147
|
+
rpc,
|
148
|
+
verifier,
|
149
|
+
verifierUrl,
|
150
|
+
address: implementationAddress,
|
151
|
+
}).catch((error) => {
|
170
152
|
console.error(`Error verifying World contract:`, error);
|
171
153
|
}),
|
172
154
|
);
|
173
155
|
} else {
|
174
156
|
verifyQueue.add(() =>
|
175
|
-
verifyContract(
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
157
|
+
verifyContract({
|
158
|
+
cwd: "node_modules/@latticexyz/world",
|
159
|
+
name: "World",
|
160
|
+
rpc,
|
161
|
+
verifier,
|
162
|
+
verifierUrl,
|
163
|
+
address: worldAddress,
|
164
|
+
}).catch((error) => {
|
182
165
|
console.error(`Error verifying World contract:`, error);
|
183
166
|
}),
|
184
167
|
);
|
185
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("");
|
186
175
|
}
|
187
176
|
}
|