@latticexyz/cli 2.0.0-alpha.94 → 2.0.0-main-0d434816

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 (100) hide show
  1. package/dist/chunk-LFIOIY67.js +30 -0
  2. package/dist/chunk-LFIOIY67.js.map +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/mud.js +15 -8340
  6. package/dist/mud.js.map +1 -0
  7. package/package.json +45 -43
  8. package/src/commands/deploy.ts +49 -0
  9. package/src/commands/dev-contracts.ts +176 -0
  10. package/src/commands/devnode.ts +7 -2
  11. package/src/commands/faucet.ts +1 -1
  12. package/src/commands/index.ts +18 -13
  13. package/src/commands/set-version.ts +38 -10
  14. package/src/commands/tablegen.ts +5 -4
  15. package/src/commands/{test-v2.ts → test.ts} +5 -6
  16. package/src/commands/trace.ts +108 -0
  17. package/src/commands/tsgen.ts +4 -3
  18. package/src/commands/worldgen.ts +29 -28
  19. package/src/index.ts +2 -1
  20. package/src/modules.d.ts +11 -0
  21. package/src/mud.ts +10 -4
  22. package/src/render-ts/recsV1TableOptions.ts +4 -4
  23. package/src/render-ts/renderRecsV1Tables.ts +3 -3
  24. package/src/render-ts/schemaTypesToRecsTypeStrings.ts +33 -33
  25. package/src/render-ts/tsgen.ts +4 -4
  26. package/src/utils/{deploy-v2.ts → deploy.ts} +207 -123
  27. package/src/utils/deployHandler.ts +87 -0
  28. package/src/utils/errors.ts +1 -1
  29. package/src/utils/getExistingContracts.ts +12 -0
  30. package/src/utils/index.ts +7 -5
  31. package/src/utils/printMUD.ts +14 -0
  32. package/src/utils/worldtypes.ts +21 -0
  33. package/dist/chunk-6V563IAZ.js +0 -283
  34. package/dist/chunk-FPG73MVN.js +0 -71
  35. package/dist/chunk-L4YLJHLJ.js +0 -30
  36. package/dist/chunk-SKNB74MT.js +0 -726
  37. package/dist/chunk-T2YHSEJD.js +0 -3842
  38. package/dist/chunk-VQTZJIFF.js +0 -353
  39. package/dist/chunk-WZFXLDPK.js +0 -761
  40. package/dist/chunk-YL4GJLLL.js +0 -26139
  41. package/dist/index.d.ts +0 -2
  42. package/dist/mud.d.ts +0 -1
  43. package/dist/mud2.d.ts +0 -1
  44. package/dist/mud2.js +0 -25
  45. package/dist/render-solidity/index.d.ts +0 -171
  46. package/dist/render-solidity/index.js +0 -49
  47. package/dist/render-ts/index.d.ts +0 -26
  48. package/dist/render-ts/index.js +0 -14
  49. package/dist/utils/deprecated/index.d.ts +0 -76
  50. package/dist/utils/deprecated/index.js +0 -36
  51. package/dist/utils/index.d.ts +0 -88
  52. package/dist/utils/index.js +0 -39
  53. package/src/commands/deploy-v2.ts +0 -112
  54. package/src/commands/deprecated/bulkupload.ts +0 -50
  55. package/src/commands/deprecated/call-system.ts +0 -70
  56. package/src/commands/deprecated/codegen-libdeploy.ts +0 -29
  57. package/src/commands/deprecated/deploy-contracts.ts +0 -120
  58. package/src/commands/deprecated/index.ts +0 -22
  59. package/src/commands/deprecated/system-types.ts +0 -29
  60. package/src/commands/deprecated/test.ts +0 -53
  61. package/src/commands/deprecated/trace.ts +0 -81
  62. package/src/commands/deprecated/types.ts +0 -33
  63. package/src/commands/gas-report.ts +0 -219
  64. package/src/contracts/BulkUpload.sol +0 -174
  65. package/src/contracts/Deploy.sol +0 -23
  66. package/src/contracts/LibDeploy.ejs +0 -121
  67. package/src/contracts/LibDeploy.sol +0 -23
  68. package/src/contracts/LibDeployStub.sol +0 -23
  69. package/src/mud2.ts +0 -29
  70. package/src/render-solidity/common.ts +0 -138
  71. package/src/render-solidity/field.ts +0 -160
  72. package/src/render-solidity/index.ts +0 -10
  73. package/src/render-solidity/record.ts +0 -158
  74. package/src/render-solidity/renderSystemInterface.ts +0 -31
  75. package/src/render-solidity/renderTable.ts +0 -164
  76. package/src/render-solidity/renderTableIndex.ts +0 -15
  77. package/src/render-solidity/renderTypeHelpers.ts +0 -99
  78. package/src/render-solidity/renderTypes.ts +0 -19
  79. package/src/render-solidity/renderTypesFromConfig.ts +0 -13
  80. package/src/render-solidity/renderWorld.ts +0 -24
  81. package/src/render-solidity/tableOptions.ts +0 -107
  82. package/src/render-solidity/tablegen.ts +0 -35
  83. package/src/render-solidity/types.ts +0 -111
  84. package/src/render-solidity/userType.ts +0 -131
  85. package/src/render-solidity/worldgen.ts +0 -59
  86. package/src/utils/contractToInterface.ts +0 -132
  87. package/src/utils/deprecated/build.ts +0 -55
  88. package/src/utils/deprecated/codegen.ts +0 -42
  89. package/src/utils/deprecated/constants.ts +0 -2
  90. package/src/utils/deprecated/deploy.ts +0 -111
  91. package/src/utils/deprecated/exec.ts +0 -18
  92. package/src/utils/deprecated/findLog.ts +0 -8
  93. package/src/utils/deprecated/hsr.ts +0 -71
  94. package/src/utils/deprecated/ids.ts +0 -14
  95. package/src/utils/deprecated/index.ts +0 -8
  96. package/src/utils/deprecated/typegen.ts +0 -133
  97. package/src/utils/execLog.ts +0 -22
  98. package/src/utils/format.ts +0 -39
  99. package/src/utils/formatAndWrite.ts +0 -21
  100. package/src/utils/foundry.ts +0 -103
