@latticexyz/schema-type 2.0.12-type-resolutions-effc7ab1 → 2.0.12-type-resolutions-8538f80e
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/cache/solidity-files-cache.json +1 -1
- package/package.json +3 -2
- package/src/solidity/SchemaType.sol +230 -0
- package/src/typescript/arrayAbiTypes.test.ts +78 -0
- package/src/typescript/arrayAbiTypes.ts +47 -0
- package/src/typescript/deprecated/SchemaType.ts +202 -0
- package/src/typescript/deprecated/mappings/AbiTypeToDefaultValue.ts +208 -0
- package/src/typescript/deprecated/mappings/AbiTypeToPrimitiveType.ts +12 -0
- package/src/typescript/deprecated/mappings/AbiTypeToSchemaType.ts +6 -0
- package/src/typescript/deprecated/mappings/SchemaTypeArrayToElement.ts +109 -0
- package/src/typescript/deprecated/mappings/SchemaTypeToAbiType.ts +210 -0
- package/src/typescript/deprecated/mappings/SchemaTypeToPrimitiveType.ts +9 -0
- package/src/typescript/deprecated/mappings/index.ts +5 -0
- package/src/typescript/deprecated/mappings/types.test-d.ts +233 -0
- package/src/typescript/deprecated/types/AbiTypes.ts +5 -0
- package/src/typescript/deprecated/types/ArraySchemaType.ts +101 -0
- package/src/typescript/deprecated/types/DynamicSchemaType.ts +4 -0
- package/src/typescript/deprecated/types/StaticAbiTypes.ts +10 -0
- package/src/typescript/deprecated/types/StaticArray.ts +3 -0
- package/src/typescript/deprecated/types/StaticSchemaType.ts +4 -0
- package/src/typescript/deprecated/types/index.ts +8 -0
- package/src/typescript/deprecated/utils/encodeSchema.ts +48 -0
- package/src/typescript/deprecated/utils/getAbiTypeDefaultValue.ts +11 -0
- package/src/typescript/deprecated/utils/getStaticByteLength.ts +25 -0
- package/src/typescript/deprecated/utils/index.ts +3 -0
- package/src/typescript/dynamicAbiTypes.test-d.ts +66 -0
- package/src/typescript/dynamicAbiTypes.ts +128 -0
- package/src/typescript/exports/deprecated.ts +4 -0
- package/src/typescript/exports/index.ts +5 -0
- package/src/typescript/exports/internal.ts +6 -0
- package/src/typescript/schemaAbiTypeToDefaultValue.ts +8 -0
- package/src/typescript/schemaAbiTypeToPrimitiveType.ts +7 -0
- package/src/typescript/schemaAbiTypes.test.ts +17 -0
- package/src/typescript/schemaAbiTypes.ts +219 -0
- package/src/typescript/staticAbiTypes.test-d.ts +58 -0
- package/src/typescript/staticAbiTypes.ts +223 -0
- package/src/typescript/utils.ts +25 -0
@@ -0,0 +1,208 @@
|
|
1
|
+
export const AbiTypeToDefaultValue = {
|
2
|
+
uint8: 0,
|
3
|
+
uint16: 0,
|
4
|
+
uint24: 0,
|
5
|
+
uint32: 0,
|
6
|
+
uint40: 0,
|
7
|
+
uint48: 0,
|
8
|
+
uint56: 0n,
|
9
|
+
uint64: 0n,
|
10
|
+
uint72: 0n,
|
11
|
+
uint80: 0n,
|
12
|
+
uint88: 0n,
|
13
|
+
uint96: 0n,
|
14
|
+
uint104: 0n,
|
15
|
+
uint112: 0n,
|
16
|
+
uint120: 0n,
|
17
|
+
uint128: 0n,
|
18
|
+
uint136: 0n,
|
19
|
+
uint144: 0n,
|
20
|
+
uint152: 0n,
|
21
|
+
uint160: 0n,
|
22
|
+
uint168: 0n,
|
23
|
+
uint176: 0n,
|
24
|
+
uint184: 0n,
|
25
|
+
uint192: 0n,
|
26
|
+
uint200: 0n,
|
27
|
+
uint208: 0n,
|
28
|
+
uint216: 0n,
|
29
|
+
uint224: 0n,
|
30
|
+
uint232: 0n,
|
31
|
+
uint240: 0n,
|
32
|
+
uint248: 0n,
|
33
|
+
uint256: 0n,
|
34
|
+
|
35
|
+
int8: 0,
|
36
|
+
int16: 0,
|
37
|
+
int24: 0,
|
38
|
+
int32: 0,
|
39
|
+
int40: 0,
|
40
|
+
int48: 0,
|
41
|
+
int56: 0n,
|
42
|
+
int64: 0n,
|
43
|
+
int72: 0n,
|
44
|
+
int80: 0n,
|
45
|
+
int88: 0n,
|
46
|
+
int96: 0n,
|
47
|
+
int104: 0n,
|
48
|
+
int112: 0n,
|
49
|
+
int120: 0n,
|
50
|
+
int128: 0n,
|
51
|
+
int136: 0n,
|
52
|
+
int144: 0n,
|
53
|
+
int152: 0n,
|
54
|
+
int160: 0n,
|
55
|
+
int168: 0n,
|
56
|
+
int176: 0n,
|
57
|
+
int184: 0n,
|
58
|
+
int192: 0n,
|
59
|
+
int200: 0n,
|
60
|
+
int208: 0n,
|
61
|
+
int216: 0n,
|
62
|
+
int224: 0n,
|
63
|
+
int232: 0n,
|
64
|
+
int240: 0n,
|
65
|
+
int248: 0n,
|
66
|
+
int256: 0n,
|
67
|
+
|
68
|
+
bytes1: "0x00",
|
69
|
+
bytes2: "0x0000",
|
70
|
+
bytes3: "0x000000",
|
71
|
+
bytes4: "0x00000000",
|
72
|
+
bytes5: "0x0000000000",
|
73
|
+
bytes6: "0x000000000000",
|
74
|
+
bytes7: "0x00000000000000",
|
75
|
+
bytes8: "0x0000000000000000",
|
76
|
+
bytes9: "0x000000000000000000",
|
77
|
+
bytes10: "0x00000000000000000000",
|
78
|
+
bytes11: "0x0000000000000000000000",
|
79
|
+
bytes12: "0x000000000000000000000000",
|
80
|
+
bytes13: "0x00000000000000000000000000",
|
81
|
+
bytes14: "0x0000000000000000000000000000",
|
82
|
+
bytes15: "0x000000000000000000000000000000",
|
83
|
+
bytes16: "0x00000000000000000000000000000000",
|
84
|
+
bytes17: "0x0000000000000000000000000000000000",
|
85
|
+
bytes18: "0x000000000000000000000000000000000000",
|
86
|
+
bytes19: "0x00000000000000000000000000000000000000",
|
87
|
+
bytes20: "0x0000000000000000000000000000000000000000",
|
88
|
+
bytes21: "0x000000000000000000000000000000000000000000",
|
89
|
+
bytes22: "0x00000000000000000000000000000000000000000000",
|
90
|
+
bytes23: "0x0000000000000000000000000000000000000000000000",
|
91
|
+
bytes24: "0x000000000000000000000000000000000000000000000000",
|
92
|
+
bytes25: "0x00000000000000000000000000000000000000000000000000",
|
93
|
+
bytes26: "0x0000000000000000000000000000000000000000000000000000",
|
94
|
+
bytes27: "0x000000000000000000000000000000000000000000000000000000",
|
95
|
+
bytes28: "0x00000000000000000000000000000000000000000000000000000000",
|
96
|
+
bytes29: "0x0000000000000000000000000000000000000000000000000000000000",
|
97
|
+
bytes30: "0x000000000000000000000000000000000000000000000000000000000000",
|
98
|
+
bytes31: "0x00000000000000000000000000000000000000000000000000000000000000",
|
99
|
+
bytes32: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
100
|
+
|
101
|
+
bool: false,
|
102
|
+
address: "0x0000000000000000000000000000000000000000",
|
103
|
+
|
104
|
+
"uint8[]": [] as number[],
|
105
|
+
"uint16[]": [] as number[],
|
106
|
+
"uint24[]": [] as number[],
|
107
|
+
"uint32[]": [] as number[],
|
108
|
+
"uint40[]": [] as number[],
|
109
|
+
"uint48[]": [] as number[],
|
110
|
+
"uint56[]": [] as bigint[],
|
111
|
+
"uint64[]": [] as bigint[],
|
112
|
+
"uint72[]": [] as bigint[],
|
113
|
+
"uint80[]": [] as bigint[],
|
114
|
+
"uint88[]": [] as bigint[],
|
115
|
+
"uint96[]": [] as bigint[],
|
116
|
+
"uint104[]": [] as bigint[],
|
117
|
+
"uint112[]": [] as bigint[],
|
118
|
+
"uint120[]": [] as bigint[],
|
119
|
+
"uint128[]": [] as bigint[],
|
120
|
+
"uint136[]": [] as bigint[],
|
121
|
+
"uint144[]": [] as bigint[],
|
122
|
+
"uint152[]": [] as bigint[],
|
123
|
+
"uint160[]": [] as bigint[],
|
124
|
+
"uint168[]": [] as bigint[],
|
125
|
+
"uint176[]": [] as bigint[],
|
126
|
+
"uint184[]": [] as bigint[],
|
127
|
+
"uint192[]": [] as bigint[],
|
128
|
+
"uint200[]": [] as bigint[],
|
129
|
+
"uint208[]": [] as bigint[],
|
130
|
+
"uint216[]": [] as bigint[],
|
131
|
+
"uint224[]": [] as bigint[],
|
132
|
+
"uint232[]": [] as bigint[],
|
133
|
+
"uint240[]": [] as bigint[],
|
134
|
+
"uint248[]": [] as bigint[],
|
135
|
+
"uint256[]": [] as bigint[],
|
136
|
+
|
137
|
+
"int8[]": [] as number[],
|
138
|
+
"int16[]": [] as number[],
|
139
|
+
"int24[]": [] as number[],
|
140
|
+
"int32[]": [] as number[],
|
141
|
+
"int40[]": [] as number[],
|
142
|
+
"int48[]": [] as number[],
|
143
|
+
"int56[]": [] as bigint[],
|
144
|
+
"int64[]": [] as bigint[],
|
145
|
+
"int72[]": [] as bigint[],
|
146
|
+
"int80[]": [] as bigint[],
|
147
|
+
"int88[]": [] as bigint[],
|
148
|
+
"int96[]": [] as bigint[],
|
149
|
+
"int104[]": [] as bigint[],
|
150
|
+
"int112[]": [] as bigint[],
|
151
|
+
"int120[]": [] as bigint[],
|
152
|
+
"int128[]": [] as bigint[],
|
153
|
+
"int136[]": [] as bigint[],
|
154
|
+
"int144[]": [] as bigint[],
|
155
|
+
"int152[]": [] as bigint[],
|
156
|
+
"int160[]": [] as bigint[],
|
157
|
+
"int168[]": [] as bigint[],
|
158
|
+
"int176[]": [] as bigint[],
|
159
|
+
"int184[]": [] as bigint[],
|
160
|
+
"int192[]": [] as bigint[],
|
161
|
+
"int200[]": [] as bigint[],
|
162
|
+
"int208[]": [] as bigint[],
|
163
|
+
"int216[]": [] as bigint[],
|
164
|
+
"int224[]": [] as bigint[],
|
165
|
+
"int232[]": [] as bigint[],
|
166
|
+
"int240[]": [] as bigint[],
|
167
|
+
"int248[]": [] as bigint[],
|
168
|
+
"int256[]": [] as bigint[],
|
169
|
+
|
170
|
+
"bytes1[]": [] as `0x${string}`[],
|
171
|
+
"bytes2[]": [] as `0x${string}`[],
|
172
|
+
"bytes3[]": [] as `0x${string}`[],
|
173
|
+
"bytes4[]": [] as `0x${string}`[],
|
174
|
+
"bytes5[]": [] as `0x${string}`[],
|
175
|
+
"bytes6[]": [] as `0x${string}`[],
|
176
|
+
"bytes7[]": [] as `0x${string}`[],
|
177
|
+
"bytes8[]": [] as `0x${string}`[],
|
178
|
+
"bytes9[]": [] as `0x${string}`[],
|
179
|
+
"bytes10[]": [] as `0x${string}`[],
|
180
|
+
"bytes11[]": [] as `0x${string}`[],
|
181
|
+
"bytes12[]": [] as `0x${string}`[],
|
182
|
+
"bytes13[]": [] as `0x${string}`[],
|
183
|
+
"bytes14[]": [] as `0x${string}`[],
|
184
|
+
"bytes15[]": [] as `0x${string}`[],
|
185
|
+
"bytes16[]": [] as `0x${string}`[],
|
186
|
+
"bytes17[]": [] as `0x${string}`[],
|
187
|
+
"bytes18[]": [] as `0x${string}`[],
|
188
|
+
"bytes19[]": [] as `0x${string}`[],
|
189
|
+
"bytes20[]": [] as `0x${string}`[],
|
190
|
+
"bytes21[]": [] as `0x${string}`[],
|
191
|
+
"bytes22[]": [] as `0x${string}`[],
|
192
|
+
"bytes23[]": [] as `0x${string}`[],
|
193
|
+
"bytes24[]": [] as `0x${string}`[],
|
194
|
+
"bytes25[]": [] as `0x${string}`[],
|
195
|
+
"bytes26[]": [] as `0x${string}`[],
|
196
|
+
"bytes27[]": [] as `0x${string}`[],
|
197
|
+
"bytes28[]": [] as `0x${string}`[],
|
198
|
+
"bytes29[]": [] as `0x${string}`[],
|
199
|
+
"bytes30[]": [] as `0x${string}`[],
|
200
|
+
"bytes31[]": [] as `0x${string}`[],
|
201
|
+
"bytes32[]": [] as `0x${string}`[],
|
202
|
+
|
203
|
+
"bool[]": [] as boolean[],
|
204
|
+
"address[]": [] as `0x${string}`[],
|
205
|
+
|
206
|
+
bytes: "0x",
|
207
|
+
string: "",
|
208
|
+
} as const;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { AbiType, AbiTypeToPrimitiveType as StaticAbiTypeToPrimitiveType } from "abitype";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Like abitype's AbiTypeToPrimitiveType but adding support for arrays and using strings as input
|
5
|
+
*/
|
6
|
+
export type AbiTypeToPrimitiveType<T extends string> = T extends `${infer StaticAbiType}[${string}]`
|
7
|
+
? StaticAbiType extends AbiType
|
8
|
+
? StaticAbiTypeToPrimitiveType<StaticAbiType>[]
|
9
|
+
: never
|
10
|
+
: T extends AbiType
|
11
|
+
? StaticAbiTypeToPrimitiveType<T>
|
12
|
+
: never;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { SchemaTypeToAbiType } from "./SchemaTypeToAbiType";
|
2
|
+
import { SchemaType } from "../SchemaType";
|
3
|
+
|
4
|
+
export const AbiTypeToSchemaType = Object.fromEntries(
|
5
|
+
Object.entries(SchemaTypeToAbiType).map(([schemaType, abiType]) => [abiType, parseInt(schemaType) as SchemaType]),
|
6
|
+
) satisfies Record<string, SchemaType>;
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { StaticSchemaType } from "../types/StaticSchemaType";
|
2
|
+
import { ArraySchemaType } from "../types/ArraySchemaType";
|
3
|
+
import { SchemaType } from "../SchemaType";
|
4
|
+
|
5
|
+
export const SchemaTypeArrayToElement = {
|
6
|
+
[SchemaType.UINT8_ARRAY]: SchemaType.UINT8,
|
7
|
+
[SchemaType.UINT16_ARRAY]: SchemaType.UINT16,
|
8
|
+
[SchemaType.UINT24_ARRAY]: SchemaType.UINT24,
|
9
|
+
[SchemaType.UINT32_ARRAY]: SchemaType.UINT32,
|
10
|
+
[SchemaType.UINT40_ARRAY]: SchemaType.UINT40,
|
11
|
+
[SchemaType.UINT48_ARRAY]: SchemaType.UINT48,
|
12
|
+
[SchemaType.UINT56_ARRAY]: SchemaType.UINT56,
|
13
|
+
[SchemaType.UINT64_ARRAY]: SchemaType.UINT64,
|
14
|
+
[SchemaType.UINT72_ARRAY]: SchemaType.UINT72,
|
15
|
+
[SchemaType.UINT80_ARRAY]: SchemaType.UINT80,
|
16
|
+
[SchemaType.UINT88_ARRAY]: SchemaType.UINT88,
|
17
|
+
[SchemaType.UINT96_ARRAY]: SchemaType.UINT96,
|
18
|
+
[SchemaType.UINT104_ARRAY]: SchemaType.UINT104,
|
19
|
+
[SchemaType.UINT112_ARRAY]: SchemaType.UINT112,
|
20
|
+
[SchemaType.UINT120_ARRAY]: SchemaType.UINT120,
|
21
|
+
[SchemaType.UINT128_ARRAY]: SchemaType.UINT128,
|
22
|
+
[SchemaType.UINT136_ARRAY]: SchemaType.UINT136,
|
23
|
+
[SchemaType.UINT144_ARRAY]: SchemaType.UINT144,
|
24
|
+
[SchemaType.UINT152_ARRAY]: SchemaType.UINT152,
|
25
|
+
[SchemaType.UINT160_ARRAY]: SchemaType.UINT160,
|
26
|
+
[SchemaType.UINT168_ARRAY]: SchemaType.UINT168,
|
27
|
+
[SchemaType.UINT176_ARRAY]: SchemaType.UINT176,
|
28
|
+
[SchemaType.UINT184_ARRAY]: SchemaType.UINT184,
|
29
|
+
[SchemaType.UINT192_ARRAY]: SchemaType.UINT192,
|
30
|
+
[SchemaType.UINT200_ARRAY]: SchemaType.UINT200,
|
31
|
+
[SchemaType.UINT208_ARRAY]: SchemaType.UINT208,
|
32
|
+
[SchemaType.UINT216_ARRAY]: SchemaType.UINT216,
|
33
|
+
[SchemaType.UINT224_ARRAY]: SchemaType.UINT224,
|
34
|
+
[SchemaType.UINT232_ARRAY]: SchemaType.UINT232,
|
35
|
+
[SchemaType.UINT240_ARRAY]: SchemaType.UINT240,
|
36
|
+
[SchemaType.UINT248_ARRAY]: SchemaType.UINT248,
|
37
|
+
[SchemaType.UINT256_ARRAY]: SchemaType.UINT256,
|
38
|
+
|
39
|
+
[SchemaType.INT8_ARRAY]: SchemaType.INT8,
|
40
|
+
[SchemaType.INT16_ARRAY]: SchemaType.INT16,
|
41
|
+
[SchemaType.INT24_ARRAY]: SchemaType.INT24,
|
42
|
+
[SchemaType.INT32_ARRAY]: SchemaType.INT32,
|
43
|
+
[SchemaType.INT40_ARRAY]: SchemaType.INT40,
|
44
|
+
[SchemaType.INT48_ARRAY]: SchemaType.INT48,
|
45
|
+
[SchemaType.INT56_ARRAY]: SchemaType.INT56,
|
46
|
+
[SchemaType.INT64_ARRAY]: SchemaType.INT64,
|
47
|
+
[SchemaType.INT72_ARRAY]: SchemaType.INT72,
|
48
|
+
[SchemaType.INT80_ARRAY]: SchemaType.INT80,
|
49
|
+
[SchemaType.INT88_ARRAY]: SchemaType.INT88,
|
50
|
+
[SchemaType.INT96_ARRAY]: SchemaType.INT96,
|
51
|
+
[SchemaType.INT104_ARRAY]: SchemaType.INT104,
|
52
|
+
[SchemaType.INT112_ARRAY]: SchemaType.INT112,
|
53
|
+
[SchemaType.INT120_ARRAY]: SchemaType.INT120,
|
54
|
+
[SchemaType.INT128_ARRAY]: SchemaType.INT128,
|
55
|
+
[SchemaType.INT136_ARRAY]: SchemaType.INT136,
|
56
|
+
[SchemaType.INT144_ARRAY]: SchemaType.INT144,
|
57
|
+
[SchemaType.INT152_ARRAY]: SchemaType.INT152,
|
58
|
+
[SchemaType.INT160_ARRAY]: SchemaType.INT160,
|
59
|
+
[SchemaType.INT168_ARRAY]: SchemaType.INT168,
|
60
|
+
[SchemaType.INT176_ARRAY]: SchemaType.INT176,
|
61
|
+
[SchemaType.INT184_ARRAY]: SchemaType.INT184,
|
62
|
+
[SchemaType.INT192_ARRAY]: SchemaType.INT192,
|
63
|
+
[SchemaType.INT200_ARRAY]: SchemaType.INT200,
|
64
|
+
[SchemaType.INT208_ARRAY]: SchemaType.INT208,
|
65
|
+
[SchemaType.INT216_ARRAY]: SchemaType.INT216,
|
66
|
+
[SchemaType.INT224_ARRAY]: SchemaType.INT224,
|
67
|
+
[SchemaType.INT232_ARRAY]: SchemaType.INT232,
|
68
|
+
[SchemaType.INT240_ARRAY]: SchemaType.INT240,
|
69
|
+
[SchemaType.INT248_ARRAY]: SchemaType.INT248,
|
70
|
+
[SchemaType.INT256_ARRAY]: SchemaType.INT256,
|
71
|
+
|
72
|
+
[SchemaType.BYTES1_ARRAY]: SchemaType.BYTES1,
|
73
|
+
[SchemaType.BYTES2_ARRAY]: SchemaType.BYTES2,
|
74
|
+
[SchemaType.BYTES3_ARRAY]: SchemaType.BYTES3,
|
75
|
+
[SchemaType.BYTES4_ARRAY]: SchemaType.BYTES4,
|
76
|
+
[SchemaType.BYTES5_ARRAY]: SchemaType.BYTES5,
|
77
|
+
[SchemaType.BYTES6_ARRAY]: SchemaType.BYTES6,
|
78
|
+
[SchemaType.BYTES7_ARRAY]: SchemaType.BYTES7,
|
79
|
+
[SchemaType.BYTES8_ARRAY]: SchemaType.BYTES8,
|
80
|
+
[SchemaType.BYTES9_ARRAY]: SchemaType.BYTES9,
|
81
|
+
[SchemaType.BYTES10_ARRAY]: SchemaType.BYTES10,
|
82
|
+
[SchemaType.BYTES11_ARRAY]: SchemaType.BYTES11,
|
83
|
+
[SchemaType.BYTES12_ARRAY]: SchemaType.BYTES12,
|
84
|
+
[SchemaType.BYTES13_ARRAY]: SchemaType.BYTES13,
|
85
|
+
[SchemaType.BYTES14_ARRAY]: SchemaType.BYTES14,
|
86
|
+
[SchemaType.BYTES15_ARRAY]: SchemaType.BYTES15,
|
87
|
+
[SchemaType.BYTES16_ARRAY]: SchemaType.BYTES16,
|
88
|
+
[SchemaType.BYTES17_ARRAY]: SchemaType.BYTES17,
|
89
|
+
[SchemaType.BYTES18_ARRAY]: SchemaType.BYTES18,
|
90
|
+
[SchemaType.BYTES19_ARRAY]: SchemaType.BYTES19,
|
91
|
+
[SchemaType.BYTES20_ARRAY]: SchemaType.BYTES20,
|
92
|
+
[SchemaType.BYTES21_ARRAY]: SchemaType.BYTES21,
|
93
|
+
[SchemaType.BYTES22_ARRAY]: SchemaType.BYTES22,
|
94
|
+
[SchemaType.BYTES23_ARRAY]: SchemaType.BYTES23,
|
95
|
+
[SchemaType.BYTES24_ARRAY]: SchemaType.BYTES24,
|
96
|
+
[SchemaType.BYTES25_ARRAY]: SchemaType.BYTES25,
|
97
|
+
[SchemaType.BYTES26_ARRAY]: SchemaType.BYTES26,
|
98
|
+
[SchemaType.BYTES27_ARRAY]: SchemaType.BYTES27,
|
99
|
+
[SchemaType.BYTES28_ARRAY]: SchemaType.BYTES28,
|
100
|
+
[SchemaType.BYTES29_ARRAY]: SchemaType.BYTES29,
|
101
|
+
[SchemaType.BYTES30_ARRAY]: SchemaType.BYTES30,
|
102
|
+
[SchemaType.BYTES31_ARRAY]: SchemaType.BYTES31,
|
103
|
+
[SchemaType.BYTES32_ARRAY]: SchemaType.BYTES32,
|
104
|
+
|
105
|
+
[SchemaType.BOOL_ARRAY]: SchemaType.BOOL,
|
106
|
+
[SchemaType.ADDRESS_ARRAY]: SchemaType.ADDRESS,
|
107
|
+
} as {
|
108
|
+
[K in SchemaType]: K extends ArraySchemaType ? StaticSchemaType : never;
|
109
|
+
};
|
@@ -0,0 +1,210 @@
|
|
1
|
+
import { SchemaType } from "../SchemaType";
|
2
|
+
|
3
|
+
export const SchemaTypeToAbiType = {
|
4
|
+
[SchemaType.UINT8]: "uint8",
|
5
|
+
[SchemaType.UINT16]: "uint16",
|
6
|
+
[SchemaType.UINT24]: "uint24",
|
7
|
+
[SchemaType.UINT32]: "uint32",
|
8
|
+
[SchemaType.UINT40]: "uint40",
|
9
|
+
[SchemaType.UINT48]: "uint48",
|
10
|
+
[SchemaType.UINT56]: "uint56",
|
11
|
+
[SchemaType.UINT64]: "uint64",
|
12
|
+
[SchemaType.UINT72]: "uint72",
|
13
|
+
[SchemaType.UINT80]: "uint80",
|
14
|
+
[SchemaType.UINT88]: "uint88",
|
15
|
+
[SchemaType.UINT96]: "uint96",
|
16
|
+
[SchemaType.UINT104]: "uint104",
|
17
|
+
[SchemaType.UINT112]: "uint112",
|
18
|
+
[SchemaType.UINT120]: "uint120",
|
19
|
+
[SchemaType.UINT128]: "uint128",
|
20
|
+
[SchemaType.UINT136]: "uint136",
|
21
|
+
[SchemaType.UINT144]: "uint144",
|
22
|
+
[SchemaType.UINT152]: "uint152",
|
23
|
+
[SchemaType.UINT160]: "uint160",
|
24
|
+
[SchemaType.UINT168]: "uint168",
|
25
|
+
[SchemaType.UINT176]: "uint176",
|
26
|
+
[SchemaType.UINT184]: "uint184",
|
27
|
+
[SchemaType.UINT192]: "uint192",
|
28
|
+
[SchemaType.UINT200]: "uint200",
|
29
|
+
[SchemaType.UINT208]: "uint208",
|
30
|
+
[SchemaType.UINT216]: "uint216",
|
31
|
+
[SchemaType.UINT224]: "uint224",
|
32
|
+
[SchemaType.UINT232]: "uint232",
|
33
|
+
[SchemaType.UINT240]: "uint240",
|
34
|
+
[SchemaType.UINT248]: "uint248",
|
35
|
+
[SchemaType.UINT256]: "uint256",
|
36
|
+
|
37
|
+
[SchemaType.INT8]: "int8",
|
38
|
+
[SchemaType.INT16]: "int16",
|
39
|
+
[SchemaType.INT24]: "int24",
|
40
|
+
[SchemaType.INT32]: "int32",
|
41
|
+
[SchemaType.INT40]: "int40",
|
42
|
+
[SchemaType.INT48]: "int48",
|
43
|
+
[SchemaType.INT56]: "int56",
|
44
|
+
[SchemaType.INT64]: "int64",
|
45
|
+
[SchemaType.INT72]: "int72",
|
46
|
+
[SchemaType.INT80]: "int80",
|
47
|
+
[SchemaType.INT88]: "int88",
|
48
|
+
[SchemaType.INT96]: "int96",
|
49
|
+
[SchemaType.INT104]: "int104",
|
50
|
+
[SchemaType.INT112]: "int112",
|
51
|
+
[SchemaType.INT120]: "int120",
|
52
|
+
[SchemaType.INT128]: "int128",
|
53
|
+
[SchemaType.INT136]: "int136",
|
54
|
+
[SchemaType.INT144]: "int144",
|
55
|
+
[SchemaType.INT152]: "int152",
|
56
|
+
[SchemaType.INT160]: "int160",
|
57
|
+
[SchemaType.INT168]: "int168",
|
58
|
+
[SchemaType.INT176]: "int176",
|
59
|
+
[SchemaType.INT184]: "int184",
|
60
|
+
[SchemaType.INT192]: "int192",
|
61
|
+
[SchemaType.INT200]: "int200",
|
62
|
+
[SchemaType.INT208]: "int208",
|
63
|
+
[SchemaType.INT216]: "int216",
|
64
|
+
[SchemaType.INT224]: "int224",
|
65
|
+
[SchemaType.INT232]: "int232",
|
66
|
+
[SchemaType.INT240]: "int240",
|
67
|
+
[SchemaType.INT248]: "int248",
|
68
|
+
[SchemaType.INT256]: "int256",
|
69
|
+
|
70
|
+
[SchemaType.BYTES1]: "bytes1",
|
71
|
+
[SchemaType.BYTES2]: "bytes2",
|
72
|
+
[SchemaType.BYTES3]: "bytes3",
|
73
|
+
[SchemaType.BYTES4]: "bytes4",
|
74
|
+
[SchemaType.BYTES5]: "bytes5",
|
75
|
+
[SchemaType.BYTES6]: "bytes6",
|
76
|
+
[SchemaType.BYTES7]: "bytes7",
|
77
|
+
[SchemaType.BYTES8]: "bytes8",
|
78
|
+
[SchemaType.BYTES9]: "bytes9",
|
79
|
+
[SchemaType.BYTES10]: "bytes10",
|
80
|
+
[SchemaType.BYTES11]: "bytes11",
|
81
|
+
[SchemaType.BYTES12]: "bytes12",
|
82
|
+
[SchemaType.BYTES13]: "bytes13",
|
83
|
+
[SchemaType.BYTES14]: "bytes14",
|
84
|
+
[SchemaType.BYTES15]: "bytes15",
|
85
|
+
[SchemaType.BYTES16]: "bytes16",
|
86
|
+
[SchemaType.BYTES17]: "bytes17",
|
87
|
+
[SchemaType.BYTES18]: "bytes18",
|
88
|
+
[SchemaType.BYTES19]: "bytes19",
|
89
|
+
[SchemaType.BYTES20]: "bytes20",
|
90
|
+
[SchemaType.BYTES21]: "bytes21",
|
91
|
+
[SchemaType.BYTES22]: "bytes22",
|
92
|
+
[SchemaType.BYTES23]: "bytes23",
|
93
|
+
[SchemaType.BYTES24]: "bytes24",
|
94
|
+
[SchemaType.BYTES25]: "bytes25",
|
95
|
+
[SchemaType.BYTES26]: "bytes26",
|
96
|
+
[SchemaType.BYTES27]: "bytes27",
|
97
|
+
[SchemaType.BYTES28]: "bytes28",
|
98
|
+
[SchemaType.BYTES29]: "bytes29",
|
99
|
+
[SchemaType.BYTES30]: "bytes30",
|
100
|
+
[SchemaType.BYTES31]: "bytes31",
|
101
|
+
[SchemaType.BYTES32]: "bytes32",
|
102
|
+
|
103
|
+
[SchemaType.BOOL]: "bool",
|
104
|
+
[SchemaType.ADDRESS]: "address",
|
105
|
+
|
106
|
+
[SchemaType.UINT8_ARRAY]: "uint8[]",
|
107
|
+
[SchemaType.UINT16_ARRAY]: "uint16[]",
|
108
|
+
[SchemaType.UINT24_ARRAY]: "uint24[]",
|
109
|
+
[SchemaType.UINT32_ARRAY]: "uint32[]",
|
110
|
+
[SchemaType.UINT40_ARRAY]: "uint40[]",
|
111
|
+
[SchemaType.UINT48_ARRAY]: "uint48[]",
|
112
|
+
[SchemaType.UINT56_ARRAY]: "uint56[]",
|
113
|
+
[SchemaType.UINT64_ARRAY]: "uint64[]",
|
114
|
+
[SchemaType.UINT72_ARRAY]: "uint72[]",
|
115
|
+
[SchemaType.UINT80_ARRAY]: "uint80[]",
|
116
|
+
[SchemaType.UINT88_ARRAY]: "uint88[]",
|
117
|
+
[SchemaType.UINT96_ARRAY]: "uint96[]",
|
118
|
+
[SchemaType.UINT104_ARRAY]: "uint104[]",
|
119
|
+
[SchemaType.UINT112_ARRAY]: "uint112[]",
|
120
|
+
[SchemaType.UINT120_ARRAY]: "uint120[]",
|
121
|
+
[SchemaType.UINT128_ARRAY]: "uint128[]",
|
122
|
+
[SchemaType.UINT136_ARRAY]: "uint136[]",
|
123
|
+
[SchemaType.UINT144_ARRAY]: "uint144[]",
|
124
|
+
[SchemaType.UINT152_ARRAY]: "uint152[]",
|
125
|
+
[SchemaType.UINT160_ARRAY]: "uint160[]",
|
126
|
+
[SchemaType.UINT168_ARRAY]: "uint168[]",
|
127
|
+
[SchemaType.UINT176_ARRAY]: "uint176[]",
|
128
|
+
[SchemaType.UINT184_ARRAY]: "uint184[]",
|
129
|
+
[SchemaType.UINT192_ARRAY]: "uint192[]",
|
130
|
+
[SchemaType.UINT200_ARRAY]: "uint200[]",
|
131
|
+
[SchemaType.UINT208_ARRAY]: "uint208[]",
|
132
|
+
[SchemaType.UINT216_ARRAY]: "uint216[]",
|
133
|
+
[SchemaType.UINT224_ARRAY]: "uint224[]",
|
134
|
+
[SchemaType.UINT232_ARRAY]: "uint232[]",
|
135
|
+
[SchemaType.UINT240_ARRAY]: "uint240[]",
|
136
|
+
[SchemaType.UINT248_ARRAY]: "uint248[]",
|
137
|
+
[SchemaType.UINT256_ARRAY]: "uint256[]",
|
138
|
+
|
139
|
+
[SchemaType.INT8_ARRAY]: "int8[]",
|
140
|
+
[SchemaType.INT16_ARRAY]: "int16[]",
|
141
|
+
[SchemaType.INT24_ARRAY]: "int24[]",
|
142
|
+
[SchemaType.INT32_ARRAY]: "int32[]",
|
143
|
+
[SchemaType.INT40_ARRAY]: "int40[]",
|
144
|
+
[SchemaType.INT48_ARRAY]: "int48[]",
|
145
|
+
[SchemaType.INT56_ARRAY]: "int56[]",
|
146
|
+
[SchemaType.INT64_ARRAY]: "int64[]",
|
147
|
+
[SchemaType.INT72_ARRAY]: "int72[]",
|
148
|
+
[SchemaType.INT80_ARRAY]: "int80[]",
|
149
|
+
[SchemaType.INT88_ARRAY]: "int88[]",
|
150
|
+
[SchemaType.INT96_ARRAY]: "int96[]",
|
151
|
+
[SchemaType.INT104_ARRAY]: "int104[]",
|
152
|
+
[SchemaType.INT112_ARRAY]: "int112[]",
|
153
|
+
[SchemaType.INT120_ARRAY]: "int120[]",
|
154
|
+
[SchemaType.INT128_ARRAY]: "int128[]",
|
155
|
+
[SchemaType.INT136_ARRAY]: "int136[]",
|
156
|
+
[SchemaType.INT144_ARRAY]: "int144[]",
|
157
|
+
[SchemaType.INT152_ARRAY]: "int152[]",
|
158
|
+
[SchemaType.INT160_ARRAY]: "int160[]",
|
159
|
+
[SchemaType.INT168_ARRAY]: "int168[]",
|
160
|
+
[SchemaType.INT176_ARRAY]: "int176[]",
|
161
|
+
[SchemaType.INT184_ARRAY]: "int184[]",
|
162
|
+
[SchemaType.INT192_ARRAY]: "int192[]",
|
163
|
+
[SchemaType.INT200_ARRAY]: "int200[]",
|
164
|
+
[SchemaType.INT208_ARRAY]: "int208[]",
|
165
|
+
[SchemaType.INT216_ARRAY]: "int216[]",
|
166
|
+
[SchemaType.INT224_ARRAY]: "int224[]",
|
167
|
+
[SchemaType.INT232_ARRAY]: "int232[]",
|
168
|
+
[SchemaType.INT240_ARRAY]: "int240[]",
|
169
|
+
[SchemaType.INT248_ARRAY]: "int248[]",
|
170
|
+
[SchemaType.INT256_ARRAY]: "int256[]",
|
171
|
+
|
172
|
+
[SchemaType.BYTES1_ARRAY]: "bytes1[]",
|
173
|
+
[SchemaType.BYTES2_ARRAY]: "bytes2[]",
|
174
|
+
[SchemaType.BYTES3_ARRAY]: "bytes3[]",
|
175
|
+
[SchemaType.BYTES4_ARRAY]: "bytes4[]",
|
176
|
+
[SchemaType.BYTES5_ARRAY]: "bytes5[]",
|
177
|
+
[SchemaType.BYTES6_ARRAY]: "bytes6[]",
|
178
|
+
[SchemaType.BYTES7_ARRAY]: "bytes7[]",
|
179
|
+
[SchemaType.BYTES8_ARRAY]: "bytes8[]",
|
180
|
+
[SchemaType.BYTES9_ARRAY]: "bytes9[]",
|
181
|
+
[SchemaType.BYTES10_ARRAY]: "bytes10[]",
|
182
|
+
[SchemaType.BYTES11_ARRAY]: "bytes11[]",
|
183
|
+
[SchemaType.BYTES12_ARRAY]: "bytes12[]",
|
184
|
+
[SchemaType.BYTES13_ARRAY]: "bytes13[]",
|
185
|
+
[SchemaType.BYTES14_ARRAY]: "bytes14[]",
|
186
|
+
[SchemaType.BYTES15_ARRAY]: "bytes15[]",
|
187
|
+
[SchemaType.BYTES16_ARRAY]: "bytes16[]",
|
188
|
+
[SchemaType.BYTES17_ARRAY]: "bytes17[]",
|
189
|
+
[SchemaType.BYTES18_ARRAY]: "bytes18[]",
|
190
|
+
[SchemaType.BYTES19_ARRAY]: "bytes19[]",
|
191
|
+
[SchemaType.BYTES20_ARRAY]: "bytes20[]",
|
192
|
+
[SchemaType.BYTES21_ARRAY]: "bytes21[]",
|
193
|
+
[SchemaType.BYTES22_ARRAY]: "bytes22[]",
|
194
|
+
[SchemaType.BYTES23_ARRAY]: "bytes23[]",
|
195
|
+
[SchemaType.BYTES24_ARRAY]: "bytes24[]",
|
196
|
+
[SchemaType.BYTES25_ARRAY]: "bytes25[]",
|
197
|
+
[SchemaType.BYTES26_ARRAY]: "bytes26[]",
|
198
|
+
[SchemaType.BYTES27_ARRAY]: "bytes27[]",
|
199
|
+
[SchemaType.BYTES28_ARRAY]: "bytes28[]",
|
200
|
+
[SchemaType.BYTES29_ARRAY]: "bytes29[]",
|
201
|
+
[SchemaType.BYTES30_ARRAY]: "bytes30[]",
|
202
|
+
[SchemaType.BYTES31_ARRAY]: "bytes31[]",
|
203
|
+
[SchemaType.BYTES32_ARRAY]: "bytes32[]",
|
204
|
+
|
205
|
+
[SchemaType.BOOL_ARRAY]: "bool[]",
|
206
|
+
[SchemaType.ADDRESS_ARRAY]: "address[]",
|
207
|
+
|
208
|
+
[SchemaType.BYTES]: "bytes",
|
209
|
+
[SchemaType.STRING]: "string",
|
210
|
+
} as const satisfies Record<SchemaType, string>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { AbiTypeToPrimitiveType } from "./AbiTypeToPrimitiveType";
|
2
|
+
import { SchemaType } from "../SchemaType";
|
3
|
+
import { SchemaTypeToAbiType } from "./SchemaTypeToAbiType";
|
4
|
+
|
5
|
+
export type SchemaTypeToPrimitiveType<S extends SchemaType> = SchemaTypeToPrimitiveTypeLookup[S];
|
6
|
+
|
7
|
+
export type SchemaTypeToPrimitiveTypeLookup = {
|
8
|
+
[SchemaType in keyof typeof SchemaTypeToAbiType]: AbiTypeToPrimitiveType<(typeof SchemaTypeToAbiType)[SchemaType]>;
|
9
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { AbiTypeToSchemaType } from "./AbiTypeToSchemaType";
|
2
|
+
export { SchemaTypeArrayToElement } from "./SchemaTypeArrayToElement";
|
3
|
+
export { SchemaTypeToAbiType } from "./SchemaTypeToAbiType";
|
4
|
+
export type { AbiTypeToPrimitiveType } from "./AbiTypeToPrimitiveType";
|
5
|
+
export type { SchemaTypeToPrimitiveType } from "./SchemaTypeToPrimitiveType";
|