@latticexyz/cli 2.0.12-main-9be2bb86 → 2.0.12-main-96e7bf43

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.
Files changed (68) hide show
  1. package/dist/{commands-F37Q2ISZ.js → commands-265RZEHD.js} +17 -17
  2. package/dist/commands-265RZEHD.js.map +1 -0
  3. package/dist/mud.js +1 -1
  4. package/package.json +13 -11
  5. package/dist/commands-F37Q2ISZ.js.map +0 -1
  6. package/src/build.ts +0 -32
  7. package/src/commands/build.ts +0 -35
  8. package/src/commands/deploy.ts +0 -26
  9. package/src/commands/dev-contracts.ts +0 -118
  10. package/src/commands/devnode.ts +0 -42
  11. package/src/commands/hello.ts +0 -28
  12. package/src/commands/index.ts +0 -33
  13. package/src/commands/set-version.ts +0 -197
  14. package/src/commands/tablegen.ts +0 -34
  15. package/src/commands/test.ts +0 -65
  16. package/src/commands/trace.ts +0 -120
  17. package/src/commands/verify.ts +0 -100
  18. package/src/commands/worldgen.ts +0 -58
  19. package/src/common.ts +0 -1
  20. package/src/debug.ts +0 -10
  21. package/src/deploy/common.ts +0 -120
  22. package/src/deploy/configToModules.ts +0 -75
  23. package/src/deploy/configToTables.ts +0 -70
  24. package/src/deploy/create2/README.md +0 -13
  25. package/src/deploy/create2/deployment.json +0 -8
  26. package/src/deploy/createPrepareDeploy.ts +0 -28
  27. package/src/deploy/debug.ts +0 -10
  28. package/src/deploy/deploy.ts +0 -137
  29. package/src/deploy/deployWorld.ts +0 -38
  30. package/src/deploy/ensureContract.ts +0 -66
  31. package/src/deploy/ensureContractsDeployed.ts +0 -33
  32. package/src/deploy/ensureDeployer.ts +0 -69
  33. package/src/deploy/ensureFunctions.ts +0 -86
  34. package/src/deploy/ensureModules.ts +0 -81
  35. package/src/deploy/ensureNamespaceOwner.ts +0 -71
  36. package/src/deploy/ensureSystems.ts +0 -187
  37. package/src/deploy/ensureTables.ts +0 -64
  38. package/src/deploy/ensureWorldFactory.ts +0 -30
  39. package/src/deploy/findLibraries.ts +0 -36
  40. package/src/deploy/getDeployer.ts +0 -20
  41. package/src/deploy/getFunctions.ts +0 -64
  42. package/src/deploy/getResourceAccess.ts +0 -51
  43. package/src/deploy/getResourceIds.ts +0 -45
  44. package/src/deploy/getSystems.ts +0 -47
  45. package/src/deploy/getTableValue.ts +0 -31
  46. package/src/deploy/getTables.ts +0 -59
  47. package/src/deploy/getWorldContracts.ts +0 -79
  48. package/src/deploy/getWorldDeploy.ts +0 -39
  49. package/src/deploy/getWorldFactoryContracts.ts +0 -27
  50. package/src/deploy/getWorldProxyFactoryContracts.ts +0 -27
  51. package/src/deploy/logsToWorldDeploy.ts +0 -49
  52. package/src/deploy/orderByDependencies.ts +0 -12
  53. package/src/deploy/resolveConfig.ts +0 -104
  54. package/src/index.ts +0 -1
  55. package/src/modules.d.ts +0 -11
  56. package/src/mud.ts +0 -45
  57. package/src/mudPackages.ts +0 -24
  58. package/src/runDeploy.ts +0 -181
  59. package/src/utils/errors.ts +0 -29
  60. package/src/utils/findPlaceholders.ts +0 -27
  61. package/src/utils/getContractArtifact.ts +0 -80
  62. package/src/utils/getContractData.ts +0 -38
  63. package/src/utils/getExistingContracts.ts +0 -12
  64. package/src/utils/knownModuleArtifacts.ts +0 -8
  65. package/src/utils/postDeploy.ts +0 -42
  66. package/src/utils/printMUD.ts +0 -14
  67. package/src/verify/verifyContract.ts +0 -23
  68. package/src/verify.ts +0 -174