@@ -0,0 +1,14 @@
1
+ import chalk from "chalk";
2
+
3
+ export function printMUD() {
4
+ console.log(
5
+ chalk.yellow(`
6
+ .------..------..------.
7
+ |M.--. ||U.--. ||D.--. |
8
+ | (\\/) || (\\/) || :/\\: |
9
+ | :\\/: || :\\/: || (__) |
10
+ | '--'M|| '--'U|| '--'D|
11
+ '------''------''------'
12
+ `)
13
+ );
14
+ }
@@ -0,0 +1,21 @@
1
+ import { getOutDirectory } from "@latticexyz/common/foundry";
2
+ import path from "path";
3
+ import { runTypeChain } from "typechain";
4
+
5
+ /**
6
+ * Generate IWorld typescript bindings
7
+ */
8
+ export async function worldtypes() {
9
+ const cwd = process.cwd();
10
+ const forgeOurDir = await getOutDirectory();
11
+ const IWorldPath = path.join(process.cwd(), forgeOurDir, "IWorld.sol/IWorld.json");
12
+
13
+ await runTypeChain({
14
+ cwd,
15
+ filesToProcess: [IWorldPath],
16
+ allFiles: [IWorldPath],
17
+ target: "ethers-v5",
18
+ });
19
+
20
+ console.log("Typechain generated IWorld interface");
21
+ }
@@ -1,283 +0,0 @@
1
- import {
2
- formatAndWriteTypescript,
3
- resolveAbiOrUserType
4
- } from "./chunk-SKNB74MT.js";
5
-
6
- // src/render-ts/schemaTypesToRecsTypeStrings.ts
7
- var schemaTypesToRecsTypeStrings = {
8
- [0 /* UINT8 */]: "RecsType.Number",
9
- [1 /* UINT16 */]: "RecsType.Number",
10
- [2 /* UINT24 */]: "RecsType.Number",
11
- [3 /* UINT32 */]: "RecsType.Number",
12
- [4 /* UINT40 */]: "RecsType.Number",
13
- [5 /* UINT48 */]: "RecsType.Number",
14
- [6 /* UINT56 */]: "RecsType.BigInt",
15
- [7 /* UINT64 */]: "RecsType.BigInt",
16
- [8 /* UINT72 */]: "RecsType.BigInt",
17
- [9 /* UINT80 */]: "RecsType.BigInt",
18
- [10 /* UINT88 */]: "RecsType.BigInt",
19
- [11 /* UINT96 */]: "RecsType.BigInt",
20
- [12 /* UINT104 */]: "RecsType.BigInt",
21
- [13 /* UINT112 */]: "RecsType.BigInt",
22
- [14 /* UINT120 */]: "RecsType.BigInt",
23
- [15 /* UINT128 */]: "RecsType.BigInt",
24
- [16 /* UINT136 */]: "RecsType.BigInt",
25
- [17 /* UINT144 */]: "RecsType.BigInt",
26
- [18 /* UINT152 */]: "RecsType.BigInt",
27
- [19 /* UINT160 */]: "RecsType.BigInt",
28
- [20 /* UINT168 */]: "RecsType.BigInt",
29
- [21 /* UINT176 */]: "RecsType.BigInt",
30
- [22 /* UINT184 */]: "RecsType.BigInt",
31
- [23 /* UINT192 */]: "RecsType.BigInt",
32
- [24 /* UINT200 */]: "RecsType.BigInt",
33
- [25 /* UINT208 */]: "RecsType.BigInt",
34
- [26 /* UINT216 */]: "RecsType.BigInt",
35
- [27 /* UINT224 */]: "RecsType.BigInt",
36
- [28 /* UINT232 */]: "RecsType.BigInt",
37
- [29 /* UINT240 */]: "RecsType.BigInt",
38
- [30 /* UINT248 */]: "RecsType.BigInt",
39
- [31 /* UINT256 */]: "RecsType.BigInt",
40
- [32 /* INT8 */]: "RecsType.Number",
41
- [33 /* INT16 */]: "RecsType.Number",
42
- [34 /* INT24 */]: "RecsType.Number",
43
- [35 /* INT32 */]: "RecsType.Number",
44
- [36 /* INT40 */]: "RecsType.Number",
45
- [37 /* INT48 */]: "RecsType.Number",
46
- [38 /* INT56 */]: "RecsType.BigInt",
47
- [39 /* INT64 */]: "RecsType.BigInt",
48
- [40 /* INT72 */]: "RecsType.BigInt",
49
- [41 /* INT80 */]: "RecsType.BigInt",
50
- [42 /* INT88 */]: "RecsType.BigInt",
51
- [43 /* INT96 */]: "RecsType.BigInt",
52
- [44 /* INT104 */]: "RecsType.BigInt",
53
- [45 /* INT112 */]: "RecsType.BigInt",
54
- [46 /* INT120 */]: "RecsType.BigInt",
55
- [47 /* INT128 */]: "RecsType.BigInt",
56
- [48 /* INT136 */]: "RecsType.BigInt",
57
- [49 /* INT144 */]: "RecsType.BigInt",
58
- [50 /* INT152 */]: "RecsType.BigInt",
59
- [51 /* INT160 */]: "RecsType.BigInt",
60
- [52 /* INT168 */]: "RecsType.BigInt",
61
- [53 /* INT176 */]: "RecsType.BigInt",
62
- [54 /* INT184 */]: "RecsType.BigInt",
63
- [55 /* INT192 */]: "RecsType.BigInt",
64
- [56 /* INT200 */]: "RecsType.BigInt",
65
- [57 /* INT208 */]: "RecsType.BigInt",
66
- [58 /* INT216 */]: "RecsType.BigInt",
67
- [59 /* INT224 */]: "RecsType.BigInt",
68
- [60 /* INT232 */]: "RecsType.BigInt",
69
- [61 /* INT240 */]: "RecsType.BigInt",
70
- [62 /* INT248 */]: "RecsType.BigInt",
71
- [63 /* INT256 */]: "RecsType.BigInt",
72
- [64 /* BYTES1 */]: "RecsType.String",
73
- [65 /* BYTES2 */]: "RecsType.String",
74
- [66 /* BYTES3 */]: "RecsType.String",
75
- [67 /* BYTES4 */]: "RecsType.String",
76
- [68 /* BYTES5 */]: "RecsType.String",
77
- [69 /* BYTES6 */]: "RecsType.String",
78
- [70 /* BYTES7 */]: "RecsType.String",
79
- [71 /* BYTES8 */]: "RecsType.String",
80
- [72 /* BYTES9 */]: "RecsType.String",
81
- [73 /* BYTES10 */]: "RecsType.String",
82
- [74 /* BYTES11 */]: "RecsType.String",
83
- [75 /* BYTES12 */]: "RecsType.String",
84
- [76 /* BYTES13 */]: "RecsType.String",
85
- [77 /* BYTES14 */]: "RecsType.String",
86
- [78 /* BYTES15 */]: "RecsType.String",
87
- [79 /* BYTES16 */]: "RecsType.String",
88
- [80 /* BYTES17 */]: "RecsType.String",
89
- [81 /* BYTES18 */]: "RecsType.String",
90
- [82 /* BYTES19 */]: "RecsType.String",
91
- [83 /* BYTES20 */]: "RecsType.String",
92
- [84 /* BYTES21 */]: "RecsType.String",
93
- [85 /* BYTES22 */]: "RecsType.String",
94
- [86 /* BYTES23 */]: "RecsType.String",
95
- [87 /* BYTES24 */]: "RecsType.String",
96
- [88 /* BYTES25 */]: "RecsType.String",
97
- [89 /* BYTES26 */]: "RecsType.String",
98
- [90 /* BYTES27 */]: "RecsType.String",
99
- [91 /* BYTES28 */]: "RecsType.String",
100
- [92 /* BYTES29 */]: "RecsType.String",
101
- [93 /* BYTES30 */]: "RecsType.String",
102
- [94 /* BYTES31 */]: "RecsType.String",
103
- [95 /* BYTES32 */]: "RecsType.String",
104
- [96 /* BOOL */]: "RecsType.Boolean",
105
- [97 /* ADDRESS */]: "RecsType.String",
106
- [98 /* UINT8_ARRAY */]: "RecsType.NumberArray",
107
- [99 /* UINT16_ARRAY */]: "RecsType.NumberArray",
108
- [100 /* UINT24_ARRAY */]: "RecsType.NumberArray",
109
- [101 /* UINT32_ARRAY */]: "RecsType.NumberArray",
110
- [102 /* UINT40_ARRAY */]: "RecsType.NumberArray",
111
- [103 /* UINT48_ARRAY */]: "RecsType.NumberArray",
112
- [104 /* UINT56_ARRAY */]: "RecsType.BigIntArray",
113
- [105 /* UINT64_ARRAY */]: "RecsType.BigIntArray",
114
- [106 /* UINT72_ARRAY */]: "RecsType.BigIntArray",
115
- [107 /* UINT80_ARRAY */]: "RecsType.BigIntArray",
116
- [108 /* UINT88_ARRAY */]: "RecsType.BigIntArray",
117
- [109 /* UINT96_ARRAY */]: "RecsType.BigIntArray",
118
- [110 /* UINT104_ARRAY */]: "RecsType.BigIntArray",
119
- [111 /* UINT112_ARRAY */]: "RecsType.BigIntArray",
120
- [112 /* UINT120_ARRAY */]: "RecsType.BigIntArray",
121
- [113 /* UINT128_ARRAY */]: "RecsType.BigIntArray",
122
- [114 /* UINT136_ARRAY */]: "RecsType.BigIntArray",
123
- [115 /* UINT144_ARRAY */]: "RecsType.BigIntArray",
124
- [116 /* UINT152_ARRAY */]: "RecsType.BigIntArray",
125
- [117 /* UINT160_ARRAY */]: "RecsType.BigIntArray",
126
- [118 /* UINT168_ARRAY */]: "RecsType.BigIntArray",
127
- [119 /* UINT176_ARRAY */]: "RecsType.BigIntArray",
128
- [120 /* UINT184_ARRAY */]: "RecsType.BigIntArray",
129
- [121 /* UINT192_ARRAY */]: "RecsType.BigIntArray",
130
- [122 /* UINT200_ARRAY */]: "RecsType.BigIntArray",
131
- [123 /* UINT208_ARRAY */]: "RecsType.BigIntArray",
132
- [124 /* UINT216_ARRAY */]: "RecsType.BigIntArray",
133
- [125 /* UINT224_ARRAY */]: "RecsType.BigIntArray",
134
- [126 /* UINT232_ARRAY */]: "RecsType.BigIntArray",
135
- [127 /* UINT240_ARRAY */]: "RecsType.BigIntArray",
136
- [128 /* UINT248_ARRAY */]: "RecsType.BigIntArray",
137
- [129 /* UINT256_ARRAY */]: "RecsType.BigIntArray",
138
- [130 /* INT8_ARRAY */]: "RecsType.NumberArray",
139
- [131 /* INT16_ARRAY */]: "RecsType.NumberArray",
140
- [132 /* INT24_ARRAY */]: "RecsType.NumberArray",
141
- [133 /* INT32_ARRAY */]: "RecsType.NumberArray",
142
- [134 /* INT40_ARRAY */]: "RecsType.NumberArray",
143
- [135 /* INT48_ARRAY */]: "RecsType.NumberArray",
144
- [136 /* INT56_ARRAY */]: "RecsType.BigIntArray",
145
- [137 /* INT64_ARRAY */]: "RecsType.BigIntArray",
146
- [138 /* INT72_ARRAY */]: "RecsType.BigIntArray",
147
- [139 /* INT80_ARRAY */]: "RecsType.BigIntArray",
148
- [140 /* INT88_ARRAY */]: "RecsType.BigIntArray",
149
- [141 /* INT96_ARRAY */]: "RecsType.BigIntArray",
150
- [142 /* INT104_ARRAY */]: "RecsType.BigIntArray",
151
- [143 /* INT112_ARRAY */]: "RecsType.BigIntArray",
152
- [144 /* INT120_ARRAY */]: "RecsType.BigIntArray",
153
- [145 /* INT128_ARRAY */]: "RecsType.BigIntArray",
154
- [146 /* INT136_ARRAY */]: "RecsType.BigIntArray",
155
- [147 /* INT144_ARRAY */]: "RecsType.BigIntArray",
156
- [148 /* INT152_ARRAY */]: "RecsType.BigIntArray",
157
- [149 /* INT160_ARRAY */]: "RecsType.BigIntArray",
158
- [150 /* INT168_ARRAY */]: "RecsType.BigIntArray",
159
- [151 /* INT176_ARRAY */]: "RecsType.BigIntArray",
160
- [152 /* INT184_ARRAY */]: "RecsType.BigIntArray",
161
- [153 /* INT192_ARRAY */]: "RecsType.BigIntArray",
162
- [154 /* INT200_ARRAY */]: "RecsType.BigIntArray",
163
- [155 /* INT208_ARRAY */]: "RecsType.BigIntArray",
164
- [156 /* INT216_ARRAY */]: "RecsType.BigIntArray",
165
- [157 /* INT224_ARRAY */]: "RecsType.BigIntArray",
166
- [158 /* INT232_ARRAY */]: "RecsType.BigIntArray",
167
- [159 /* INT240_ARRAY */]: "RecsType.BigIntArray",
168
- [160 /* INT248_ARRAY */]: "RecsType.BigIntArray",
169
- [161 /* INT256_ARRAY */]: "RecsType.BigIntArray",
170
- [162 /* BYTES1_ARRAY */]: "RecsType.BigIntArray",
171
- [163 /* BYTES2_ARRAY */]: "RecsType.BigIntArray",
172
- [164 /* BYTES3_ARRAY */]: "RecsType.BigIntArray",
173
- [165 /* BYTES4_ARRAY */]: "RecsType.BigIntArray",
174
- [166 /* BYTES5_ARRAY */]: "RecsType.BigIntArray",
175
- [167 /* BYTES6_ARRAY */]: "RecsType.BigIntArray",
176
- [168 /* BYTES7_ARRAY */]: "RecsType.BigIntArray",
177
- [169 /* BYTES8_ARRAY */]: "RecsType.BigIntArray",
178
- [170 /* BYTES9_ARRAY */]: "RecsType.BigIntArray",
179
- [171 /* BYTES10_ARRAY */]: "RecsType.BigIntArray",
180
- [172 /* BYTES11_ARRAY */]: "RecsType.BigIntArray",
181
- [173 /* BYTES12_ARRAY */]: "RecsType.BigIntArray",
182
- [174 /* BYTES13_ARRAY */]: "RecsType.BigIntArray",
183
- [175 /* BYTES14_ARRAY */]: "RecsType.BigIntArray",
184
- [176 /* BYTES15_ARRAY */]: "RecsType.BigIntArray",
185
- [177 /* BYTES16_ARRAY */]: "RecsType.BigIntArray",
186
- [178 /* BYTES17_ARRAY */]: "RecsType.BigIntArray",
187
- [179 /* BYTES18_ARRAY */]: "RecsType.BigIntArray",
188
- [180 /* BYTES19_ARRAY */]: "RecsType.BigIntArray",
189
- [181 /* BYTES20_ARRAY */]: "RecsType.BigIntArray",
190
- [182 /* BYTES21_ARRAY */]: "RecsType.BigIntArray",
191
- [183 /* BYTES22_ARRAY */]: "RecsType.BigIntArray",
192
- [184 /* BYTES23_ARRAY */]: "RecsType.BigIntArray",
193
- [185 /* BYTES24_ARRAY */]: "RecsType.BigIntArray",
194
- [186 /* BYTES25_ARRAY */]: "RecsType.BigIntArray",
195
- [187 /* BYTES26_ARRAY */]: "RecsType.BigIntArray",
196
- [188 /* BYTES27_ARRAY */]: "RecsType.BigIntArray",
197
- [189 /* BYTES28_ARRAY */]: "RecsType.BigIntArray",
198
- [190 /* BYTES29_ARRAY */]: "RecsType.BigIntArray",
199
- [191 /* BYTES30_ARRAY */]: "RecsType.BigIntArray",
200
- [192 /* BYTES31_ARRAY */]: "RecsType.BigIntArray",
201
- [193 /* BYTES32_ARRAY */]: "RecsType.BigIntArray",
202
- [194 /* BOOL_ARRAY */]: "RecsType.T",
203
- // no boolean array
204
- [195 /* ADDRESS_ARRAY */]: "RecsType.StringArray",
205
- [196 /* BYTES */]: "RecsType.String",
206
- [197 /* STRING */]: "RecsType.String"
207
- };
208
-
209
- // src/render-ts/recsV1TableOptions.ts
210
- function getRecsV1TableOptions(config) {
211
- const tableOptions = [];
212
- for (const tableName of Object.keys(config.tables)) {
213
- const tableData = config.tables[tableName];
214
- const fields = Object.keys(tableData.schema).map((name) => {
215
- const abiOrUserType = tableData.schema[name];
216
- const { schemaType } = resolveAbiOrUserType(abiOrUserType, config);
217
- const recsTypeString = schemaTypesToRecsTypeStrings[schemaType];
218
- return {
219
- recsTypeString,
220
- name
221
- };
222
- });
223
- if (tableData.tableIdArgument)
224
- continue;
225
- const staticResourceData = {
226
- namespace: config.namespace,
227
- name: tableData.name
228
- };
229
- tableOptions.push({
230
- tableName,
231
- fields,
232
- staticResourceData
233
- });
234
- }
235
- return {
236
- tables: tableOptions
237
- };
238
- }
239
-
240
- // src/render-ts/renderRecsV1Tables.ts
241
- function renderRecsV1Tables(options) {
242
- const { tables } = options;
243
- return `/* Autogenerated file. Do not edit manually. */
244
-
245
- import { TableId } from "@latticexyz/utils";
246
- import { defineComponent, Type as RecsType, World } from "@latticexyz/recs";
247
-
248
- export function defineContractComponents(world: World) {
249
- return {
250
- ${tables.map((table) => `${table.tableName}: ${renderDefineComponent(table)},`).join("")}
251
- }
252
- }
253
- `;
254
- }
255
- function renderDefineComponent(table) {
256
- const { namespace, name } = table.staticResourceData;
257
- return `
258
- (() => {
259
- const tableId = new TableId("${namespace}", "${name}");
260
- return defineComponent(world, {
261
- ${table.fields.map(({ name: name2, recsTypeString }) => `${name2}: ${recsTypeString},`).join("")}
262
- }, {
263
- metadata: { contractId: tableId.toHexString(), tableId: tableId.toString() },
264
- });
265
- })()
266
- `;
267
- }
268
-
269
- // src/render-ts/tsgen.ts
270
- import path from "path";
271
- async function tsgen(config, outDirectory) {
272
- const fullOutputPath = path.join(outDirectory, `contractComponents.ts`);
273
- const options = getRecsV1TableOptions(config);
274
- const output = renderRecsV1Tables(options);
275
- formatAndWriteTypescript(output, fullOutputPath, "Generated ts definition files");
276
- }
277
-
278
- export {
279
- schemaTypesToRecsTypeStrings,
280
- getRecsV1TableOptions,
281
- renderRecsV1Tables,
282
- tsgen
283
- };
@@ -1,71 +0,0 @@
1
- // src/utils/foundry.ts
2
- import { execa as execa2 } from "execa";
3
-
4
- // src/utils/execLog.ts
5
- import chalk from "chalk";
6
- import { execa } from "execa";
7
- async function execLog(command, args, options) {
8
- const commandString = `${command} ${args.join(" ")}`;
9
- try {
10
- console.log(chalk.gray(`running "${commandString}"`));
11
- const { stdout } = await execa(command, args, { stdout: "pipe", stderr: "pipe", ...options });
12
- return stdout;
13
- } catch (error) {
14
- let errorMessage = error?.stderr || error?.message || "";
15
- errorMessage += chalk.red(`
16
- Error running "${commandString}"`);
17
- throw new Error(errorMessage);
18
- }
19
- }
20
-
21
- // src/utils/foundry.ts
22
- async function getForgeConfig(profile) {
23
- const { stdout } = await execa2("forge", ["config", "--json"], {
24
- stdio: ["inherit", "pipe", "pipe"],
25
- env: { FOUNDRY_PROFILE: profile }
26
- });
27
- return JSON.parse(stdout);
28
- }
29
- async function getSrcDirectory(profile) {
30
- return (await getForgeConfig(profile)).src;
31
- }
32
- async function getScriptDirectory(profile) {
33
- return (await getForgeConfig(profile)).script;
34
- }
35
- async function getTestDirectory(profile) {
36
- return (await getForgeConfig(profile)).test;
37
- }
38
- async function getOutDirectory(profile) {
39
- return (await getForgeConfig(profile)).out;
40
- }
41
- async function getRpcUrl(profile) {
42
- return (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
43
- }
44
- async function forge(args, options) {
45
- const execOptions = {
46
- env: { FOUNDRY_PROFILE: options?.profile },
47
- stdout: "inherit",
48
- stderr: "pipe"
49
- };
50
- await (options?.silent ? execa2("forge", args, execOptions) : execLog("forge", args, execOptions));
51
- }
52
- async function cast(args, options) {
53
- return execLog("cast", args, {
54
- env: { FOUNDRY_PROFILE: options?.profile }
55
- });
56
- }
57
- async function anvil(args) {
58
- return execLog("anvil", args);
59
- }
60
-
61
- export {
62
- getForgeConfig,
63
- getSrcDirectory,
64
- getScriptDirectory,
65
- getTestDirectory,
66
- getOutDirectory,
67
- getRpcUrl,
68
- forge,
69
- cast,
70
- anvil
71
- };
@@ -1,30 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- export {
28
- __commonJS,
29
- __toESM
30
- };