@mimicprotocol/test-ts 0.0.1-rc.9 → 0.0.1
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/CHANGELOG.md +134 -0
- package/README.md +21 -22
- package/dist/RunnerMock.d.ts +6 -1
- package/dist/RunnerMock.js +80 -26
- package/dist/RunnerMock.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/processors/evm-call.d.ts +3 -0
- package/dist/processors/evm-call.js +24 -0
- package/dist/processors/evm-call.js.map +1 -0
- package/dist/processors/index.d.ts +4 -0
- package/dist/processors/index.js +21 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/price.d.ts +3 -0
- package/dist/processors/price.js +16 -0
- package/dist/processors/price.js.map +1 -0
- package/dist/processors/relevant-tokens.d.ts +3 -0
- package/dist/processors/relevant-tokens.js +14 -0
- package/dist/processors/relevant-tokens.js.map +1 -0
- package/dist/processors/subgraph.d.ts +3 -0
- package/dist/processors/subgraph.js +16 -0
- package/dist/processors/subgraph.js.map +1 -0
- package/dist/run-function.d.ts +2 -0
- package/dist/run-function.js +83 -0
- package/dist/run-function.js.map +1 -0
- package/dist/types.d.ts +65 -41
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +93 -0
- package/dist/utils.js.map +1 -0
- package/dist/validators.d.ts +447 -20
- package/dist/validators.js +58 -10
- package/dist/validators.js.map +1 -1
- package/package.json +9 -3
- package/dist/run-task.d.ts +0 -2
- package/dist/run-task.js +0 -107
- package/dist/run-task.js.map +0 -1
package/dist/validators.d.ts
CHANGED
|
@@ -1,4 +1,60 @@
|
|
|
1
|
-
import { z } from '
|
|
1
|
+
import { z } from '@mimicprotocol/sdk';
|
|
2
|
+
export declare const ContextValidator: z.ZodObject<{
|
|
3
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
4
|
+
consensusThreshold: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
user: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
6
|
+
settlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
8
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
address: string;
|
|
11
|
+
chainId: number;
|
|
12
|
+
}, {
|
|
13
|
+
address: string;
|
|
14
|
+
chainId: number;
|
|
15
|
+
}>, "many">>;
|
|
16
|
+
triggerSig: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
17
|
+
triggerPayload: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
type: z.ZodNativeEnum<{
|
|
19
|
+
readonly Cron: 0;
|
|
20
|
+
readonly Event: 1;
|
|
21
|
+
readonly Once: 2;
|
|
22
|
+
}>;
|
|
23
|
+
data: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: 0 | 2 | 1;
|
|
26
|
+
data: string;
|
|
27
|
+
}, {
|
|
28
|
+
type: 0 | 2 | 1;
|
|
29
|
+
data: string;
|
|
30
|
+
}>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
timestamp?: number | undefined;
|
|
33
|
+
consensusThreshold?: number | undefined;
|
|
34
|
+
user?: string | undefined;
|
|
35
|
+
settlers?: {
|
|
36
|
+
address: string;
|
|
37
|
+
chainId: number;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
triggerSig?: string | undefined;
|
|
40
|
+
triggerPayload?: {
|
|
41
|
+
type: 0 | 2 | 1;
|
|
42
|
+
data: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
timestamp?: number | undefined;
|
|
46
|
+
consensusThreshold?: number | undefined;
|
|
47
|
+
user?: string | undefined;
|
|
48
|
+
settlers?: {
|
|
49
|
+
address: string;
|
|
50
|
+
chainId: number;
|
|
51
|
+
}[] | undefined;
|
|
52
|
+
triggerSig?: string | undefined;
|
|
53
|
+
triggerPayload?: {
|
|
54
|
+
type: 0 | 2 | 1;
|
|
55
|
+
data: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}>;
|
|
2
58
|
export declare const ParameterizedResponseValidator: z.ZodEffects<z.ZodObject<{
|
|
3
59
|
paramResponse: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4
60
|
default: z.ZodOptional<z.ZodString>;
|
|
@@ -20,7 +76,40 @@ export declare const ParameterizedResponseValidator: z.ZodEffects<z.ZodObject<{
|
|
|
20
76
|
default?: string | undefined;
|
|
21
77
|
log?: boolean | undefined;
|
|
22
78
|
}>;
|
|
23
|
-
export declare const InputsValidator: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodNumber, z.ZodString
|
|
79
|
+
export declare const InputsValidator: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
80
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
81
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
address: string;
|
|
84
|
+
chainId: number;
|
|
85
|
+
}, {
|
|
86
|
+
address: string;
|
|
87
|
+
chainId: number;
|
|
88
|
+
}>, z.ZodObject<{
|
|
89
|
+
token: z.ZodObject<{
|
|
90
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
91
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
address: string;
|
|
94
|
+
chainId: number;
|
|
95
|
+
}, {
|
|
96
|
+
address: string;
|
|
97
|
+
chainId: number;
|
|
98
|
+
}>;
|
|
99
|
+
amount: z.ZodEffects<z.ZodString, string, string>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
token: {
|
|
102
|
+
address: string;
|
|
103
|
+
chainId: number;
|
|
104
|
+
};
|
|
105
|
+
amount: string;
|
|
106
|
+
}, {
|
|
107
|
+
token: {
|
|
108
|
+
address: string;
|
|
109
|
+
chainId: number;
|
|
110
|
+
};
|
|
111
|
+
amount: string;
|
|
112
|
+
}>]>>;
|
|
24
113
|
export declare const MockFunctionResponseValidator: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
25
114
|
paramResponse: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
115
|
default: z.ZodOptional<z.ZodString>;
|
|
@@ -63,24 +152,362 @@ export declare const MockSectionValidator: z.ZodRecord<z.ZodString, z.ZodUnion<[
|
|
|
63
152
|
default?: string | undefined;
|
|
64
153
|
log?: boolean | undefined;
|
|
65
154
|
}>, z.ZodLiteral<"log">]>>;
|
|
66
|
-
export declare const MockConfigValidator: z.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
155
|
+
export declare const MockConfigValidator: z.ZodObject<{
|
|
156
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
157
|
+
paramResponse: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
default: z.ZodOptional<z.ZodString>;
|
|
159
|
+
log: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
paramResponse?: Record<string, string> | undefined;
|
|
162
|
+
default?: string | undefined;
|
|
163
|
+
log?: boolean | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
paramResponse?: Record<string, string> | undefined;
|
|
166
|
+
default?: string | undefined;
|
|
167
|
+
log?: boolean | undefined;
|
|
168
|
+
}>, {
|
|
169
|
+
paramResponse?: Record<string, string> | undefined;
|
|
170
|
+
default?: string | undefined;
|
|
171
|
+
log?: boolean | undefined;
|
|
172
|
+
}, {
|
|
173
|
+
paramResponse?: Record<string, string> | undefined;
|
|
174
|
+
default?: string | undefined;
|
|
175
|
+
log?: boolean | undefined;
|
|
176
|
+
}>, z.ZodLiteral<"log">]>>>;
|
|
177
|
+
evm: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
178
|
+
paramResponse: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
default: z.ZodOptional<z.ZodString>;
|
|
180
|
+
log: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
paramResponse?: Record<string, string> | undefined;
|
|
183
|
+
default?: string | undefined;
|
|
184
|
+
log?: boolean | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
paramResponse?: Record<string, string> | undefined;
|
|
187
|
+
default?: string | undefined;
|
|
188
|
+
log?: boolean | undefined;
|
|
189
|
+
}>, {
|
|
190
|
+
paramResponse?: Record<string, string> | undefined;
|
|
191
|
+
default?: string | undefined;
|
|
192
|
+
log?: boolean | undefined;
|
|
193
|
+
}, {
|
|
194
|
+
paramResponse?: Record<string, string> | undefined;
|
|
195
|
+
default?: string | undefined;
|
|
196
|
+
log?: boolean | undefined;
|
|
197
|
+
}>, z.ZodLiteral<"log">]>>>;
|
|
198
|
+
svm: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
199
|
+
paramResponse: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
200
|
+
default: z.ZodOptional<z.ZodString>;
|
|
201
|
+
log: z.ZodOptional<z.ZodBoolean>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
paramResponse?: Record<string, string> | undefined;
|
|
204
|
+
default?: string | undefined;
|
|
205
|
+
log?: boolean | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
paramResponse?: Record<string, string> | undefined;
|
|
208
|
+
default?: string | undefined;
|
|
209
|
+
log?: boolean | undefined;
|
|
210
|
+
}>, {
|
|
211
|
+
paramResponse?: Record<string, string> | undefined;
|
|
212
|
+
default?: string | undefined;
|
|
213
|
+
log?: boolean | undefined;
|
|
214
|
+
}, {
|
|
215
|
+
paramResponse?: Record<string, string> | undefined;
|
|
216
|
+
default?: string | undefined;
|
|
217
|
+
log?: boolean | undefined;
|
|
218
|
+
}>, z.ZodLiteral<"log">]>>>;
|
|
219
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
220
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
221
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
address: string;
|
|
224
|
+
chainId: number;
|
|
225
|
+
}, {
|
|
226
|
+
address: string;
|
|
227
|
+
chainId: number;
|
|
228
|
+
}>, z.ZodObject<{
|
|
229
|
+
token: z.ZodObject<{
|
|
230
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
231
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
address: string;
|
|
234
|
+
chainId: number;
|
|
235
|
+
}, {
|
|
236
|
+
address: string;
|
|
237
|
+
chainId: number;
|
|
238
|
+
}>;
|
|
239
|
+
amount: z.ZodEffects<z.ZodString, string, string>;
|
|
240
|
+
}, "strip", z.ZodTypeAny, {
|
|
241
|
+
token: {
|
|
242
|
+
address: string;
|
|
243
|
+
chainId: number;
|
|
244
|
+
};
|
|
245
|
+
amount: string;
|
|
246
|
+
}, {
|
|
247
|
+
token: {
|
|
248
|
+
address: string;
|
|
249
|
+
chainId: number;
|
|
250
|
+
};
|
|
251
|
+
amount: string;
|
|
252
|
+
}>]>>>;
|
|
70
253
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
254
|
+
environment?: Record<string, string | {
|
|
255
|
+
paramResponse?: Record<string, string> | undefined;
|
|
256
|
+
default?: string | undefined;
|
|
257
|
+
log?: boolean | undefined;
|
|
258
|
+
}> | undefined;
|
|
259
|
+
evm?: Record<string, string | {
|
|
260
|
+
paramResponse?: Record<string, string> | undefined;
|
|
261
|
+
default?: string | undefined;
|
|
262
|
+
log?: boolean | undefined;
|
|
263
|
+
}> | undefined;
|
|
264
|
+
svm?: Record<string, string | {
|
|
265
|
+
paramResponse?: Record<string, string> | undefined;
|
|
266
|
+
default?: string | undefined;
|
|
267
|
+
log?: boolean | undefined;
|
|
268
|
+
}> | undefined;
|
|
269
|
+
inputs?: Record<string, string | number | {
|
|
270
|
+
address: string;
|
|
271
|
+
chainId: number;
|
|
272
|
+
} | {
|
|
273
|
+
token: {
|
|
274
|
+
address: string;
|
|
275
|
+
chainId: number;
|
|
276
|
+
};
|
|
277
|
+
amount: string;
|
|
278
|
+
}> | undefined;
|
|
74
279
|
}, {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
280
|
+
environment?: Record<string, string | {
|
|
281
|
+
paramResponse?: Record<string, string> | undefined;
|
|
282
|
+
default?: string | undefined;
|
|
283
|
+
log?: boolean | undefined;
|
|
284
|
+
}> | undefined;
|
|
285
|
+
evm?: Record<string, string | {
|
|
286
|
+
paramResponse?: Record<string, string> | undefined;
|
|
287
|
+
default?: string | undefined;
|
|
288
|
+
log?: boolean | undefined;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
svm?: Record<string, string | {
|
|
291
|
+
paramResponse?: Record<string, string> | undefined;
|
|
292
|
+
default?: string | undefined;
|
|
293
|
+
log?: boolean | undefined;
|
|
294
|
+
}> | undefined;
|
|
295
|
+
inputs?: Record<string, string | number | {
|
|
296
|
+
address: string;
|
|
297
|
+
chainId: number;
|
|
298
|
+
} | {
|
|
299
|
+
token: {
|
|
300
|
+
address: string;
|
|
301
|
+
chainId: number;
|
|
302
|
+
};
|
|
303
|
+
amount: string;
|
|
304
|
+
}> | undefined;
|
|
305
|
+
}>;
|
|
306
|
+
export declare const TokenPriceRequestValidator: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
307
|
+
timestamp: z.ZodEffects<z.ZodNumber, number, number>;
|
|
308
|
+
token: z.ZodObject<{
|
|
309
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
310
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
311
|
+
}, "strip", z.ZodTypeAny, {
|
|
312
|
+
address: string;
|
|
313
|
+
chainId: number;
|
|
314
|
+
}, {
|
|
315
|
+
address: string;
|
|
316
|
+
chainId: number;
|
|
317
|
+
}>;
|
|
318
|
+
}, "timestamp">, {
|
|
319
|
+
timestamp: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
320
|
+
}>, "strip", z.ZodTypeAny, {
|
|
321
|
+
token: {
|
|
322
|
+
address: string;
|
|
323
|
+
chainId: number;
|
|
324
|
+
};
|
|
325
|
+
timestamp?: number | undefined;
|
|
82
326
|
}, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
327
|
+
token: {
|
|
328
|
+
address: string;
|
|
329
|
+
chainId: number;
|
|
330
|
+
};
|
|
331
|
+
timestamp?: number | undefined;
|
|
332
|
+
}>;
|
|
333
|
+
export declare const TokenPriceResponseValidator: z.ZodArray<z.ZodString, "many">;
|
|
334
|
+
export declare const RelevantTokensRequestValidator: z.ZodObject<{
|
|
335
|
+
chainIds: z.ZodArray<z.ZodEffects<z.ZodNumber, number, number>, "many">;
|
|
336
|
+
owner: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
337
|
+
usdMinAmount: z.ZodEffects<z.ZodString, string, string>;
|
|
338
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
339
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
340
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
address: string;
|
|
343
|
+
chainId: number;
|
|
344
|
+
}, {
|
|
345
|
+
address: string;
|
|
346
|
+
chainId: number;
|
|
347
|
+
}>, "many">;
|
|
348
|
+
tokenFilter: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
349
|
+
}, "strip", z.ZodTypeAny, {
|
|
350
|
+
owner: string;
|
|
351
|
+
tokens: {
|
|
352
|
+
address: string;
|
|
353
|
+
chainId: number;
|
|
354
|
+
}[];
|
|
355
|
+
usdMinAmount: string;
|
|
356
|
+
chainIds: number[];
|
|
357
|
+
tokenFilter: 0 | 1;
|
|
358
|
+
}, {
|
|
359
|
+
owner: string;
|
|
360
|
+
tokens: {
|
|
361
|
+
address: string;
|
|
362
|
+
chainId: number;
|
|
363
|
+
}[];
|
|
364
|
+
usdMinAmount: string;
|
|
365
|
+
chainIds: number[];
|
|
366
|
+
tokenFilter: 0 | 1;
|
|
367
|
+
}>;
|
|
368
|
+
export declare const RelevantTokenBalanceValidator: z.ZodObject<{
|
|
369
|
+
token: z.ZodObject<{
|
|
370
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
371
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
address: string;
|
|
374
|
+
chainId: number;
|
|
375
|
+
}, {
|
|
376
|
+
address: string;
|
|
377
|
+
chainId: number;
|
|
378
|
+
}>;
|
|
379
|
+
balance: z.ZodEffects<z.ZodString, string, string>;
|
|
380
|
+
}, "strip", z.ZodTypeAny, {
|
|
381
|
+
token: {
|
|
382
|
+
address: string;
|
|
383
|
+
chainId: number;
|
|
384
|
+
};
|
|
385
|
+
balance: string;
|
|
386
|
+
}, {
|
|
387
|
+
token: {
|
|
388
|
+
address: string;
|
|
389
|
+
chainId: number;
|
|
390
|
+
};
|
|
391
|
+
balance: string;
|
|
392
|
+
}>;
|
|
393
|
+
export declare const RelevantTokensResponseValidator: z.ZodObject<{
|
|
394
|
+
timestamp: z.ZodEffects<z.ZodNumber, number, number>;
|
|
395
|
+
balances: z.ZodArray<z.ZodObject<{
|
|
396
|
+
token: z.ZodObject<{
|
|
397
|
+
address: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
398
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
399
|
+
}, "strip", z.ZodTypeAny, {
|
|
400
|
+
address: string;
|
|
401
|
+
chainId: number;
|
|
402
|
+
}, {
|
|
403
|
+
address: string;
|
|
404
|
+
chainId: number;
|
|
405
|
+
}>;
|
|
406
|
+
balance: z.ZodEffects<z.ZodString, string, string>;
|
|
407
|
+
}, "strip", z.ZodTypeAny, {
|
|
408
|
+
token: {
|
|
409
|
+
address: string;
|
|
410
|
+
chainId: number;
|
|
411
|
+
};
|
|
412
|
+
balance: string;
|
|
413
|
+
}, {
|
|
414
|
+
token: {
|
|
415
|
+
address: string;
|
|
416
|
+
chainId: number;
|
|
417
|
+
};
|
|
418
|
+
balance: string;
|
|
419
|
+
}>, "many">;
|
|
420
|
+
}, "strip", z.ZodTypeAny, {
|
|
421
|
+
timestamp: number;
|
|
422
|
+
balances: {
|
|
423
|
+
token: {
|
|
424
|
+
address: string;
|
|
425
|
+
chainId: number;
|
|
426
|
+
};
|
|
427
|
+
balance: string;
|
|
428
|
+
}[];
|
|
429
|
+
}, {
|
|
430
|
+
timestamp: number;
|
|
431
|
+
balances: {
|
|
432
|
+
token: {
|
|
433
|
+
address: string;
|
|
434
|
+
chainId: number;
|
|
435
|
+
};
|
|
436
|
+
balance: string;
|
|
437
|
+
}[];
|
|
438
|
+
}>;
|
|
439
|
+
export declare const EvmCallTypedValueValidator: z.ZodObject<{
|
|
440
|
+
abiType: z.ZodEffects<z.ZodString, string, string>;
|
|
441
|
+
value: z.ZodString;
|
|
442
|
+
}, "strip", z.ZodTypeAny, {
|
|
443
|
+
value: string;
|
|
444
|
+
abiType: string;
|
|
445
|
+
}, {
|
|
446
|
+
value: string;
|
|
447
|
+
abiType: string;
|
|
448
|
+
}>;
|
|
449
|
+
export declare const EvmCallRequestValidator: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
450
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
451
|
+
timestamp: z.ZodEffects<z.ZodNumber, number, number>;
|
|
452
|
+
to: z.ZodEffects<z.ZodString, string, string>;
|
|
453
|
+
data: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
454
|
+
}, "timestamp" | "data">, {
|
|
455
|
+
timestamp: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
456
|
+
fnSelector: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
457
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
458
|
+
abiType: z.ZodEffects<z.ZodString, string, string>;
|
|
459
|
+
value: z.ZodString;
|
|
460
|
+
}, "strip", z.ZodTypeAny, {
|
|
461
|
+
value: string;
|
|
462
|
+
abiType: string;
|
|
463
|
+
}, {
|
|
464
|
+
value: string;
|
|
465
|
+
abiType: string;
|
|
466
|
+
}>, "many">>;
|
|
467
|
+
}>, "strip", z.ZodTypeAny, {
|
|
468
|
+
chainId: number;
|
|
469
|
+
to: string;
|
|
470
|
+
fnSelector: string;
|
|
471
|
+
timestamp?: number | undefined;
|
|
472
|
+
params?: {
|
|
473
|
+
value: string;
|
|
474
|
+
abiType: string;
|
|
475
|
+
}[] | undefined;
|
|
476
|
+
}, {
|
|
477
|
+
chainId: number;
|
|
478
|
+
to: string;
|
|
479
|
+
fnSelector: string;
|
|
480
|
+
timestamp?: number | undefined;
|
|
481
|
+
params?: {
|
|
482
|
+
value: string;
|
|
483
|
+
abiType: string;
|
|
484
|
+
}[] | undefined;
|
|
485
|
+
}>;
|
|
486
|
+
export declare const SubgraphQueryRequestValidator: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
487
|
+
chainId: z.ZodEffects<z.ZodNumber, number, number>;
|
|
488
|
+
timestamp: z.ZodEffects<z.ZodNumber, number, number>;
|
|
489
|
+
subgraphId: z.ZodString;
|
|
490
|
+
query: z.ZodString;
|
|
491
|
+
}, "timestamp">, {
|
|
492
|
+
timestamp: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
493
|
+
}>, "strip", z.ZodTypeAny, {
|
|
494
|
+
chainId: number;
|
|
495
|
+
subgraphId: string;
|
|
496
|
+
query: string;
|
|
497
|
+
timestamp?: number | undefined;
|
|
498
|
+
}, {
|
|
499
|
+
chainId: number;
|
|
500
|
+
subgraphId: string;
|
|
501
|
+
query: string;
|
|
502
|
+
timestamp?: number | undefined;
|
|
503
|
+
}>;
|
|
504
|
+
export declare const SubgraphQueryResponseValidator: z.ZodObject<{
|
|
505
|
+
blockNumber: z.ZodNumber;
|
|
506
|
+
data: z.ZodString;
|
|
507
|
+
}, "strip", z.ZodTypeAny, {
|
|
508
|
+
data: string;
|
|
509
|
+
blockNumber: number;
|
|
510
|
+
}, {
|
|
511
|
+
data: string;
|
|
512
|
+
blockNumber: number;
|
|
513
|
+
}>;
|
package/dist/validators.js
CHANGED
|
@@ -1,18 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockConfigValidator = exports.MockSectionValidator = exports.MockFunctionResponseValidator = exports.InputsValidator = exports.ParameterizedResponseValidator = void 0;
|
|
4
|
-
const
|
|
5
|
-
exports.
|
|
3
|
+
exports.SubgraphQueryResponseValidator = exports.SubgraphQueryRequestValidator = exports.EvmCallRequestValidator = exports.EvmCallTypedValueValidator = exports.RelevantTokensResponseValidator = exports.RelevantTokenBalanceValidator = exports.RelevantTokensRequestValidator = exports.TokenPriceResponseValidator = exports.TokenPriceRequestValidator = exports.MockConfigValidator = exports.MockSectionValidator = exports.MockFunctionResponseValidator = exports.InputsValidator = exports.ParameterizedResponseValidator = exports.ContextValidator = void 0;
|
|
4
|
+
const sdk_1 = require("@mimicprotocol/sdk");
|
|
5
|
+
exports.ContextValidator = sdk_1.z
|
|
6
6
|
.object({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
timestamp: sdk_1.TimestampValidator,
|
|
8
|
+
consensusThreshold: sdk_1.PositiveNumberValidator,
|
|
9
|
+
user: sdk_1.AddressValidator,
|
|
10
|
+
settlers: sdk_1.z.array(sdk_1.z.object({
|
|
11
|
+
address: sdk_1.AddressValidator,
|
|
12
|
+
chainId: sdk_1.ChainIdValidator,
|
|
13
|
+
})),
|
|
14
|
+
triggerSig: sdk_1.HexValidator,
|
|
15
|
+
triggerPayload: sdk_1.z.object({
|
|
16
|
+
type: sdk_1.z.nativeEnum(sdk_1.TriggerType),
|
|
17
|
+
data: sdk_1.HexValidator,
|
|
18
|
+
}),
|
|
19
|
+
})
|
|
20
|
+
.partial();
|
|
21
|
+
exports.ParameterizedResponseValidator = sdk_1.z
|
|
22
|
+
.object({
|
|
23
|
+
paramResponse: sdk_1.z.record(sdk_1.z.string()).optional(),
|
|
24
|
+
default: sdk_1.z.string().optional(),
|
|
25
|
+
log: sdk_1.z.boolean().optional(),
|
|
10
26
|
})
|
|
11
27
|
.refine((data) => !!data.paramResponse || data.default !== undefined, {
|
|
12
28
|
message: "At least one of 'paramResponse' or 'default' must be defined",
|
|
13
29
|
});
|
|
14
|
-
exports.InputsValidator =
|
|
15
|
-
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
30
|
+
exports.InputsValidator = sdk_1.z.record(sdk_1.z.string(), sdk_1.z.union([sdk_1.z.number(), sdk_1.z.string(), sdk_1.TokenValidator, sdk_1.TokenAmountValidator]));
|
|
31
|
+
// ========= Mocks =========
|
|
32
|
+
exports.MockFunctionResponseValidator = sdk_1.z.union([sdk_1.z.string(), exports.ParameterizedResponseValidator, sdk_1.z.literal('log')]);
|
|
33
|
+
exports.MockSectionValidator = sdk_1.z.record(exports.MockFunctionResponseValidator);
|
|
34
|
+
exports.MockConfigValidator = sdk_1.z.object({
|
|
35
|
+
environment: exports.MockSectionValidator.optional(),
|
|
36
|
+
evm: exports.MockSectionValidator.optional(),
|
|
37
|
+
svm: exports.MockSectionValidator.optional(),
|
|
38
|
+
inputs: exports.InputsValidator.optional(),
|
|
39
|
+
});
|
|
40
|
+
// ========= Token Price =========
|
|
41
|
+
exports.TokenPriceRequestValidator = sdk_1.OracleTokenPriceRequestValidator.omit({ timestamp: true }).extend({
|
|
42
|
+
timestamp: sdk_1.PastTimestamp.optional(),
|
|
43
|
+
});
|
|
44
|
+
exports.TokenPriceResponseValidator = sdk_1.z
|
|
45
|
+
.array(sdk_1.OracleTokenPriceResultValidator.regex(/^\d+$/, 'Value must be a valid bigint in 18 decimal format'))
|
|
46
|
+
.min(1, 'Response must contain at least one element');
|
|
47
|
+
// ========= Relevant Tokens =========
|
|
48
|
+
exports.RelevantTokensRequestValidator = sdk_1.OracleRelevantTokensRequestValidator;
|
|
49
|
+
exports.RelevantTokenBalanceValidator = sdk_1.OracleRelevantTokenResultValidator;
|
|
50
|
+
exports.RelevantTokensResponseValidator = sdk_1.OracleRelevantTokensResultValidator;
|
|
51
|
+
// ========= Evm Call =========
|
|
52
|
+
exports.EvmCallTypedValueValidator = sdk_1.z.object({
|
|
53
|
+
abiType: sdk_1.SolidityTypeValidator,
|
|
54
|
+
value: sdk_1.StringValidator,
|
|
55
|
+
});
|
|
56
|
+
exports.EvmCallRequestValidator = sdk_1.OracleEvmCallRequestValidator.omit({ data: true, timestamp: true }).extend({
|
|
57
|
+
timestamp: sdk_1.PastTimestamp.optional(),
|
|
58
|
+
fnSelector: sdk_1.HexValidator,
|
|
59
|
+
params: sdk_1.z.array(exports.EvmCallTypedValueValidator).optional(),
|
|
60
|
+
});
|
|
61
|
+
// ========= Subgraph Query =========
|
|
62
|
+
exports.SubgraphQueryRequestValidator = sdk_1.OracleSubgraphQueryRequestValidator.omit({ timestamp: true }).extend({
|
|
63
|
+
timestamp: sdk_1.PastTimestamp.optional(),
|
|
64
|
+
});
|
|
65
|
+
exports.SubgraphQueryResponseValidator = sdk_1.OracleSubgraphQueryResultValidator;
|
|
18
66
|
//# sourceMappingURL=validators.js.map
|
package/dist/validators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mimicprotocol/test-ts",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,16 +14,22 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@mimicprotocol/runner-node": "^0.0.1",
|
|
18
|
+
"@mimicprotocol/sdk": "^0.0.1",
|
|
19
|
+
"ethers": "^6.15.0",
|
|
17
20
|
"zod": "^3.24.1"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
23
|
"@types/chai": "^4.3.5",
|
|
21
24
|
"@types/mocha": "^10.0.1",
|
|
22
25
|
"chai": "^4.3.7",
|
|
23
|
-
"eslint-config-mimic": "^0.0.
|
|
26
|
+
"eslint-config-mimic": "^0.0.4",
|
|
24
27
|
"mocha": "^10.2.0",
|
|
25
28
|
"nodemon": "^2.0.22",
|
|
26
29
|
"ts-mocha": "^10.0.0",
|
|
27
30
|
"typescript": "5.5.4"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
28
34
|
}
|
|
29
|
-
}
|
|
35
|
+
}
|
package/dist/run-task.d.ts
DELETED