@latticexyz/cli 1.41.0 → 2.0.0-alpha.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/dist/{chunk-GR245KYP.js → chunk-J4DJQNIC.js} +679 -133
- package/dist/chunk-O57QENJ6.js +23039 -0
- package/dist/config/index.d.ts +606 -292
- package/dist/config/index.js +49 -26
- package/dist/index.d.ts +2 -110
- package/dist/index.js +9 -50
- package/dist/mud.js +937 -57
- package/dist/utils/index.d.ts +92 -4
- package/dist/utils/index.js +2 -3
- package/package.json +10 -9
- package/src/commands/deploy-v2.ts +11 -15
- package/src/commands/index.ts +2 -0
- package/src/commands/worldgen.ts +55 -0
- package/src/config/commonSchemas.ts +11 -13
- package/src/config/dynamicResolution.ts +49 -0
- package/src/config/index.ts +15 -3
- package/src/config/loadStoreConfig.ts +1 -1
- package/src/config/parseStoreConfig.test-d.ts +31 -5
- package/src/config/parseStoreConfig.ts +218 -78
- package/src/config/validation.ts +25 -0
- package/src/config/world/index.ts +4 -0
- package/src/config/{loadWorldConfig.test-d.ts → world/loadWorldConfig.test-d.ts} +3 -3
- package/src/config/world/loadWorldConfig.ts +26 -0
- package/src/config/world/parseWorldConfig.ts +55 -0
- package/src/config/world/resolveWorldConfig.ts +80 -0
- package/src/config/world/userTypes.ts +72 -0
- package/src/index.ts +4 -6
- package/src/render-solidity/common.ts +51 -6
- package/src/render-solidity/field.ts +40 -44
- package/src/render-solidity/index.ts +5 -1
- package/src/render-solidity/record.ts +56 -73
- package/src/render-solidity/renderSystemInterface.ts +31 -0
- package/src/render-solidity/renderTable.ts +98 -70
- package/src/render-solidity/renderTypeHelpers.ts +99 -0
- package/src/render-solidity/renderTypesFromConfig.ts +2 -2
- package/src/render-solidity/renderWorld.ts +24 -0
- package/src/render-solidity/{renderTablesFromConfig.ts → tableOptions.ts} +28 -30
- package/src/render-solidity/tablegen.ts +20 -22
- package/src/render-solidity/types.ts +39 -5
- package/src/render-solidity/userType.ts +80 -48
- package/src/render-solidity/worldgen.ts +60 -0
- package/src/utils/contractToInterface.ts +130 -0
- package/src/utils/deploy-v2.ts +268 -101
- package/src/utils/formatAndWrite.ts +12 -0
- package/src/utils/getChainId.ts +10 -0
- package/src/utils/typeUtils.ts +17 -0
- package/dist/chunk-AER7UDD4.js +0 -0
- package/dist/chunk-XRS7KWBZ.js +0 -547
- package/dist/chunk-YZATC2M3.js +0 -397
- package/dist/chunk-ZYDMYSTH.js +0 -1178
- package/dist/deploy-v2-b7b3207d.d.ts +0 -92
- package/src/config/loadWorldConfig.ts +0 -178
- package/src/constants.ts +0 -1
|
@@ -1,6 +1,166 @@
|
|
|
1
|
+
// src/config/commonSchemas.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
// src/config/validation.ts
|
|
5
|
+
import { ethers } from "ethers";
|
|
6
|
+
import { ZodIssueCode } from "zod";
|
|
7
|
+
function validateName(name, ctx) {
|
|
8
|
+
if (!/^\w+$/.test(name)) {
|
|
9
|
+
ctx.addIssue({
|
|
10
|
+
code: ZodIssueCode.custom,
|
|
11
|
+
message: `Name must contain only alphanumeric & underscore characters`
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function validateCapitalizedName(name, ctx) {
|
|
16
|
+
validateName(name, ctx);
|
|
17
|
+
if (!/^[A-Z]/.test(name)) {
|
|
18
|
+
ctx.addIssue({
|
|
19
|
+
code: ZodIssueCode.custom,
|
|
20
|
+
message: `Name must start with a capital letter`
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function validateUncapitalizedName(name, ctx) {
|
|
25
|
+
validateName(name, ctx);
|
|
26
|
+
if (!/^[a-z]/.test(name)) {
|
|
27
|
+
ctx.addIssue({
|
|
28
|
+
code: ZodIssueCode.custom,
|
|
29
|
+
message: `Name must start with a lowercase letter`
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function validateEnum(members, ctx) {
|
|
34
|
+
if (members.length === 0) {
|
|
35
|
+
ctx.addIssue({
|
|
36
|
+
code: ZodIssueCode.custom,
|
|
37
|
+
message: `Enum must not be empty`
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (members.length >= 256) {
|
|
41
|
+
ctx.addIssue({
|
|
42
|
+
code: ZodIssueCode.custom,
|
|
43
|
+
message: `Length of enum must be < 256`
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const duplicates = getDuplicates(members);
|
|
47
|
+
if (duplicates.length > 0) {
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
code: ZodIssueCode.custom,
|
|
50
|
+
message: `Enum must not have duplicate names for: ${duplicates.join(", ")}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function _factoryForValidateRoute(requireNonEmpty, requireSingleLevel) {
|
|
55
|
+
return (route, ctx) => {
|
|
56
|
+
if (route === "") {
|
|
57
|
+
if (requireNonEmpty) {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: ZodIssueCode.custom,
|
|
60
|
+
message: `Route must not be empty`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (route[0] !== "/") {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: ZodIssueCode.custom,
|
|
68
|
+
message: `Route must start with "/"`
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (route[route.length - 1] === "/") {
|
|
72
|
+
ctx.addIssue({
|
|
73
|
+
code: ZodIssueCode.custom,
|
|
74
|
+
message: `Route must not end with "/"`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const parts = route.split("/");
|
|
78
|
+
if (requireSingleLevel && parts.length > 2) {
|
|
79
|
+
ctx.addIssue({
|
|
80
|
+
code: ZodIssueCode.custom,
|
|
81
|
+
message: `Route must only have one level (e.g. "/foo")`
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
for (let i = 1; i < parts.length; i++) {
|
|
85
|
+
if (parts[i] === "") {
|
|
86
|
+
ctx.addIssue({
|
|
87
|
+
code: ZodIssueCode.custom,
|
|
88
|
+
message: `Route must not contain empty route fragments (e.g. "//")`
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (!/^\w+$/.test(parts[i])) {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: ZodIssueCode.custom,
|
|
94
|
+
message: `Route must contain only alphanumeric & underscore characters`
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
var validateRoute = _factoryForValidateRoute(true, false);
|
|
101
|
+
var validateBaseRoute = _factoryForValidateRoute(false, false);
|
|
102
|
+
var validateSingleLevelRoute = _factoryForValidateRoute(true, true);
|
|
103
|
+
function validateEthereumAddress(address, ctx) {
|
|
104
|
+
if (!ethers.utils.isAddress(address)) {
|
|
105
|
+
ctx.addIssue({
|
|
106
|
+
code: ZodIssueCode.custom,
|
|
107
|
+
message: `Address must be a valid Ethereum address`
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getDuplicates(array) {
|
|
112
|
+
const checked = /* @__PURE__ */ new Set();
|
|
113
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
114
|
+
for (const element of array) {
|
|
115
|
+
if (checked.has(element)) {
|
|
116
|
+
duplicates.add(element);
|
|
117
|
+
}
|
|
118
|
+
checked.add(element);
|
|
119
|
+
}
|
|
120
|
+
return [...duplicates];
|
|
121
|
+
}
|
|
122
|
+
function validateSelector(name, ctx) {
|
|
123
|
+
if (name.length > 16) {
|
|
124
|
+
ctx.addIssue({
|
|
125
|
+
code: ZodIssueCode.custom,
|
|
126
|
+
message: `Selector must be <= 16 characters`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (!/^\w*$/.test(name)) {
|
|
130
|
+
ctx.addIssue({
|
|
131
|
+
code: ZodIssueCode.custom,
|
|
132
|
+
message: `Selector must contain only alphanumeric & underscore characters`
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function parseStaticArray(abiType) {
|
|
137
|
+
const matches = abiType.match(/^(\w+)\[(\d+)\]$/);
|
|
138
|
+
if (!matches)
|
|
139
|
+
return null;
|
|
140
|
+
return {
|
|
141
|
+
elementType: matches[1],
|
|
142
|
+
staticLength: Number.parseInt(matches[2])
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/config/commonSchemas.ts
|
|
147
|
+
var zObjectName = z.string().superRefine(validateCapitalizedName);
|
|
148
|
+
var zValueName = z.string().superRefine(validateUncapitalizedName);
|
|
149
|
+
var zAnyCaseName = z.string().superRefine(validateName);
|
|
150
|
+
var zUserEnum = z.array(zObjectName).superRefine(validateEnum);
|
|
151
|
+
var zOrdinaryRoute = z.string().superRefine(validateRoute);
|
|
152
|
+
var zSingleLevelRoute = z.string().superRefine(validateSingleLevelRoute);
|
|
153
|
+
var zBaseRoute = z.string().superRefine(validateBaseRoute);
|
|
154
|
+
var zEthereumAddress = z.string().superRefine(validateEthereumAddress);
|
|
155
|
+
var zSelector = z.string().superRefine(validateSelector);
|
|
156
|
+
|
|
157
|
+
// src/config/loadConfig.ts
|
|
158
|
+
import { findUp } from "find-up";
|
|
159
|
+
import path from "path";
|
|
160
|
+
|
|
1
161
|
// src/utils/errors.ts
|
|
2
162
|
import chalk from "chalk";
|
|
3
|
-
import { z, ZodError, ZodIssueCode } from "zod";
|
|
163
|
+
import { z as z2, ZodError, ZodIssueCode as ZodIssueCode2 } from "zod";
|
|
4
164
|
import { fromZodError, ValidationError } from "zod-validation-error";
|
|
5
165
|
function fromZodErrorCustom(error, prefix) {
|
|
6
166
|
return fromZodError(error, {
|
|
@@ -29,8 +189,8 @@ var MUDError = class extends Error {
|
|
|
29
189
|
this.name = "MUDError";
|
|
30
190
|
}
|
|
31
191
|
};
|
|
32
|
-
function UnrecognizedSystemErrorFactory(
|
|
33
|
-
return new
|
|
192
|
+
function UnrecognizedSystemErrorFactory(path2, systemName) {
|
|
193
|
+
return new z2.ZodError([{ code: ZodIssueCode2.custom, path: path2, message: `Unrecognized system: "${systemName}"` }]);
|
|
34
194
|
}
|
|
35
195
|
function logError(error) {
|
|
36
196
|
if (error instanceof ValidationError) {
|
|
@@ -58,6 +218,42 @@ function logError(error) {
|
|
|
58
218
|
}
|
|
59
219
|
}
|
|
60
220
|
|
|
221
|
+
// src/config/loadConfig.ts
|
|
222
|
+
var configFiles = ["mud.config.ts", "mud.config.mts"];
|
|
223
|
+
async function loadConfig(configPath) {
|
|
224
|
+
configPath = await resolveConfigPath(configPath);
|
|
225
|
+
try {
|
|
226
|
+
return (await import(configPath)).default;
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (error instanceof SyntaxError && error.message === "Cannot use import statement outside a module") {
|
|
229
|
+
throw new NotESMConfigError();
|
|
230
|
+
} else {
|
|
231
|
+
throw error;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async function resolveConfigPath(configPath) {
|
|
236
|
+
if (configPath === void 0) {
|
|
237
|
+
configPath = await getUserConfigPath();
|
|
238
|
+
} else {
|
|
239
|
+
if (!path.isAbsolute(configPath)) {
|
|
240
|
+
configPath = path.join(process.cwd(), configPath);
|
|
241
|
+
configPath = path.normalize(configPath);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return configPath;
|
|
245
|
+
}
|
|
246
|
+
async function getUserConfigPath() {
|
|
247
|
+
const tsConfigPath = await findUp(configFiles);
|
|
248
|
+
if (tsConfigPath === void 0) {
|
|
249
|
+
throw new NotInsideProjectError();
|
|
250
|
+
}
|
|
251
|
+
return tsConfigPath;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/config/loadStoreConfig.ts
|
|
255
|
+
import { ZodError as ZodError2 } from "zod";
|
|
256
|
+
|
|
61
257
|
// ../schema-type/src/typescript/SchemaType.ts
|
|
62
258
|
var SchemaType = /* @__PURE__ */ ((SchemaType2) => {
|
|
63
259
|
SchemaType2[SchemaType2["UINT8"] = 0] = "UINT8";
|
|
@@ -260,6 +456,8 @@ var SchemaType = /* @__PURE__ */ ((SchemaType2) => {
|
|
|
260
456
|
SchemaType2[SchemaType2["STRING"] = 197] = "STRING";
|
|
261
457
|
return SchemaType2;
|
|
262
458
|
})(SchemaType || {});
|
|
459
|
+
|
|
460
|
+
// ../schema-type/src/typescript/getStaticByteLength.ts
|
|
263
461
|
function getStaticByteLength(schemaType) {
|
|
264
462
|
const val = schemaType.valueOf();
|
|
265
463
|
if (val < 32) {
|
|
@@ -276,7 +474,140 @@ function getStaticByteLength(schemaType) {
|
|
|
276
474
|
}
|
|
277
475
|
return 0;
|
|
278
476
|
}
|
|
279
|
-
|
|
477
|
+
|
|
478
|
+
// ../schema-type/src/typescript/encodeSchema.ts
|
|
479
|
+
function encodeSchema(schema) {
|
|
480
|
+
if (schema.length > 28)
|
|
481
|
+
throw new Error("Schema can only have up to 28 fields");
|
|
482
|
+
const encodedSchema = new Uint8Array(32);
|
|
483
|
+
let length = 0;
|
|
484
|
+
let staticFields = 0;
|
|
485
|
+
let hasDynamicFields = false;
|
|
486
|
+
for (let i = 0; i < schema.length; i++) {
|
|
487
|
+
const staticByteLength = getStaticByteLength(schema[i]);
|
|
488
|
+
if (staticByteLength > 0) {
|
|
489
|
+
if (hasDynamicFields)
|
|
490
|
+
throw new Error("Static fields must come before dynamic fields in the schema");
|
|
491
|
+
staticFields++;
|
|
492
|
+
} else {
|
|
493
|
+
hasDynamicFields = true;
|
|
494
|
+
}
|
|
495
|
+
length += staticByteLength;
|
|
496
|
+
encodedSchema[i + 4] = schema[i];
|
|
497
|
+
}
|
|
498
|
+
const dynamicFields = schema.length - staticFields;
|
|
499
|
+
if (dynamicFields > 14)
|
|
500
|
+
throw new Error("Schema can only have up to 14 dynamic fields");
|
|
501
|
+
new DataView(encodedSchema.buffer).setUint16(0, length);
|
|
502
|
+
encodedSchema[2] = staticFields;
|
|
503
|
+
encodedSchema[3] = dynamicFields;
|
|
504
|
+
return encodedSchema;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// ../schema-type/src/typescript/SchemaTypeArrayToElement.ts
|
|
508
|
+
var SchemaTypeArrayToElement = {
|
|
509
|
+
[98 /* UINT8_ARRAY */]: 0 /* UINT8 */,
|
|
510
|
+
[99 /* UINT16_ARRAY */]: 1 /* UINT16 */,
|
|
511
|
+
[100 /* UINT24_ARRAY */]: 2 /* UINT24 */,
|
|
512
|
+
[101 /* UINT32_ARRAY */]: 3 /* UINT32 */,
|
|
513
|
+
[102 /* UINT40_ARRAY */]: 4 /* UINT40 */,
|
|
514
|
+
[103 /* UINT48_ARRAY */]: 5 /* UINT48 */,
|
|
515
|
+
[104 /* UINT56_ARRAY */]: 6 /* UINT56 */,
|
|
516
|
+
[105 /* UINT64_ARRAY */]: 7 /* UINT64 */,
|
|
517
|
+
[106 /* UINT72_ARRAY */]: 8 /* UINT72 */,
|
|
518
|
+
[107 /* UINT80_ARRAY */]: 9 /* UINT80 */,
|
|
519
|
+
[108 /* UINT88_ARRAY */]: 10 /* UINT88 */,
|
|
520
|
+
[109 /* UINT96_ARRAY */]: 11 /* UINT96 */,
|
|
521
|
+
[110 /* UINT104_ARRAY */]: 12 /* UINT104 */,
|
|
522
|
+
[111 /* UINT112_ARRAY */]: 13 /* UINT112 */,
|
|
523
|
+
[112 /* UINT120_ARRAY */]: 14 /* UINT120 */,
|
|
524
|
+
[113 /* UINT128_ARRAY */]: 15 /* UINT128 */,
|
|
525
|
+
[114 /* UINT136_ARRAY */]: 16 /* UINT136 */,
|
|
526
|
+
[115 /* UINT144_ARRAY */]: 17 /* UINT144 */,
|
|
527
|
+
[116 /* UINT152_ARRAY */]: 18 /* UINT152 */,
|
|
528
|
+
[117 /* UINT160_ARRAY */]: 19 /* UINT160 */,
|
|
529
|
+
[118 /* UINT168_ARRAY */]: 20 /* UINT168 */,
|
|
530
|
+
[119 /* UINT176_ARRAY */]: 21 /* UINT176 */,
|
|
531
|
+
[120 /* UINT184_ARRAY */]: 22 /* UINT184 */,
|
|
532
|
+
[121 /* UINT192_ARRAY */]: 23 /* UINT192 */,
|
|
533
|
+
[122 /* UINT200_ARRAY */]: 24 /* UINT200 */,
|
|
534
|
+
[123 /* UINT208_ARRAY */]: 25 /* UINT208 */,
|
|
535
|
+
[124 /* UINT216_ARRAY */]: 26 /* UINT216 */,
|
|
536
|
+
[125 /* UINT224_ARRAY */]: 27 /* UINT224 */,
|
|
537
|
+
[126 /* UINT232_ARRAY */]: 28 /* UINT232 */,
|
|
538
|
+
[127 /* UINT240_ARRAY */]: 29 /* UINT240 */,
|
|
539
|
+
[128 /* UINT248_ARRAY */]: 30 /* UINT248 */,
|
|
540
|
+
[129 /* UINT256_ARRAY */]: 31 /* UINT256 */,
|
|
541
|
+
[130 /* INT8_ARRAY */]: 32 /* INT8 */,
|
|
542
|
+
[131 /* INT16_ARRAY */]: 33 /* INT16 */,
|
|
543
|
+
[132 /* INT24_ARRAY */]: 34 /* INT24 */,
|
|
544
|
+
[133 /* INT32_ARRAY */]: 35 /* INT32 */,
|
|
545
|
+
[134 /* INT40_ARRAY */]: 36 /* INT40 */,
|
|
546
|
+
[135 /* INT48_ARRAY */]: 37 /* INT48 */,
|
|
547
|
+
[136 /* INT56_ARRAY */]: 38 /* INT56 */,
|
|
548
|
+
[137 /* INT64_ARRAY */]: 39 /* INT64 */,
|
|
549
|
+
[138 /* INT72_ARRAY */]: 40 /* INT72 */,
|
|
550
|
+
[139 /* INT80_ARRAY */]: 41 /* INT80 */,
|
|
551
|
+
[140 /* INT88_ARRAY */]: 42 /* INT88 */,
|
|
552
|
+
[141 /* INT96_ARRAY */]: 43 /* INT96 */,
|
|
553
|
+
[142 /* INT104_ARRAY */]: 44 /* INT104 */,
|
|
554
|
+
[143 /* INT112_ARRAY */]: 45 /* INT112 */,
|
|
555
|
+
[144 /* INT120_ARRAY */]: 46 /* INT120 */,
|
|
556
|
+
[145 /* INT128_ARRAY */]: 47 /* INT128 */,
|
|
557
|
+
[146 /* INT136_ARRAY */]: 48 /* INT136 */,
|
|
558
|
+
[147 /* INT144_ARRAY */]: 49 /* INT144 */,
|
|
559
|
+
[148 /* INT152_ARRAY */]: 50 /* INT152 */,
|
|
560
|
+
[149 /* INT160_ARRAY */]: 51 /* INT160 */,
|
|
561
|
+
[150 /* INT168_ARRAY */]: 52 /* INT168 */,
|
|
562
|
+
[151 /* INT176_ARRAY */]: 53 /* INT176 */,
|
|
563
|
+
[152 /* INT184_ARRAY */]: 54 /* INT184 */,
|
|
564
|
+
[153 /* INT192_ARRAY */]: 55 /* INT192 */,
|
|
565
|
+
[154 /* INT200_ARRAY */]: 56 /* INT200 */,
|
|
566
|
+
[155 /* INT208_ARRAY */]: 57 /* INT208 */,
|
|
567
|
+
[156 /* INT216_ARRAY */]: 58 /* INT216 */,
|
|
568
|
+
[157 /* INT224_ARRAY */]: 59 /* INT224 */,
|
|
569
|
+
[158 /* INT232_ARRAY */]: 60 /* INT232 */,
|
|
570
|
+
[159 /* INT240_ARRAY */]: 61 /* INT240 */,
|
|
571
|
+
[160 /* INT248_ARRAY */]: 62 /* INT248 */,
|
|
572
|
+
[161 /* INT256_ARRAY */]: 63 /* INT256 */,
|
|
573
|
+
[162 /* BYTES1_ARRAY */]: 64 /* BYTES1 */,
|
|
574
|
+
[163 /* BYTES2_ARRAY */]: 65 /* BYTES2 */,
|
|
575
|
+
[164 /* BYTES3_ARRAY */]: 66 /* BYTES3 */,
|
|
576
|
+
[165 /* BYTES4_ARRAY */]: 67 /* BYTES4 */,
|
|
577
|
+
[166 /* BYTES5_ARRAY */]: 68 /* BYTES5 */,
|
|
578
|
+
[167 /* BYTES6_ARRAY */]: 69 /* BYTES6 */,
|
|
579
|
+
[168 /* BYTES7_ARRAY */]: 70 /* BYTES7 */,
|
|
580
|
+
[169 /* BYTES8_ARRAY */]: 71 /* BYTES8 */,
|
|
581
|
+
[170 /* BYTES9_ARRAY */]: 72 /* BYTES9 */,
|
|
582
|
+
[171 /* BYTES10_ARRAY */]: 73 /* BYTES10 */,
|
|
583
|
+
[172 /* BYTES11_ARRAY */]: 74 /* BYTES11 */,
|
|
584
|
+
[173 /* BYTES12_ARRAY */]: 75 /* BYTES12 */,
|
|
585
|
+
[174 /* BYTES13_ARRAY */]: 76 /* BYTES13 */,
|
|
586
|
+
[175 /* BYTES14_ARRAY */]: 77 /* BYTES14 */,
|
|
587
|
+
[176 /* BYTES15_ARRAY */]: 78 /* BYTES15 */,
|
|
588
|
+
[177 /* BYTES16_ARRAY */]: 79 /* BYTES16 */,
|
|
589
|
+
[178 /* BYTES17_ARRAY */]: 80 /* BYTES17 */,
|
|
590
|
+
[179 /* BYTES18_ARRAY */]: 81 /* BYTES18 */,
|
|
591
|
+
[180 /* BYTES19_ARRAY */]: 82 /* BYTES19 */,
|
|
592
|
+
[181 /* BYTES20_ARRAY */]: 83 /* BYTES20 */,
|
|
593
|
+
[182 /* BYTES21_ARRAY */]: 84 /* BYTES21 */,
|
|
594
|
+
[183 /* BYTES22_ARRAY */]: 85 /* BYTES22 */,
|
|
595
|
+
[184 /* BYTES23_ARRAY */]: 86 /* BYTES23 */,
|
|
596
|
+
[185 /* BYTES24_ARRAY */]: 87 /* BYTES24 */,
|
|
597
|
+
[186 /* BYTES25_ARRAY */]: 88 /* BYTES25 */,
|
|
598
|
+
[187 /* BYTES26_ARRAY */]: 89 /* BYTES26 */,
|
|
599
|
+
[188 /* BYTES27_ARRAY */]: 90 /* BYTES27 */,
|
|
600
|
+
[189 /* BYTES28_ARRAY */]: 91 /* BYTES28 */,
|
|
601
|
+
[190 /* BYTES29_ARRAY */]: 92 /* BYTES29 */,
|
|
602
|
+
[191 /* BYTES30_ARRAY */]: 93 /* BYTES30 */,
|
|
603
|
+
[192 /* BYTES31_ARRAY */]: 94 /* BYTES31 */,
|
|
604
|
+
[193 /* BYTES32_ARRAY */]: 95 /* BYTES32 */,
|
|
605
|
+
[194 /* BOOL_ARRAY */]: 96 /* BOOL */,
|
|
606
|
+
[195 /* ADDRESS_ARRAY */]: 97 /* ADDRESS */
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// ../schema-type/src/typescript/SchemaTypeToAbiType.ts
|
|
610
|
+
var SchemaTypeToAbiType = {
|
|
280
611
|
[0 /* UINT8 */]: "uint8",
|
|
281
612
|
[1 /* UINT16 */]: "uint16",
|
|
282
613
|
[2 /* UINT24 */]: "uint24",
|
|
@@ -476,144 +807,359 @@ var SchemaTypeId = {
|
|
|
476
807
|
[196 /* BYTES */]: "bytes",
|
|
477
808
|
[197 /* STRING */]: "string"
|
|
478
809
|
};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
[
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
810
|
+
|
|
811
|
+
// ../schema-type/src/typescript/AbiTypeToSchemaType.ts
|
|
812
|
+
var AbiTypeToSchemaType = Object.fromEntries(
|
|
813
|
+
Object.entries(SchemaTypeToAbiType).map(([schemaType, abiType]) => [abiType, parseInt(schemaType)])
|
|
814
|
+
);
|
|
815
|
+
|
|
816
|
+
// ../schema-type/src/typescript/AbiTypes.ts
|
|
817
|
+
var AbiTypes = Object.values(SchemaTypeToAbiType);
|
|
818
|
+
|
|
819
|
+
// ../schema-type/src/typescript/StaticAbiTypes.ts
|
|
820
|
+
var StaticAbiTypes = AbiTypes.filter(
|
|
821
|
+
(abiType) => getStaticByteLength(AbiTypeToSchemaType[abiType]) > 0
|
|
822
|
+
);
|
|
823
|
+
|
|
824
|
+
// src/config/parseStoreConfig.ts
|
|
825
|
+
import { z as z3, ZodIssueCode as ZodIssueCode3 } from "zod";
|
|
826
|
+
var zTableName = zObjectName;
|
|
827
|
+
var zKeyName = zValueName;
|
|
828
|
+
var zColumnName = zValueName;
|
|
829
|
+
var zUserEnumName = zObjectName;
|
|
830
|
+
var zFieldData = z3.string();
|
|
831
|
+
var zPrimaryKey = z3.string();
|
|
832
|
+
var zPrimaryKeys = z3.record(zKeyName, zPrimaryKey).default({ key: "bytes32" });
|
|
833
|
+
var zFullSchemaConfig = z3.record(zColumnName, zFieldData).refine((arg) => Object.keys(arg).length > 0, "Table schema may not be empty");
|
|
834
|
+
var zShorthandSchemaConfig = zFieldData.transform((fieldData) => {
|
|
835
|
+
return zFullSchemaConfig.parse({
|
|
836
|
+
value: fieldData
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
var zSchemaConfig = zFullSchemaConfig.or(zShorthandSchemaConfig);
|
|
840
|
+
var zFullTableConfig = z3.object({
|
|
841
|
+
directory: z3.string().default("tables"),
|
|
842
|
+
fileSelector: zSelector.optional(),
|
|
843
|
+
tableIdArgument: z3.boolean().default(false),
|
|
844
|
+
storeArgument: z3.boolean().default(false),
|
|
845
|
+
primaryKeys: zPrimaryKeys,
|
|
846
|
+
schema: zSchemaConfig,
|
|
847
|
+
dataStruct: z3.boolean().optional()
|
|
848
|
+
}).transform((arg) => {
|
|
849
|
+
if (Object.keys(arg.schema).length === 1) {
|
|
850
|
+
arg.dataStruct ??= false;
|
|
851
|
+
} else {
|
|
852
|
+
arg.dataStruct ??= true;
|
|
853
|
+
}
|
|
854
|
+
return arg;
|
|
855
|
+
});
|
|
856
|
+
var zShorthandTableConfig = zFieldData.transform((fieldData) => {
|
|
857
|
+
return zFullTableConfig.parse({
|
|
858
|
+
schema: {
|
|
859
|
+
value: fieldData
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
var zTableConfig = zFullTableConfig.or(zShorthandTableConfig);
|
|
864
|
+
var zTablesConfig = z3.record(zTableName, zTableConfig).transform((tables) => {
|
|
865
|
+
for (const tableName of Object.keys(tables)) {
|
|
866
|
+
const table = tables[tableName];
|
|
867
|
+
table.fileSelector ??= tableName;
|
|
868
|
+
tables[tableName] = table;
|
|
869
|
+
}
|
|
870
|
+
return tables;
|
|
871
|
+
});
|
|
872
|
+
var zEnumsConfig = z3.object({
|
|
873
|
+
enums: z3.record(zUserEnumName, zUserEnum).default({})
|
|
874
|
+
});
|
|
875
|
+
function storeConfig(config) {
|
|
876
|
+
return config;
|
|
877
|
+
}
|
|
878
|
+
var StoreConfigUnrefined = z3.object({
|
|
879
|
+
namespace: zSelector.default(""),
|
|
880
|
+
storeImportPath: z3.string().default("@latticexyz/store/src/"),
|
|
881
|
+
tables: zTablesConfig,
|
|
882
|
+
userTypesPath: z3.string().default("Types")
|
|
883
|
+
}).merge(zEnumsConfig);
|
|
884
|
+
var zStoreConfig = StoreConfigUnrefined.superRefine(validateStoreConfig);
|
|
885
|
+
function parseStoreConfig(config) {
|
|
886
|
+
return zStoreConfig.parse(config);
|
|
887
|
+
}
|
|
888
|
+
function validateStoreConfig(config, ctx) {
|
|
889
|
+
for (const table of Object.values(config.tables)) {
|
|
890
|
+
const primaryKeyNames = Object.keys(table.primaryKeys);
|
|
891
|
+
const fieldNames = Object.keys(table.schema);
|
|
892
|
+
const duplicateVariableNames = getDuplicates([...primaryKeyNames, ...fieldNames]);
|
|
893
|
+
if (duplicateVariableNames.length > 0) {
|
|
894
|
+
ctx.addIssue({
|
|
895
|
+
code: ZodIssueCode3.custom,
|
|
896
|
+
message: `Field and primary key names within one table must be unique: ${duplicateVariableNames.join(", ")}`
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
const tableNames = Object.keys(config.tables);
|
|
901
|
+
const staticUserTypeNames = Object.keys(config.enums);
|
|
902
|
+
const userTypeNames = staticUserTypeNames;
|
|
903
|
+
const globalNames = [...tableNames, ...userTypeNames];
|
|
904
|
+
const duplicateGlobalNames = getDuplicates(globalNames);
|
|
905
|
+
if (duplicateGlobalNames.length > 0) {
|
|
906
|
+
ctx.addIssue({
|
|
907
|
+
code: ZodIssueCode3.custom,
|
|
908
|
+
message: `Table, enum names must be globally unique: ${duplicateGlobalNames.join(", ")}`
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
for (const table of Object.values(config.tables)) {
|
|
912
|
+
for (const primaryKeyType of Object.values(table.primaryKeys)) {
|
|
913
|
+
validateStaticAbiOrUserType(staticUserTypeNames, primaryKeyType, ctx);
|
|
914
|
+
}
|
|
915
|
+
for (const fieldType of Object.values(table.schema)) {
|
|
916
|
+
validateAbiOrUserType(userTypeNames, staticUserTypeNames, fieldType, ctx);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function validateAbiOrUserType(userTypeNames, staticUserTypeNames, type, ctx) {
|
|
921
|
+
if (!AbiTypes.includes(type) && !userTypeNames.includes(type)) {
|
|
922
|
+
const staticArray = parseStaticArray(type);
|
|
923
|
+
if (staticArray) {
|
|
924
|
+
validateStaticArray(staticUserTypeNames, staticArray.elementType, staticArray.staticLength, ctx);
|
|
592
925
|
} else {
|
|
593
|
-
|
|
926
|
+
ctx.addIssue({
|
|
927
|
+
code: ZodIssueCode3.custom,
|
|
928
|
+
message: `${type} is not a valid abi type, and is not defined in userTypes`
|
|
929
|
+
});
|
|
594
930
|
}
|
|
595
|
-
length += staticByteLength;
|
|
596
|
-
encodedSchema[i + 4] = schema[i];
|
|
597
931
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
932
|
+
}
|
|
933
|
+
function validateStaticAbiOrUserType(staticUserTypeNames, type, ctx) {
|
|
934
|
+
if (!StaticAbiTypes.includes(type) && !staticUserTypeNames.includes(type)) {
|
|
935
|
+
ctx.addIssue({
|
|
936
|
+
code: ZodIssueCode3.custom,
|
|
937
|
+
message: `${type} is not a static type`
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function validateStaticArray(staticUserTypeNames, elementType, staticLength, ctx) {
|
|
942
|
+
validateStaticAbiOrUserType(staticUserTypeNames, elementType, ctx);
|
|
943
|
+
if (staticLength === 0) {
|
|
944
|
+
ctx.addIssue({
|
|
945
|
+
code: ZodIssueCode3.custom,
|
|
946
|
+
message: `Static array length must not be 0`
|
|
947
|
+
});
|
|
948
|
+
} else if (staticLength >= 2 ** 16) {
|
|
949
|
+
ctx.addIssue({
|
|
950
|
+
code: ZodIssueCode3.custom,
|
|
951
|
+
message: `Static array length must be less than 2**16`
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// src/config/loadStoreConfig.ts
|
|
957
|
+
async function loadStoreConfig(configPath) {
|
|
958
|
+
const config = await loadConfig(configPath);
|
|
959
|
+
try {
|
|
960
|
+
return parseStoreConfig(config);
|
|
961
|
+
} catch (error) {
|
|
962
|
+
if (error instanceof ZodError2) {
|
|
963
|
+
throw fromZodErrorCustom(error, "StoreConfig Validation Error");
|
|
964
|
+
} else {
|
|
965
|
+
throw error;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// src/config/world/loadWorldConfig.ts
|
|
971
|
+
import { ZodError as ZodError3 } from "zod";
|
|
972
|
+
|
|
973
|
+
// src/config/world/parseWorldConfig.ts
|
|
974
|
+
import { z as z4 } from "zod";
|
|
975
|
+
|
|
976
|
+
// src/config/dynamicResolution.ts
|
|
977
|
+
var DynamicResolutionType = /* @__PURE__ */ ((DynamicResolutionType2) => {
|
|
978
|
+
DynamicResolutionType2[DynamicResolutionType2["TABLE_ID"] = 0] = "TABLE_ID";
|
|
979
|
+
DynamicResolutionType2[DynamicResolutionType2["SYSTEM_ADDRESS"] = 1] = "SYSTEM_ADDRESS";
|
|
980
|
+
return DynamicResolutionType2;
|
|
981
|
+
})(DynamicResolutionType || {});
|
|
982
|
+
function resolveTableId(tableName) {
|
|
983
|
+
return {
|
|
984
|
+
type: 0 /* TABLE_ID */,
|
|
985
|
+
input: tableName
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
function isDynamicResolution(value) {
|
|
989
|
+
return typeof value === "object" && value !== null && "type" in value && "input" in value;
|
|
990
|
+
}
|
|
991
|
+
async function resolveWithContext(unresolved, context) {
|
|
992
|
+
if (!isDynamicResolution(unresolved))
|
|
993
|
+
return unresolved;
|
|
994
|
+
let resolved = void 0;
|
|
995
|
+
if (unresolved.type === 0 /* TABLE_ID */) {
|
|
996
|
+
const tableId = context.tableIds?.[unresolved.input];
|
|
997
|
+
resolved = tableId && { value: tableId, type: "bytes32" };
|
|
998
|
+
}
|
|
999
|
+
if (resolved === void 0) {
|
|
1000
|
+
throw new MUDError(`Could not resolve dynamic resolution:
|
|
1001
|
+
${JSON.stringify(unresolved, null, 2)}`);
|
|
1002
|
+
}
|
|
1003
|
+
return resolved;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/config/world/parseWorldConfig.ts
|
|
1007
|
+
var zSystemName = zObjectName;
|
|
1008
|
+
var zModuleName = zObjectName;
|
|
1009
|
+
var zSystemAccessList = z4.array(zSystemName.or(zEthereumAddress)).default([]);
|
|
1010
|
+
var zSystemConfig = z4.intersection(
|
|
1011
|
+
z4.object({
|
|
1012
|
+
fileSelector: zSelector,
|
|
1013
|
+
registerFunctionSelectors: z4.boolean().default(true)
|
|
1014
|
+
}),
|
|
1015
|
+
z4.discriminatedUnion("openAccess", [
|
|
1016
|
+
z4.object({
|
|
1017
|
+
openAccess: z4.literal(true)
|
|
1018
|
+
}),
|
|
1019
|
+
z4.object({
|
|
1020
|
+
openAccess: z4.literal(false),
|
|
1021
|
+
accessList: zSystemAccessList
|
|
1022
|
+
})
|
|
1023
|
+
])
|
|
1024
|
+
);
|
|
1025
|
+
var zValueWithType = z4.object({
|
|
1026
|
+
value: z4.union([z4.string(), z4.number(), z4.instanceof(Uint8Array)]),
|
|
1027
|
+
type: z4.string()
|
|
1028
|
+
});
|
|
1029
|
+
var zDynamicResolution = z4.object({ type: z4.nativeEnum(DynamicResolutionType), input: z4.string() });
|
|
1030
|
+
var zModuleConfig = z4.object({
|
|
1031
|
+
name: zModuleName,
|
|
1032
|
+
root: z4.boolean().default(false),
|
|
1033
|
+
args: z4.array(z4.union([zValueWithType, zDynamicResolution])).default([])
|
|
1034
|
+
});
|
|
1035
|
+
var zWorldConfig = z4.object({
|
|
1036
|
+
namespace: zSelector.default(""),
|
|
1037
|
+
worldContractName: z4.string().optional(),
|
|
1038
|
+
overrideSystems: z4.record(zSystemName, zSystemConfig).default({}),
|
|
1039
|
+
excludeSystems: z4.array(zSystemName).default([]),
|
|
1040
|
+
postDeployScript: z4.string().default("PostDeploy"),
|
|
1041
|
+
deploysDirectory: z4.string().default("./deploys"),
|
|
1042
|
+
worldgenDirectory: z4.string().default("world"),
|
|
1043
|
+
worldImportPath: z4.string().default("@latticexyz/world/src/"),
|
|
1044
|
+
modules: z4.array(zModuleConfig).default([])
|
|
1045
|
+
});
|
|
1046
|
+
async function parseWorldConfig(config) {
|
|
1047
|
+
return zWorldConfig.parse(config);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// src/config/world/resolveWorldConfig.ts
|
|
1051
|
+
function resolveWorldConfig(config, existingContracts) {
|
|
1052
|
+
const defaultSystemNames = existingContracts?.filter((name) => name.endsWith("System") && name !== "System" && !name.match(/^I[A-Z]/)) ?? [];
|
|
1053
|
+
const overriddenSystemNames = Object.keys(config.overrideSystems);
|
|
1054
|
+
if (existingContracts) {
|
|
1055
|
+
for (const systemName of overriddenSystemNames) {
|
|
1056
|
+
if (!existingContracts.includes(systemName) || systemName === "World") {
|
|
1057
|
+
throw UnrecognizedSystemErrorFactory(["overrideSystems", systemName], systemName);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
const systemNames = [.../* @__PURE__ */ new Set([...defaultSystemNames, ...overriddenSystemNames])].filter(
|
|
1062
|
+
(name) => !config.excludeSystems.includes(name)
|
|
1063
|
+
);
|
|
1064
|
+
const resolvedSystems = systemNames.reduce((acc, systemName) => {
|
|
1065
|
+
return {
|
|
1066
|
+
...acc,
|
|
1067
|
+
[systemName]: resolveSystemConfig(systemName, config.overrideSystems[systemName], existingContracts)
|
|
1068
|
+
};
|
|
1069
|
+
}, {});
|
|
1070
|
+
const { overrideSystems, excludeSystems, ...otherConfig } = config;
|
|
1071
|
+
return { ...otherConfig, systems: resolvedSystems };
|
|
1072
|
+
}
|
|
1073
|
+
function resolveSystemConfig(systemName, config, existingContracts) {
|
|
1074
|
+
const fileSelector = config?.fileSelector ?? systemName;
|
|
1075
|
+
const registerFunctionSelectors = config?.registerFunctionSelectors ?? true;
|
|
1076
|
+
const openAccess = config?.openAccess ?? true;
|
|
1077
|
+
const accessListAddresses = [];
|
|
1078
|
+
const accessListSystems = [];
|
|
1079
|
+
const accessList = config && !config.openAccess ? config.accessList : [];
|
|
1080
|
+
for (const accessListItem of accessList) {
|
|
1081
|
+
if (accessListItem.startsWith("0x")) {
|
|
1082
|
+
accessListAddresses.push(accessListItem);
|
|
1083
|
+
} else {
|
|
1084
|
+
if (existingContracts && !existingContracts.includes(accessListItem)) {
|
|
1085
|
+
throw UnrecognizedSystemErrorFactory(["overrideSystems", systemName, "accessList"], accessListItem);
|
|
1086
|
+
}
|
|
1087
|
+
accessListSystems.push(accessListItem);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return { fileSelector, registerFunctionSelectors, openAccess, accessListAddresses, accessListSystems };
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// src/config/world/loadWorldConfig.ts
|
|
1094
|
+
async function loadWorldConfig(configPath, existingContracts) {
|
|
1095
|
+
const config = await loadConfig(configPath);
|
|
1096
|
+
try {
|
|
1097
|
+
const parsedConfig = zWorldConfig.parse(config);
|
|
1098
|
+
return resolveWorldConfig(parsedConfig, existingContracts);
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
if (error instanceof ZodError3) {
|
|
1101
|
+
throw fromZodErrorCustom(error, "WorldConfig Validation Error");
|
|
1102
|
+
} else {
|
|
1103
|
+
throw error;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// src/config/index.ts
|
|
1109
|
+
function mudConfig(config) {
|
|
1110
|
+
return config;
|
|
605
1111
|
}
|
|
606
1112
|
|
|
607
1113
|
export {
|
|
608
|
-
SchemaType,
|
|
609
|
-
getStaticByteLength,
|
|
610
|
-
SchemaTypeId,
|
|
611
|
-
SchemaTypeArrayToElement,
|
|
612
|
-
encodeSchema,
|
|
613
1114
|
fromZodErrorCustom,
|
|
614
1115
|
NotInsideProjectError,
|
|
615
1116
|
NotESMConfigError,
|
|
616
1117
|
MUDError,
|
|
617
1118
|
UnrecognizedSystemErrorFactory,
|
|
618
|
-
logError
|
|
1119
|
+
logError,
|
|
1120
|
+
loadConfig,
|
|
1121
|
+
SchemaType,
|
|
1122
|
+
getStaticByteLength,
|
|
1123
|
+
encodeSchema,
|
|
1124
|
+
SchemaTypeArrayToElement,
|
|
1125
|
+
SchemaTypeToAbiType,
|
|
1126
|
+
AbiTypeToSchemaType,
|
|
1127
|
+
validateName,
|
|
1128
|
+
validateCapitalizedName,
|
|
1129
|
+
validateUncapitalizedName,
|
|
1130
|
+
validateEnum,
|
|
1131
|
+
validateRoute,
|
|
1132
|
+
validateBaseRoute,
|
|
1133
|
+
validateSingleLevelRoute,
|
|
1134
|
+
validateEthereumAddress,
|
|
1135
|
+
getDuplicates,
|
|
1136
|
+
validateSelector,
|
|
1137
|
+
parseStaticArray,
|
|
1138
|
+
zObjectName,
|
|
1139
|
+
zValueName,
|
|
1140
|
+
zAnyCaseName,
|
|
1141
|
+
zUserEnum,
|
|
1142
|
+
zOrdinaryRoute,
|
|
1143
|
+
zSingleLevelRoute,
|
|
1144
|
+
zBaseRoute,
|
|
1145
|
+
zEthereumAddress,
|
|
1146
|
+
zSelector,
|
|
1147
|
+
zSchemaConfig,
|
|
1148
|
+
zTableConfig,
|
|
1149
|
+
zTablesConfig,
|
|
1150
|
+
zEnumsConfig,
|
|
1151
|
+
storeConfig,
|
|
1152
|
+
zStoreConfig,
|
|
1153
|
+
parseStoreConfig,
|
|
1154
|
+
loadStoreConfig,
|
|
1155
|
+
DynamicResolutionType,
|
|
1156
|
+
resolveTableId,
|
|
1157
|
+
isDynamicResolution,
|
|
1158
|
+
resolveWithContext,
|
|
1159
|
+
zWorldConfig,
|
|
1160
|
+
parseWorldConfig,
|
|
1161
|
+
resolveWorldConfig,
|
|
1162
|
+
resolveSystemConfig,
|
|
1163
|
+
loadWorldConfig,
|
|
1164
|
+
mudConfig
|
|
619
1165
|
};
|