package/src/verify.ts DELETED
@@ -1,174 +0,0 @@
1
- import { Chain, Client, Hex, Transport, getCreate2Address, sliceHex, zeroHash } from "viem";
2
- import { getWorldFactoryContracts } from "./deploy/getWorldFactoryContracts";
3
- import { verifyContract } from "./verify/verifyContract";
4
- import PQueue from "p-queue";
5
- import { getWorldProxyFactoryContracts } from "./deploy/getWorldProxyFactoryContracts";
6
- import { getDeployer } from "./deploy/getDeployer";
7
- import { MUDError } from "@latticexyz/common/errors";
8
- import { Module, salt } from "./deploy/common";
9
- import { getStorageAt } from "viem/actions";
10
- import { execa } from "execa";
11
-
12
- type VerifyOptions = {
13
- client: Client<Transport, Chain | undefined>;
14
- rpc: string;
15
- verifier: string;
16
- verifierUrl?: string;
17
- systems: { name: string; bytecode: Hex }[];
18
- modules: readonly Module[];
19
- worldAddress: Hex;
20
- /**
21
- * Address of determinstic deployment proxy: https://github.com/Arachnid/deterministic-deployment-proxy
22
- * By default, we look for a deployment at 0x4e59b44847b379578588920ca78fbf26c0b4956c.
23
- * If it is not deployed or the target chain does not support legacy transactions, the user must set the deployer manually.
24
- */
25
- deployerAddress?: Hex;
26
- };
27
-
28
- const ERC1967_IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
29
-
30
- export async function verify({
31
- client,
32
- rpc,
33
- systems,
34
- modules,
35
- worldAddress,
36
- deployerAddress: initialDeployerAddress,
37
- verifier,
38
- verifierUrl,
39
- }: VerifyOptions): Promise<void> {
40
- const deployerAddress = initialDeployerAddress ?? (await getDeployer(client));
41
- if (!deployerAddress) {
42
- throw new MUDError("No deployer address provided or found.");
43
- }
44
-
45
- // If the proxy implementation storage slot is set on the World, the World was deployed as a proxy.
46
- const implementationStorage = await getStorageAt(client, {
47
- address: worldAddress,
48
- slot: ERC1967_IMPLEMENTATION_SLOT,
49
- });
50
- const usesProxy = implementationStorage && implementationStorage !== zeroHash;
51
-
52
- const verifyQueue = new PQueue({ concurrency: 4 });
53
-
54
- systems.map(({ name, bytecode }) =>
55
- verifyQueue.add(() =>
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) => {
67
- console.error(`Error verifying system contract ${name}:`, error);
68
- }),
69
- ),
70
- );
71
-
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
- });
79
- await execa("npm", ["install"], {
80
- cwd: "node_modules/@latticexyz/world",
81
- });
82
- await execa("npm", ["install"], {
83
- cwd: "node_modules/@latticexyz/world-modules",
84
- });
85
-
86
- Object.entries(
87
- usesProxy ? getWorldProxyFactoryContracts(deployerAddress) : getWorldFactoryContracts(deployerAddress),
88
- ).map(([name, { bytecode }]) =>
89
- verifyQueue.add(() =>
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) => {
102
- console.error(`Error verifying world factory contract ${name}:`, error);
103
- }),
104
- ),
105
- );
106
-
107
- modules.map(({ name, prepareDeploy }) => {
108
- const { address } = prepareDeploy(deployerAddress, []);
109
- return verifyQueue.add(() =>
110
- verifyContract({
111
- // TODO: figure out dir from artifactPath via import.meta.resolve?
112
- cwd: "node_modules/@latticexyz/world-modules",
113
- name,
114
- rpc,
115
- verifier,
116
- verifierUrl,
117
- address,
118
- }).catch((error) => {
119
- console.error(`Error verifying module contract ${name}:`, error);
120
- }),
121
- );
122
- });
123
-
124
- // If the world was deployed as a Proxy, verify the proxy and implementation.
125
- if (usesProxy) {
126
- const implementationAddress = sliceHex(implementationStorage, -20);
127
-
128
- verifyQueue.add(() =>
129
- verifyContract({
130
- cwd: "node_modules/@latticexyz/world",
131
- name: "WorldProxy",
132
- rpc,
133
- verifier,
134
- verifierUrl,
135
- address: worldAddress,
136
- }).catch((error) => {
137
- console.error(`Error verifying WorldProxy contract:`, error);
138
- }),
139
- );
140
-
141
- verifyQueue.add(() =>
142
- verifyContract({
143
- cwd: "node_modules/@latticexyz/world",
144
- name: "World",
145
- rpc,
146
- verifier,
147
- verifierUrl,
148
- address: implementationAddress,
149
- }).catch((error) => {
150
- console.error(`Error verifying World contract:`, error);
151
- }),
152
- );
153
- } else {
154
- verifyQueue.add(() =>
155
- verifyContract({
156
- cwd: "node_modules/@latticexyz/world",
157
- name: "World",
158
- rpc,
159
- verifier,
160
- verifierUrl,
161
- address: worldAddress,
162
- }).catch((error) => {
163
- console.error(`Error verifying World contract:`, error);
164
- }),
165
- );
166
- }
167
- } else {
168
- console.log("");
169
- console.log(
170
- `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.`,
171
- );
172
- console.log("");
173
- }
174
- }