@eco-foundation/api-schemas 0.1.0 → 0.2.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/README.md +75 -10
- package/dist/generated/build-digest.json +1 -1
- package/dist/v1/endpoints/chains.d.ts +8 -8
- package/dist/v1/endpoints/deposit-addresses.d.ts +8 -8
- package/dist/v1/endpoints/deposit-addresses.js +3 -3
- package/dist/v1/endpoints/deposit-addresses.js.map +1 -1
- package/dist/v1/endpoints/quotes.d.ts +86 -86
- package/dist/v1/endpoints/registry.d.ts +48 -48
- package/dist/v1/endpoints/routes.d.ts +4 -4
- package/dist/v1/endpoints/submit.js +16 -8
- package/dist/v1/endpoints/submit.js.map +1 -1
- package/dist/v1/endpoints/tokens.d.ts +2 -2
- package/dist/v1/errors/catalog.js +1 -1
- package/dist/v1/errors/catalog.js.map +1 -1
- package/dist/v1/errors/problem.d.ts +8 -2
- package/dist/v1/errors/problem.js +34 -1
- package/dist/v1/errors/problem.js.map +1 -1
- package/dist/v1/primitives.d.ts +2 -1
- package/dist/v1/primitives.js +12 -3
- package/dist/v1/primitives.js.map +1 -1
- package/openapi/v1.json +227 -184
- package/package.json +11 -4
- package/v1/signature.d.ts +9 -0
- package/v1/signature.js +6 -0
|
@@ -27,24 +27,24 @@ export declare const V1_ENDPOINTS: {
|
|
|
27
27
|
}>;
|
|
28
28
|
source: z.ZodObject<{
|
|
29
29
|
chainId: z.ZodNumber;
|
|
30
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
30
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
31
31
|
amount: z.ZodOptional<z.ZodString>;
|
|
32
32
|
}, z.core.$strip>;
|
|
33
33
|
destination: z.ZodObject<{
|
|
34
34
|
chainId: z.ZodNumber;
|
|
35
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
35
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
36
36
|
amount: z.ZodOptional<z.ZodString>;
|
|
37
|
-
recipient: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.
|
|
37
|
+
recipient: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
38
38
|
calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
-
target: z.ZodUnion<readonly [z.ZodString, z.
|
|
39
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
40
40
|
data: z.ZodString;
|
|
41
41
|
value: z.ZodString;
|
|
42
|
-
tokenOut: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.
|
|
42
|
+
tokenOut: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
43
43
|
gasLimit: z.ZodOptional<z.ZodString>;
|
|
44
44
|
}, z.core.$strip>>>;
|
|
45
45
|
}, z.core.$strip>;
|
|
46
|
-
funder: z.ZodUnion<readonly [z.ZodString, z.
|
|
47
|
-
refundRecipient: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.
|
|
46
|
+
funder: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
47
|
+
refundRecipient: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
48
48
|
slippage: z.ZodOptional<z.ZodNumber>;
|
|
49
49
|
dappId: z.ZodOptional<z.ZodString>;
|
|
50
50
|
options: z.ZodOptional<z.ZodObject<{
|
|
@@ -74,17 +74,17 @@ export declare const V1_ENDPOINTS: {
|
|
|
74
74
|
}>;
|
|
75
75
|
source: z.ZodObject<{
|
|
76
76
|
chainId: z.ZodNumber;
|
|
77
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
77
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
78
78
|
amount: z.ZodString;
|
|
79
79
|
symbol: z.ZodNullable<z.ZodString>;
|
|
80
80
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
81
81
|
}, z.core.$loose>;
|
|
82
82
|
destination: z.ZodObject<{
|
|
83
83
|
chainId: z.ZodNumber;
|
|
84
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
84
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
85
85
|
amount: z.ZodString;
|
|
86
86
|
minAmountOut: z.ZodString;
|
|
87
|
-
recipient: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.
|
|
87
|
+
recipient: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
88
88
|
symbol: z.ZodNullable<z.ZodString>;
|
|
89
89
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
90
90
|
}, z.core.$loose>;
|
|
@@ -99,7 +99,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
99
99
|
amount: z.ZodString;
|
|
100
100
|
token: z.ZodObject<{
|
|
101
101
|
chainId: z.ZodNumber;
|
|
102
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
102
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
103
103
|
symbol: z.ZodNullable<z.ZodString>;
|
|
104
104
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
105
105
|
}, z.core.$loose>;
|
|
@@ -116,12 +116,12 @@ export declare const V1_ENDPOINTS: {
|
|
|
116
116
|
aggregator: z.ZodOptional<z.ZodString>;
|
|
117
117
|
from: z.ZodObject<{
|
|
118
118
|
chainId: z.ZodNumber;
|
|
119
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
119
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
120
120
|
amount: z.ZodString;
|
|
121
121
|
}, z.core.$loose>;
|
|
122
122
|
to: z.ZodObject<{
|
|
123
123
|
chainId: z.ZodNumber;
|
|
124
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
124
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
125
125
|
amount: z.ZodString;
|
|
126
126
|
}, z.core.$loose>;
|
|
127
127
|
fees: z.ZodArray<z.ZodObject<{
|
|
@@ -134,7 +134,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
134
134
|
amount: z.ZodString;
|
|
135
135
|
token: z.ZodObject<{
|
|
136
136
|
chainId: z.ZodNumber;
|
|
137
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
137
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
138
138
|
symbol: z.ZodNullable<z.ZodString>;
|
|
139
139
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
140
140
|
}, z.core.$loose>;
|
|
@@ -153,7 +153,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
153
153
|
bucketIndex: z.ZodOptional<z.ZodNumber>;
|
|
154
154
|
}, z.core.$loose>>;
|
|
155
155
|
solver: z.ZodObject<{
|
|
156
|
-
id: z.ZodUnion<readonly [z.ZodString, z.
|
|
156
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
157
157
|
name: z.ZodOptional<z.ZodString>;
|
|
158
158
|
}, z.core.$loose>;
|
|
159
159
|
intentHash: z.ZodNullable<z.ZodString>;
|
|
@@ -175,25 +175,25 @@ export declare const V1_ENDPOINTS: {
|
|
|
175
175
|
deadline: z.ZodNumber;
|
|
176
176
|
source: z.ZodNumber;
|
|
177
177
|
destination: z.ZodNumber;
|
|
178
|
-
portal: z.ZodUnion<readonly [z.ZodString, z.
|
|
178
|
+
portal: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
179
179
|
nativeAmount: z.ZodString;
|
|
180
180
|
tokens: z.ZodArray<z.ZodObject<{
|
|
181
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
181
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
182
182
|
amount: z.ZodString;
|
|
183
183
|
}, z.core.$loose>>;
|
|
184
184
|
calls: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
185
|
-
target: z.ZodUnion<readonly [z.ZodString, z.
|
|
185
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
186
186
|
data: z.ZodString;
|
|
187
187
|
value: z.ZodString;
|
|
188
188
|
}, z.core.$loose>>>;
|
|
189
189
|
}, z.core.$loose>;
|
|
190
190
|
reward: z.ZodObject<{
|
|
191
191
|
deadline: z.ZodNumber;
|
|
192
|
-
creator: z.ZodUnion<readonly [z.ZodString, z.
|
|
193
|
-
prover: z.ZodUnion<readonly [z.ZodString, z.
|
|
192
|
+
creator: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
193
|
+
prover: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
194
194
|
nativeAmount: z.ZodString;
|
|
195
195
|
tokens: z.ZodArray<z.ZodObject<{
|
|
196
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
196
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
197
197
|
amount: z.ZodString;
|
|
198
198
|
}, z.core.$loose>>;
|
|
199
199
|
}, z.core.$loose>;
|
|
@@ -220,17 +220,17 @@ export declare const V1_ENDPOINTS: {
|
|
|
220
220
|
}>;
|
|
221
221
|
source: z.ZodObject<{
|
|
222
222
|
chainId: z.ZodNumber;
|
|
223
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
223
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
224
224
|
amount: z.ZodString;
|
|
225
225
|
symbol: z.ZodNullable<z.ZodString>;
|
|
226
226
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
227
227
|
}, z.core.$loose>;
|
|
228
228
|
destination: z.ZodObject<{
|
|
229
229
|
chainId: z.ZodNumber;
|
|
230
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
230
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
231
231
|
amount: z.ZodString;
|
|
232
232
|
minAmountOut: z.ZodString;
|
|
233
|
-
recipient: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.
|
|
233
|
+
recipient: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
234
234
|
symbol: z.ZodNullable<z.ZodString>;
|
|
235
235
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
236
236
|
}, z.core.$loose>;
|
|
@@ -245,7 +245,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
245
245
|
amount: z.ZodString;
|
|
246
246
|
token: z.ZodObject<{
|
|
247
247
|
chainId: z.ZodNumber;
|
|
248
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
248
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
249
249
|
symbol: z.ZodNullable<z.ZodString>;
|
|
250
250
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
251
251
|
}, z.core.$loose>;
|
|
@@ -262,12 +262,12 @@ export declare const V1_ENDPOINTS: {
|
|
|
262
262
|
aggregator: z.ZodOptional<z.ZodString>;
|
|
263
263
|
from: z.ZodObject<{
|
|
264
264
|
chainId: z.ZodNumber;
|
|
265
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
265
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
266
266
|
amount: z.ZodString;
|
|
267
267
|
}, z.core.$loose>;
|
|
268
268
|
to: z.ZodObject<{
|
|
269
269
|
chainId: z.ZodNumber;
|
|
270
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
270
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
271
271
|
amount: z.ZodString;
|
|
272
272
|
}, z.core.$loose>;
|
|
273
273
|
fees: z.ZodArray<z.ZodObject<{
|
|
@@ -280,7 +280,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
280
280
|
amount: z.ZodString;
|
|
281
281
|
token: z.ZodObject<{
|
|
282
282
|
chainId: z.ZodNumber;
|
|
283
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
283
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
284
284
|
symbol: z.ZodNullable<z.ZodString>;
|
|
285
285
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
286
286
|
}, z.core.$loose>;
|
|
@@ -299,7 +299,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
299
299
|
bucketIndex: z.ZodOptional<z.ZodNumber>;
|
|
300
300
|
}, z.core.$loose>>;
|
|
301
301
|
solver: z.ZodObject<{
|
|
302
|
-
id: z.ZodUnion<readonly [z.ZodString, z.
|
|
302
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
303
303
|
name: z.ZodOptional<z.ZodString>;
|
|
304
304
|
}, z.core.$loose>;
|
|
305
305
|
intentHash: z.ZodNullable<z.ZodString>;
|
|
@@ -321,25 +321,25 @@ export declare const V1_ENDPOINTS: {
|
|
|
321
321
|
deadline: z.ZodNumber;
|
|
322
322
|
source: z.ZodNumber;
|
|
323
323
|
destination: z.ZodNumber;
|
|
324
|
-
portal: z.ZodUnion<readonly [z.ZodString, z.
|
|
324
|
+
portal: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
325
325
|
nativeAmount: z.ZodString;
|
|
326
326
|
tokens: z.ZodArray<z.ZodObject<{
|
|
327
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
327
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
328
328
|
amount: z.ZodString;
|
|
329
329
|
}, z.core.$loose>>;
|
|
330
330
|
calls: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
331
|
-
target: z.ZodUnion<readonly [z.ZodString, z.
|
|
331
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
332
332
|
data: z.ZodString;
|
|
333
333
|
value: z.ZodString;
|
|
334
334
|
}, z.core.$loose>>>;
|
|
335
335
|
}, z.core.$loose>;
|
|
336
336
|
reward: z.ZodObject<{
|
|
337
337
|
deadline: z.ZodNumber;
|
|
338
|
-
creator: z.ZodUnion<readonly [z.ZodString, z.
|
|
339
|
-
prover: z.ZodUnion<readonly [z.ZodString, z.
|
|
338
|
+
creator: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
339
|
+
prover: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
340
340
|
nativeAmount: z.ZodString;
|
|
341
341
|
tokens: z.ZodArray<z.ZodObject<{
|
|
342
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
342
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
343
343
|
amount: z.ZodString;
|
|
344
344
|
}, z.core.$loose>>;
|
|
345
345
|
}, z.core.$loose>;
|
|
@@ -466,7 +466,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
466
466
|
chains: z.ZodArray<z.ZodObject<{
|
|
467
467
|
chainId: z.ZodNumber;
|
|
468
468
|
name: z.ZodString;
|
|
469
|
-
quoteSigner: z.ZodUnion<readonly [z.ZodString, z.
|
|
469
|
+
quoteSigner: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
470
470
|
type: z.ZodEnum<{
|
|
471
471
|
evm: "evm";
|
|
472
472
|
svm: "svm";
|
|
@@ -481,8 +481,8 @@ export declare const V1_ENDPOINTS: {
|
|
|
481
481
|
paused: "paused";
|
|
482
482
|
}>;
|
|
483
483
|
contracts: z.ZodObject<{
|
|
484
|
-
portal: z.ZodUnion<readonly [z.ZodString, z.
|
|
485
|
-
executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.
|
|
484
|
+
portal: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
485
|
+
executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
486
486
|
}, z.core.$loose>;
|
|
487
487
|
}, z.core.$loose>>;
|
|
488
488
|
}, z.core.$loose>;
|
|
@@ -497,7 +497,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
497
497
|
readonly response: z.ZodObject<{
|
|
498
498
|
tokens: z.ZodArray<z.ZodObject<{
|
|
499
499
|
chainId: z.ZodNumber;
|
|
500
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
500
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
501
501
|
symbol: z.ZodNullable<z.ZodString>;
|
|
502
502
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
503
503
|
supports: z.ZodObject<{
|
|
@@ -529,11 +529,11 @@ export declare const V1_ENDPOINTS: {
|
|
|
529
529
|
routes: z.ZodArray<z.ZodObject<{
|
|
530
530
|
source: z.ZodObject<{
|
|
531
531
|
chainId: z.ZodNumber;
|
|
532
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
532
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
533
533
|
}, z.core.$loose>;
|
|
534
534
|
destination: z.ZodObject<{
|
|
535
535
|
chainId: z.ZodNumber;
|
|
536
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
536
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
537
537
|
}, z.core.$loose>;
|
|
538
538
|
swapTypes: z.ZodArray<z.ZodEnum<{
|
|
539
539
|
custom: "custom";
|
|
@@ -556,18 +556,18 @@ export declare const V1_ENDPOINTS: {
|
|
|
556
556
|
depositor: z.ZodString;
|
|
557
557
|
kind: z.ZodLiteral<"solana">;
|
|
558
558
|
destinationAddress: z.ZodString;
|
|
559
|
-
}, z.core.$
|
|
559
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
560
560
|
chainId: z.ZodNumber;
|
|
561
561
|
depositor: z.ZodString;
|
|
562
562
|
kind: z.ZodLiteral<"gateway">;
|
|
563
563
|
destinationAddress: z.ZodString;
|
|
564
|
-
}, z.core.$
|
|
564
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
565
565
|
chainId: z.ZodNumber;
|
|
566
566
|
depositor: z.ZodString;
|
|
567
567
|
kind: z.ZodLiteral<"gateway-erc20">;
|
|
568
568
|
destinationAddress: z.ZodString;
|
|
569
569
|
destinationChainId: z.ZodNumber;
|
|
570
|
-
}, z.core.$
|
|
570
|
+
}, z.core.$strict>], "kind">;
|
|
571
571
|
readonly response: z.ZodObject<{
|
|
572
572
|
id: z.ZodString;
|
|
573
573
|
depositAddress: z.ZodString;
|
|
@@ -578,7 +578,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
578
578
|
solana: "solana";
|
|
579
579
|
"gateway-erc20": "gateway-erc20";
|
|
580
580
|
}>;
|
|
581
|
-
destinationAddress: z.ZodUnion<readonly [z.ZodString, z.
|
|
581
|
+
destinationAddress: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
582
582
|
destinationChainId: z.ZodOptional<z.ZodNumber>;
|
|
583
583
|
expiresAt: z.ZodNullable<z.ZodNumber>;
|
|
584
584
|
createdAt: z.ZodNumber;
|
|
@@ -596,7 +596,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
596
596
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
597
597
|
depositAddress: z.ZodOptional<z.ZodString>;
|
|
598
598
|
depositor: z.ZodOptional<z.ZodString>;
|
|
599
|
-
destinationAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.
|
|
599
|
+
destinationAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
|
|
600
600
|
chainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
601
601
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
602
602
|
gateway: "gateway";
|
|
@@ -615,7 +615,7 @@ export declare const V1_ENDPOINTS: {
|
|
|
615
615
|
solana: "solana";
|
|
616
616
|
"gateway-erc20": "gateway-erc20";
|
|
617
617
|
}>;
|
|
618
|
-
destinationAddress: z.ZodUnion<readonly [z.ZodString, z.
|
|
618
|
+
destinationAddress: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
619
619
|
destinationChainId: z.ZodOptional<z.ZodNumber>;
|
|
620
620
|
expiresAt: z.ZodNullable<z.ZodNumber>;
|
|
621
621
|
createdAt: z.ZodNumber;
|
|
@@ -633,7 +633,7 @@ export declare const V1_ERROR_RESPONSE_SCHEMA: z.ZodObject<{
|
|
|
633
633
|
instance: z.ZodOptional<z.ZodString>;
|
|
634
634
|
legacyCode: z.ZodOptional<z.ZodString>;
|
|
635
635
|
solverErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
636
|
-
solver: z.ZodUnion<readonly [z.ZodString, z.
|
|
636
|
+
solver: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
637
637
|
solverName: z.ZodOptional<z.ZodString>;
|
|
638
638
|
code: z.ZodOptional<z.ZodString>;
|
|
639
639
|
message: z.ZodString;
|
|
@@ -3,11 +3,11 @@ export declare const ROUTES_STABILITY: "draft";
|
|
|
3
3
|
export declare const RouteEntrySchema: z.ZodObject<{
|
|
4
4
|
source: z.ZodObject<{
|
|
5
5
|
chainId: z.ZodNumber;
|
|
6
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
6
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
7
7
|
}, z.core.$loose>;
|
|
8
8
|
destination: z.ZodObject<{
|
|
9
9
|
chainId: z.ZodNumber;
|
|
10
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
10
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
11
11
|
}, z.core.$loose>;
|
|
12
12
|
swapTypes: z.ZodArray<z.ZodEnum<{
|
|
13
13
|
custom: "custom";
|
|
@@ -19,11 +19,11 @@ export declare const RoutesResponseSchema: z.ZodObject<{
|
|
|
19
19
|
routes: z.ZodArray<z.ZodObject<{
|
|
20
20
|
source: z.ZodObject<{
|
|
21
21
|
chainId: z.ZodNumber;
|
|
22
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
22
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
23
23
|
}, z.core.$loose>;
|
|
24
24
|
destination: z.ZodObject<{
|
|
25
25
|
chainId: z.ZodNumber;
|
|
26
|
-
token: z.ZodUnion<readonly [z.ZodString, z.
|
|
26
|
+
token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
27
27
|
}, z.core.$loose>;
|
|
28
28
|
swapTypes: z.ZodArray<z.ZodEnum<{
|
|
29
29
|
custom: "custom";
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GaslessJobSchema = exports.GaslessSubStatusSchema = exports.V1_SUBMIT_SCHEMAS_BY_SERVICE = exports.SUBMIT_TARGET_KIND_BY_SERVICE = exports.SUBMIT_SERVICES = exports.V1_SUBMIT_SCHEMAS = exports.Erc2612SubmitSchema = exports.Erc2612PermitSchema = exports.Erc3009DepositAddressSubmitSchema = exports.Erc3009IntentsSubmitSchema = exports.Erc3009SubmitSchema = exports.Erc3009AuthorizationSchema = exports.Permit2SubmitSchema = exports.Permit2PermitSingleSchema = exports.Permit3SubmitSchema = exports.Permit3PayloadSchema = exports.Permit3AllowanceSchema = exports.SubmitTargetSchema = exports.SubmitSignature = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enums_1 = require("../enums");
|
|
6
|
+
const problem_1 = require("../errors/problem");
|
|
6
7
|
const primitives_1 = require("../primitives");
|
|
7
8
|
const UINT48_MAX = 281474976710655;
|
|
8
9
|
const SIGNATURE_MESSAGE = 'signature must be 64 bytes (EIP-2098 compact) or 65 bytes (r||s||v)';
|
|
@@ -49,17 +50,22 @@ exports.Erc3009AuthorizationSchema = zod_1.z.object({
|
|
|
49
50
|
validBefore: primitives_1.UintString,
|
|
50
51
|
nonce: primitives_1.Bytes32,
|
|
51
52
|
});
|
|
52
|
-
function
|
|
53
|
-
if ('depositAddress' in
|
|
54
|
-
!(0, primitives_1.isSameEvmAddress)(body.authorization.to, body.target.depositAddress)) {
|
|
53
|
+
function refineDepositAddressBinding(target, signedValue, path, fieldName, ctx) {
|
|
54
|
+
if ('depositAddress' in target && !(0, primitives_1.isSameEvmAddress)(signedValue, target.depositAddress)) {
|
|
55
55
|
ctx.addIssue({
|
|
56
56
|
code: 'custom',
|
|
57
|
-
path: [
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
path: [...path],
|
|
58
|
+
params: (0, problem_1.v1IssueParams)('deposit-address-mismatch'),
|
|
59
|
+
message: `signed \`${fieldName}\` must equal target.depositAddress (D10 #4)`,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
function refineErc3009ToBinding(body, ctx) {
|
|
64
|
+
refineDepositAddressBinding(body.target, body.authorization.to, ['authorization', 'to'], 'authorization.to', ctx);
|
|
65
|
+
}
|
|
66
|
+
function refineErc2612SpenderBinding(body, ctx) {
|
|
67
|
+
refineDepositAddressBinding(body.target, body.permit.spender, ['permit', 'spender'], 'permit.spender', ctx);
|
|
68
|
+
}
|
|
63
69
|
const erc3009Fields = {
|
|
64
70
|
chainId: primitives_1.ChainId,
|
|
65
71
|
authorization: exports.Erc3009AuthorizationSchema,
|
|
@@ -81,12 +87,14 @@ exports.Erc2612PermitSchema = zod_1.z.object({
|
|
|
81
87
|
nonce: primitives_1.UintString,
|
|
82
88
|
deadline: primitives_1.UnixSeconds,
|
|
83
89
|
});
|
|
84
|
-
exports.Erc2612SubmitSchema = zod_1.z
|
|
90
|
+
exports.Erc2612SubmitSchema = zod_1.z
|
|
91
|
+
.object({
|
|
85
92
|
chainId: primitives_1.ChainId,
|
|
86
93
|
target: DepositAddressTargetSchema,
|
|
87
94
|
permit: exports.Erc2612PermitSchema,
|
|
88
95
|
signature: exports.SubmitSignature,
|
|
89
|
-
})
|
|
96
|
+
})
|
|
97
|
+
.superRefine(refineErc2612SpenderBinding);
|
|
90
98
|
exports.V1_SUBMIT_SCHEMAS = {
|
|
91
99
|
permit3: exports.Permit3SubmitSchema,
|
|
92
100
|
permit2: exports.Permit2SubmitSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../src/v1/endpoints/submit.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,oCAKkB;AAClB,8CAUuB;AAEvB,MAAM,UAAU,GAAG,eAAe,CAAC;AAmBnC,MAAM,iBAAiB,GAAG,qEAAqE,CAAC;AACnF,QAAA,eAAe,GAAG,qBAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,iBAAiB,CAAC,CAAC,GAAG,CAC5E,CAAC,GAAG,EAAE,GAAG,CAAC,EACV,iBAAiB,CAClB,CAAC;AAWF,MAAM,iBAAiB,GAAG,OAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,oBAAO,EAAE,CAAC,CAAC;AAC/D,MAAM,0BAA0B,GAAG,OAAC,CAAC,YAAY,CAAC,EAAE,cAAc,EAAE,uBAAU,EAAE,CAAC,CAAC;AAErE,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAM9E,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IA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
|
|
16
16
|
export declare const TokenEntrySchema: z.ZodObject<{
|
|
17
17
|
chainId: z.ZodNumber;
|
|
18
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
18
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
19
19
|
symbol: z.ZodNullable<z.ZodString>;
|
|
20
20
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
21
21
|
supports: z.ZodObject<{
|
|
@@ -37,7 +37,7 @@ export type TokenEntry = z.input<typeof TokenEntrySchema>;
|
|
|
37
37
|
export declare const TokensResponseSchema: z.ZodObject<{
|
|
38
38
|
tokens: z.ZodArray<z.ZodObject<{
|
|
39
39
|
chainId: z.ZodNumber;
|
|
40
|
-
address: z.ZodUnion<readonly [z.ZodString, z.
|
|
40
|
+
address: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
41
41
|
symbol: z.ZodNullable<z.ZodString>;
|
|
42
42
|
decimals: z.ZodNullable<z.ZodNumber>;
|
|
43
43
|
supports: z.ZodObject<{
|
|
@@ -15,7 +15,7 @@ exports.V1_ERROR_CATALOG = [
|
|
|
15
15
|
]),
|
|
16
16
|
define('slippage-out-of-bounds', 400, 'slippage is outside the valid 0-1 range; it is a decimal fraction ' +
|
|
17
17
|
'(0.005 = 0.5%), not a percent (0.5 means 50%)', 'all'),
|
|
18
|
-
define('deposit-address-mismatch', 400, 'The signed
|
|
18
|
+
define('deposit-address-mismatch', 400, 'The signed counterparty does not equal target.depositAddress', 'write'),
|
|
19
19
|
define('invalid-signature', 401, 'Signature verification failed', 'write', [
|
|
20
20
|
'eco-quotes:1007',
|
|
21
21
|
'eco-quotes:1008',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/v1/errors/catalog.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"catal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AAM,OAAO,GAAG,IAAI,GAAG,CACrB,wBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAU,CAAC,CAClD,CAAC;AAEF,SAAgB,kBAAkB,CAAC,IAAiB;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IAC5D,OAAO,GAAG,CAAC;AACb,CAAC;AAMY,QAAA,qBAAqB,GAA6D;IAC7F,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACvF,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACvF,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACvF,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACvF,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,4CAA4C,EAAE;IACvF,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,kDAAkD,EAAE;IAC7F;QACE,UAAU,EAAE,wBAAwB;QACpC,MAAM,EAAE,8EAA8E;KACvF;CACF,CAAC"}
|
|
@@ -19,7 +19,7 @@ export interface V1Problem {
|
|
|
19
19
|
[extension: string]: unknown;
|
|
20
20
|
}
|
|
21
21
|
export declare const V1SolverErrorSchema: z.ZodObject<{
|
|
22
|
-
solver: z.ZodUnion<readonly [z.ZodString, z.
|
|
22
|
+
solver: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
23
23
|
solverName: z.ZodOptional<z.ZodString>;
|
|
24
24
|
code: z.ZodOptional<z.ZodString>;
|
|
25
25
|
message: z.ZodString;
|
|
@@ -33,7 +33,7 @@ export declare const V1ProblemSchema: z.ZodObject<{
|
|
|
33
33
|
instance: z.ZodOptional<z.ZodString>;
|
|
34
34
|
legacyCode: z.ZodOptional<z.ZodString>;
|
|
35
35
|
solverErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
|
-
solver: z.ZodUnion<readonly [z.ZodString, z.
|
|
36
|
+
solver: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
37
37
|
solverName: z.ZodOptional<z.ZodString>;
|
|
38
38
|
code: z.ZodOptional<z.ZodString>;
|
|
39
39
|
message: z.ZodString;
|
|
@@ -47,4 +47,10 @@ export interface ProblemOptions {
|
|
|
47
47
|
solverErrors?: V1SolverError[];
|
|
48
48
|
extensions?: Record<string, unknown>;
|
|
49
49
|
}
|
|
50
|
+
export declare const V1_ISSUE_CODE_PARAM = "v1ErrorCode";
|
|
51
|
+
export declare function v1IssueParams(code: V1ErrorCode): {
|
|
52
|
+
readonly [V1_ISSUE_CODE_PARAM]: V1ErrorCode;
|
|
53
|
+
};
|
|
54
|
+
export declare function v1ErrorCodeFromIssues(issues: readonly z.core.$ZodIssue[]): V1ErrorCode;
|
|
55
|
+
export declare function problemFromZodError(error: z.ZodError, opts?: ProblemOptions): V1Problem;
|
|
50
56
|
export declare function problem(code: V1ErrorCode, opts?: ProblemOptions): V1Problem;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROBLEM_RESERVED_MEMBERS = exports.V1ProblemSchema = exports.V1SolverErrorSchema = exports.PROBLEM_CONTENT_TYPE = void 0;
|
|
3
|
+
exports.V1_ISSUE_CODE_PARAM = exports.PROBLEM_RESERVED_MEMBERS = exports.V1ProblemSchema = exports.V1SolverErrorSchema = exports.PROBLEM_CONTENT_TYPE = void 0;
|
|
4
|
+
exports.v1IssueParams = v1IssueParams;
|
|
5
|
+
exports.v1ErrorCodeFromIssues = v1ErrorCodeFromIssues;
|
|
6
|
+
exports.problemFromZodError = problemFromZodError;
|
|
4
7
|
exports.problem = problem;
|
|
5
8
|
const zod_1 = require("zod");
|
|
6
9
|
const primitives_1 = require("../primitives");
|
|
@@ -57,6 +60,36 @@ exports.PROBLEM_RESERVED_MEMBERS = [
|
|
|
57
60
|
'legacyCode',
|
|
58
61
|
'solverErrors',
|
|
59
62
|
];
|
|
63
|
+
exports.V1_ISSUE_CODE_PARAM = 'v1ErrorCode';
|
|
64
|
+
function v1IssueParams(code) {
|
|
65
|
+
return { [exports.V1_ISSUE_CODE_PARAM]: code };
|
|
66
|
+
}
|
|
67
|
+
function v1ErrorCodeFromIssues(issues) {
|
|
68
|
+
for (const issue of issues) {
|
|
69
|
+
if (issue.code !== 'custom')
|
|
70
|
+
continue;
|
|
71
|
+
const named = issue.params?.[exports.V1_ISSUE_CODE_PARAM];
|
|
72
|
+
if (typeof named === 'string' && CATALOG_BY_CODE.has(named))
|
|
73
|
+
return named;
|
|
74
|
+
}
|
|
75
|
+
return 'invalid-request';
|
|
76
|
+
}
|
|
77
|
+
const MAX_DETAIL_ISSUES = 8;
|
|
78
|
+
const renderIssue = (issue) => {
|
|
79
|
+
const path = issue.path.map((segment) => String(segment)).join('.');
|
|
80
|
+
return path.length > 0 ? `${path}: ${issue.message}` : issue.message;
|
|
81
|
+
};
|
|
82
|
+
function problemFromZodError(error, opts = {}) {
|
|
83
|
+
const issues = error.issues;
|
|
84
|
+
const shown = issues.slice(0, MAX_DETAIL_ISSUES).map(renderIssue);
|
|
85
|
+
const omitted = issues.length - shown.length;
|
|
86
|
+
const rendered = [...shown, ...(omitted > 0 ? [`(+${omitted} more issues)`] : [])].join('; ');
|
|
87
|
+
const detail = opts.detail ?? (rendered.length > 0 ? rendered : undefined);
|
|
88
|
+
return problem(v1ErrorCodeFromIssues(issues), {
|
|
89
|
+
...opts,
|
|
90
|
+
...(detail !== undefined ? { detail } : {}),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
60
93
|
function problem(code, opts = {}) {
|
|
61
94
|
const def = (0, catalog_1.getErrorDefinition)(code);
|
|
62
95
|
for (const key of Object.keys(opts.extensions ?? {})) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../../../src/v1/errors/problem.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../../../src/v1/errors/problem.ts"],"names":[],"mappings":";;;AA6KA,sCAEC;AAYD,sDAOC;AAsBD,kDAUC;AAED,0BAqBC;AAzPD,6BAAwB;AAExB,8CAA2C;AAC3C,uCAA6F;AA8BhF,QAAA,oBAAoB,GAAG,0BAA0B,CAAC;AA0ClD,QAAA,mBAAmB,GAAG,OAAC,CAAC,WAAW,CAAC;IAC/C,MAAM,EAAE,uBAAU;IAClB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,0BAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAc,EAAE,CAAC,CAAU,CAAC,CAC5D,CAAC;AAGW,QAAA,eAAe,GAAG,OAAC;KAC7B,WAAW,CAAC;IACX,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE;IACb,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GA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,UAAU;QAClB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,IAAI;QACJ,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC"}
|
package/dist/v1/primitives.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const MAX_UINT256: bigint;
|
|
2
3
|
export declare const UintString: z.ZodString;
|
|
3
4
|
export type UintString = z.infer<typeof UintString>;
|
|
4
5
|
export declare const HexBytes: z.ZodString;
|
|
@@ -8,7 +9,7 @@ export type Bytes32 = z.infer<typeof Bytes32>;
|
|
|
8
9
|
export declare const EvmAddress: z.ZodString;
|
|
9
10
|
export declare const SvmAddress: z.ZodString;
|
|
10
11
|
export declare const TvmAddress: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
11
|
-
export declare const AnyAddress: z.ZodUnion<readonly [z.ZodString, z.
|
|
12
|
+
export declare const AnyAddress: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
|
|
12
13
|
export type AnyAddress = z.infer<typeof AnyAddress>;
|
|
13
14
|
export declare const ADDRESS_BY_CHAIN_TYPE: Record<'evm' | 'svm' | 'tvm', z.ZodType<string>>;
|
|
14
15
|
export declare function isSameEvmAddress(a: string, b: string): boolean;
|
package/dist/v1/primitives.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tolerantEnum = exports.V1Id = exports.DepositAddressId = exports.GaslessJobRef = exports.GaslessId = exports.IntentId = exports.QuoteId = exports.DappId = exports.UnixSeconds = exports.MAX_UNIX_SECONDS = exports.ChainId = exports.ADDRESS_BY_CHAIN_TYPE = exports.AnyAddress = exports.TvmAddress = exports.SvmAddress = exports.EvmAddress = exports.Bytes32 = exports.HexBytes = exports.UintString = void 0;
|
|
3
|
+
exports.tolerantEnum = exports.V1Id = exports.DepositAddressId = exports.GaslessJobRef = exports.GaslessId = exports.IntentId = exports.QuoteId = exports.DappId = exports.UnixSeconds = exports.MAX_UNIX_SECONDS = exports.ChainId = exports.ADDRESS_BY_CHAIN_TYPE = exports.AnyAddress = exports.TvmAddress = exports.SvmAddress = exports.EvmAddress = exports.Bytes32 = exports.HexBytes = exports.UintString = exports.MAX_UINT256 = void 0;
|
|
4
4
|
exports.isSameEvmAddress = isSameEvmAddress;
|
|
5
5
|
exports.parseV1Id = parseV1Id;
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
-
exports.
|
|
7
|
+
exports.MAX_UINT256 = (1n << 256n) - 1n;
|
|
8
|
+
const UINT256_MAX_DIGITS = 78;
|
|
9
|
+
const DECIMAL_UINT_PATTERN = /^(0|[1-9]\d*)$/;
|
|
10
|
+
const UINT256_CEILING_MESSAGE = 'exceeds the uint256 ceiling (2^256-1)';
|
|
11
|
+
const isWithinUint256 = (value) => DECIMAL_UINT_PATTERN.test(value) && BigInt(value) <= exports.MAX_UINT256;
|
|
12
|
+
exports.UintString = zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(DECIMAL_UINT_PATTERN, 'base-10 unsigned integer string')
|
|
15
|
+
.max(UINT256_MAX_DIGITS, UINT256_CEILING_MESSAGE)
|
|
16
|
+
.refine(isWithinUint256, UINT256_CEILING_MESSAGE);
|
|
8
17
|
exports.HexBytes = zod_1.z.string().regex(/^0x(?:[0-9a-fA-F]{2})*$/, '0x-prefixed hex bytes');
|
|
9
18
|
exports.Bytes32 = zod_1.z.string().regex(/^0x[0-9a-fA-F]{64}$/, '0x-prefixed 32-byte hex');
|
|
10
19
|
exports.EvmAddress = zod_1.z
|
|
@@ -17,7 +26,7 @@ exports.TvmAddress = zod_1.z.union([
|
|
|
17
26
|
zod_1.z.string().regex(/^T[1-9A-HJ-NP-Za-km-z]{33}$/, 'TVM address (base58check)'),
|
|
18
27
|
zod_1.z.string().regex(/^0x41[0-9a-fA-F]{40}$/, 'TVM address (0x41-prefixed hex)'),
|
|
19
28
|
]);
|
|
20
|
-
exports.AnyAddress = zod_1.z.union([exports.EvmAddress, exports.
|
|
29
|
+
exports.AnyAddress = zod_1.z.union([exports.EvmAddress, exports.TvmAddress, exports.SvmAddress]);
|
|
21
30
|
exports.ADDRESS_BY_CHAIN_TYPE = {
|
|
22
31
|
evm: exports.EvmAddress,
|
|
23
32
|
svm: exports.SvmAddress,
|