@latticexyz/protocol-parser 2.0.0-main-ca329175 → 2.0.0-main-29c3f508
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/package.json +3 -3
- package/src/common.ts +11 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/protocol-parser",
|
|
3
|
-
"version": "2.0.0-main-
|
|
3
|
+
"version": "2.0.0-main-29c3f508",
|
|
4
4
|
"description": "Parser utilities for the MUD protocol",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"abitype": "0.9.8",
|
|
18
18
|
"viem": "1.14.0",
|
|
19
|
-
"@latticexyz/common": "2.0.0-main-
|
|
20
|
-
"@latticexyz/schema-type": "2.0.0-main-
|
|
19
|
+
"@latticexyz/common": "2.0.0-main-29c3f508",
|
|
20
|
+
"@latticexyz/schema-type": "2.0.0-main-29c3f508"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsup": "^6.7.0",
|
package/src/common.ts
CHANGED
|
@@ -18,8 +18,17 @@ export type FieldLayout = {
|
|
|
18
18
|
readonly numDynamicFields: number;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
export type
|
|
21
|
+
// TODO: helper to filter user types to StaticAbiType
|
|
22
|
+
export type UserTypes = Record<string, { internalType: SchemaAbiType }>;
|
|
23
|
+
|
|
24
|
+
export type KeySchema<userTypes extends UserTypes | undefined = undefined> = Record<
|
|
25
|
+
string,
|
|
26
|
+
userTypes extends UserTypes ? StaticAbiType | keyof userTypes : StaticAbiType
|
|
27
|
+
>;
|
|
28
|
+
export type ValueSchema<userTypes extends UserTypes | undefined = undefined> = Record<
|
|
29
|
+
string,
|
|
30
|
+
userTypes extends UserTypes ? SchemaAbiType | keyof userTypes : SchemaAbiType
|
|
31
|
+
>;
|
|
23
32
|
|
|
24
33
|
/** Map a table schema like `{ value: "uint256" }` to its primitive types like `{ value: bigint }` */
|
|
25
34
|
export type SchemaToPrimitives<TSchema extends ValueSchema> = {
|