@nucypher/taco 0.6.0-alpha.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/conditions/base/index.d.ts +1 -0
- package/dist/cjs/conditions/base/index.js +19 -8
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/jwt.d.ts +7 -0
- package/dist/cjs/conditions/base/jwt.js +19 -0
- package/dist/cjs/conditions/base/jwt.js.map +1 -0
- package/dist/cjs/conditions/condition-expr.js +5 -5
- package/dist/cjs/conditions/condition-expr.js.map +1 -1
- package/dist/cjs/conditions/condition-factory.js +3 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/condition.js +2 -1
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/const.js +0 -1
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +1 -1
- package/dist/cjs/conditions/context/context.js +11 -10
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/index.js +17 -7
- package/dist/cjs/conditions/index.js.map +1 -1
- package/dist/cjs/conditions/predefined/index.js +17 -7
- package/dist/cjs/conditions/predefined/index.js.map +1 -1
- package/dist/cjs/conditions/schemas/common.d.ts +1 -1
- package/dist/cjs/conditions/schemas/common.js +10 -7
- package/dist/cjs/conditions/schemas/common.js.map +1 -1
- package/dist/cjs/conditions/schemas/context.d.ts +1 -0
- package/dist/cjs/conditions/schemas/context.js +24 -3
- package/dist/cjs/conditions/schemas/context.js.map +1 -1
- package/dist/cjs/conditions/schemas/contract.d.ts +44 -25
- package/dist/cjs/conditions/schemas/contract.js +7 -7
- package/dist/cjs/conditions/schemas/contract.js.map +1 -1
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +18 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +37 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -0
- package/dist/cjs/conditions/schemas/json-api.d.ts +13 -10
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +14 -11
- package/dist/cjs/conditions/schemas/jwt.d.ts +22 -0
- package/dist/cjs/conditions/schemas/jwt.js +19 -0
- package/dist/cjs/conditions/schemas/jwt.js.map +1 -0
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +18 -2
- package/dist/cjs/conditions/schemas/return-value-test.js +7 -2
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/cjs/conditions/schemas/rpc.d.ts +16 -13
- package/dist/cjs/conditions/schemas/rpc.js +17 -11
- package/dist/cjs/conditions/schemas/rpc.js.map +1 -1
- package/dist/cjs/conditions/schemas/time.d.ts +9 -8
- package/dist/cjs/conditions/schemas/utils.js +2 -0
- package/dist/cjs/conditions/schemas/utils.js.map +1 -1
- package/dist/cjs/conditions/shared.d.ts +1 -1
- package/dist/cjs/conditions/shared.js +2 -1
- package/dist/cjs/conditions/shared.js.map +1 -1
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.d.ts +2 -0
- package/dist/cjs/utils.js +48 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/es/conditions/base/index.d.ts +1 -0
- package/dist/es/conditions/base/index.js +1 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/jwt.d.ts +7 -0
- package/dist/es/conditions/base/jwt.js +12 -0
- package/dist/es/conditions/base/jwt.js.map +1 -0
- package/dist/es/conditions/condition-expr.js +3 -3
- package/dist/es/conditions/condition-expr.js.map +1 -1
- package/dist/es/conditions/condition-factory.js +3 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/condition.js +2 -1
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/const.js +1 -2
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +1 -1
- package/dist/es/conditions/context/context.js +10 -9
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/schemas/common.d.ts +1 -1
- package/dist/es/conditions/schemas/common.js +11 -8
- package/dist/es/conditions/schemas/common.js.map +1 -1
- package/dist/es/conditions/schemas/context.d.ts +1 -0
- package/dist/es/conditions/schemas/context.js +23 -2
- package/dist/es/conditions/schemas/context.js.map +1 -1
- package/dist/es/conditions/schemas/contract.d.ts +44 -25
- package/dist/es/conditions/schemas/contract.js +4 -4
- package/dist/es/conditions/schemas/contract.js.map +1 -1
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +18 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +21 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -0
- package/dist/es/conditions/schemas/json-api.d.ts +13 -10
- package/dist/es/conditions/schemas/json-rpc.d.ts +14 -11
- package/dist/es/conditions/schemas/jwt.d.ts +22 -0
- package/dist/es/conditions/schemas/jwt.js +16 -0
- package/dist/es/conditions/schemas/jwt.js.map +1 -0
- package/dist/es/conditions/schemas/return-value-test.d.ts +18 -2
- package/dist/es/conditions/schemas/return-value-test.js +7 -2
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/es/conditions/schemas/rpc.d.ts +16 -13
- package/dist/es/conditions/schemas/rpc.js +18 -12
- package/dist/es/conditions/schemas/rpc.js.map +1 -1
- package/dist/es/conditions/schemas/time.d.ts +9 -8
- package/dist/es/conditions/schemas/utils.js +2 -0
- package/dist/es/conditions/schemas/utils.js.map +1 -1
- package/dist/es/conditions/shared.d.ts +1 -1
- package/dist/es/conditions/shared.js +1 -1
- package/dist/es/conditions/shared.js.map +1 -1
- package/dist/es/utils.d.ts +2 -0
- package/dist/es/utils.js +43 -0
- package/dist/es/utils.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +13 -8
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const
|
|
2
|
+
export declare const functionAbiVariableSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
5
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
type: string;
|
|
8
|
+
name: string;
|
|
9
|
+
internalType: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
internalType: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
3
16
|
name: z.ZodString;
|
|
4
17
|
type: z.ZodLiteral<"function">;
|
|
5
18
|
inputs: z.ZodArray<z.ZodObject<{
|
|
@@ -140,21 +153,28 @@ declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
140
153
|
}>;
|
|
141
154
|
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
142
155
|
export declare const ContractConditionType = "contract";
|
|
143
|
-
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
144
|
-
|
|
156
|
+
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
157
|
+
conditionType: z.ZodString;
|
|
158
|
+
}, {
|
|
159
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
160
|
+
chain: z.ZodNumber;
|
|
161
|
+
method: z.ZodEnum<["eth_getBalance"]>;
|
|
162
|
+
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
163
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
145
164
|
index: z.ZodOptional<z.ZodNumber>;
|
|
146
165
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
166
|
+
}, {
|
|
147
167
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
148
|
-
}
|
|
168
|
+
}>, "strip", z.ZodTypeAny, {
|
|
149
169
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
150
|
-
index?: number | undefined;
|
|
151
170
|
value?: any;
|
|
171
|
+
index?: number | undefined;
|
|
152
172
|
}, {
|
|
153
173
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
154
|
-
index?: number | undefined;
|
|
155
174
|
value?: any;
|
|
175
|
+
index?: number | undefined;
|
|
156
176
|
}>;
|
|
157
|
-
|
|
177
|
+
}>, {
|
|
158
178
|
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
159
179
|
contractAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
160
180
|
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
@@ -299,18 +319,17 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
299
319
|
stateMutability: "view" | "pure";
|
|
300
320
|
}>>;
|
|
301
321
|
parameters: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
302
|
-
}
|
|
322
|
+
}>, "strip", z.ZodTypeAny, {
|
|
303
323
|
conditionType: "contract";
|
|
324
|
+
chain: number;
|
|
304
325
|
method: string;
|
|
326
|
+
parameters: any[];
|
|
305
327
|
returnValueTest: {
|
|
306
328
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
307
|
-
index?: number | undefined;
|
|
308
329
|
value?: any;
|
|
330
|
+
index?: number | undefined;
|
|
309
331
|
};
|
|
310
|
-
parameters: any[];
|
|
311
|
-
chain: number;
|
|
312
332
|
contractAddress: string;
|
|
313
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
314
333
|
functionAbi?: {
|
|
315
334
|
type: "function";
|
|
316
335
|
name: string;
|
|
@@ -330,18 +349,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
330
349
|
}[]];
|
|
331
350
|
stateMutability: "view" | "pure";
|
|
332
351
|
} | undefined;
|
|
352
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
333
353
|
}, {
|
|
354
|
+
chain: number;
|
|
334
355
|
method: string;
|
|
356
|
+
parameters: any[];
|
|
335
357
|
returnValueTest: {
|
|
336
358
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
337
|
-
index?: number | undefined;
|
|
338
359
|
value?: any;
|
|
360
|
+
index?: number | undefined;
|
|
339
361
|
};
|
|
340
|
-
parameters: any[];
|
|
341
|
-
chain: number;
|
|
342
362
|
contractAddress: string;
|
|
343
363
|
conditionType?: "contract" | undefined;
|
|
344
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
345
364
|
functionAbi?: {
|
|
346
365
|
type: "function";
|
|
347
366
|
name: string;
|
|
@@ -361,18 +380,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
361
380
|
}[]];
|
|
362
381
|
stateMutability: "view" | "pure";
|
|
363
382
|
} | undefined;
|
|
383
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
364
384
|
}>, {
|
|
365
385
|
conditionType: "contract";
|
|
386
|
+
chain: number;
|
|
366
387
|
method: string;
|
|
388
|
+
parameters: any[];
|
|
367
389
|
returnValueTest: {
|
|
368
390
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
369
|
-
index?: number | undefined;
|
|
370
391
|
value?: any;
|
|
392
|
+
index?: number | undefined;
|
|
371
393
|
};
|
|
372
|
-
parameters: any[];
|
|
373
|
-
chain: number;
|
|
374
394
|
contractAddress: string;
|
|
375
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
376
395
|
functionAbi?: {
|
|
377
396
|
type: "function";
|
|
378
397
|
name: string;
|
|
@@ -392,18 +411,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
392
411
|
}[]];
|
|
393
412
|
stateMutability: "view" | "pure";
|
|
394
413
|
} | undefined;
|
|
414
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
395
415
|
}, {
|
|
416
|
+
chain: number;
|
|
396
417
|
method: string;
|
|
418
|
+
parameters: any[];
|
|
397
419
|
returnValueTest: {
|
|
398
420
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
399
|
-
index?: number | undefined;
|
|
400
421
|
value?: any;
|
|
422
|
+
index?: number | undefined;
|
|
401
423
|
};
|
|
402
|
-
parameters: any[];
|
|
403
|
-
chain: number;
|
|
404
424
|
contractAddress: string;
|
|
405
425
|
conditionType?: "contract" | undefined;
|
|
406
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
407
426
|
functionAbi?: {
|
|
408
427
|
type: "function";
|
|
409
428
|
name: string;
|
|
@@ -423,6 +442,6 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
423
442
|
}[]];
|
|
424
443
|
stateMutability: "view" | "pure";
|
|
425
444
|
} | undefined;
|
|
445
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
426
446
|
}>;
|
|
427
447
|
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
428
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddressSchema } from '@nucypher/shared';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
4
|
+
import { blockchainParamOrContextParamSchema } from './context';
|
|
5
5
|
import { rpcConditionSchema } from './rpc';
|
|
6
6
|
// TODO: Consider replacing with `z.unknown`:
|
|
7
7
|
// Since Solidity types are tied to Solidity version, we may not be able to accurately represent them in Zod.
|
|
@@ -16,14 +16,14 @@ const EthBaseTypes = [
|
|
|
16
16
|
...Array.from({ length: 32 }, (_v, i) => `uint${8 * (i + 1)}`), // uint8 through uint256
|
|
17
17
|
...Array.from({ length: 32 }, (_v, i) => `int${8 * (i + 1)}`), // int8 through int256
|
|
18
18
|
];
|
|
19
|
-
const functionAbiVariableSchema = z
|
|
19
|
+
export const functionAbiVariableSchema = z
|
|
20
20
|
.object({
|
|
21
21
|
name: z.string(),
|
|
22
22
|
type: z.enum(EthBaseTypes),
|
|
23
23
|
internalType: z.enum(EthBaseTypes), // TODO: Do we need to validate this?
|
|
24
24
|
})
|
|
25
25
|
.strict();
|
|
26
|
-
const functionAbiSchema = z
|
|
26
|
+
export const functionAbiSchema = z
|
|
27
27
|
.object({
|
|
28
28
|
name: z.string(),
|
|
29
29
|
type: z.literal('function'),
|
|
@@ -65,7 +65,7 @@ export const contractConditionSchema = rpcConditionSchema
|
|
|
65
65
|
standardContractType: z.enum(['ERC20', 'ERC721']).optional(),
|
|
66
66
|
method: z.string(),
|
|
67
67
|
functionAbi: functionAbiSchema.optional(),
|
|
68
|
-
parameters: z.array(
|
|
68
|
+
parameters: z.array(blockchainParamOrContextParamSchema),
|
|
69
69
|
})
|
|
70
70
|
// Adding this custom logic causes the return type to be ZodEffects instead of ZodObject
|
|
71
71
|
// https://github.com/colinhacks/zod/issues/2474
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"contract.js","sour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,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAC1D,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;AAClD,CAAC,EACD;IACE,OAAO,EAAE,gEAAgE;IACzE,IAAI,EAAE,CAAC,YAAY,CAAC;CACrB,CACF,CAAC;AAIJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB;KACtD,MAAM,CAAC;IACN,aAAa,EAAE,CAAC;SACb,OAAO,CAAC,qBAAqB,CAAC;SAC9B,OAAO,CAAC,qBAAqB,CAAC;IACjC,eAAe,EAAE,gBAAgB;IACjC,oBAAoB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACzC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC;CACzD,CAAC;IACF,wFAAwF;IACxF,gDAAgD;KAC/C,MAAM;AACL,0EAA0E;AAC1E,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,EAC1E;IACE,OAAO,EACL,oFAAoF;IACtF,IAAI,EAAE,CAAC,sBAAsB,CAAC;CAC/B,CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is used by zod2md to generate markdown documentation for the Zod schemas.
|
|
3
|
+
*
|
|
4
|
+
* NOTE: The order of the exported Zod objects in this file dictates the order of the generated markdown.
|
|
5
|
+
*/
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './common';
|
|
8
|
+
export * from './context';
|
|
9
|
+
export * from './compound';
|
|
10
|
+
export * from './contract';
|
|
11
|
+
export * from './if-then-else';
|
|
12
|
+
export * from './json-api';
|
|
13
|
+
export * from './json-rpc';
|
|
14
|
+
export * from './jwt';
|
|
15
|
+
export * from './return-value-test';
|
|
16
|
+
export * from './rpc';
|
|
17
|
+
export * from './sequential';
|
|
18
|
+
export * from './time';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is used by zod2md to generate markdown documentation for the Zod schemas.
|
|
3
|
+
*
|
|
4
|
+
* NOTE: The order of the exported Zod objects in this file dictates the order of the generated markdown.
|
|
5
|
+
*/
|
|
6
|
+
export * from './utils';
|
|
7
|
+
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
8
|
+
export * from './common';
|
|
9
|
+
export * from './context';
|
|
10
|
+
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
11
|
+
export * from './compound';
|
|
12
|
+
export * from './contract';
|
|
13
|
+
export * from './if-then-else';
|
|
14
|
+
export * from './json-api';
|
|
15
|
+
export * from './json-rpc';
|
|
16
|
+
export * from './jwt';
|
|
17
|
+
export * from './return-value-test';
|
|
18
|
+
export * from './rpc';
|
|
19
|
+
export * from './sequential';
|
|
20
|
+
export * from './time';
|
|
21
|
+
//# sourceMappingURL=export-for-zod-doc-gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,gIAAgI;AAChI,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,gIAAgI;AAChI,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const JsonApiConditionType = "json-api";
|
|
3
|
-
export declare const jsonApiConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const jsonApiConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"json-api">>;
|
|
5
7
|
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
6
8
|
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
9
|
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
8
10
|
authorizationToken: z.ZodOptional<z.ZodString>;
|
|
9
|
-
returnValueTest: z.ZodObject<{
|
|
11
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
10
12
|
index: z.ZodOptional<z.ZodNumber>;
|
|
11
13
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
14
|
+
}, {
|
|
12
15
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
13
|
-
}
|
|
16
|
+
}>, "strip", z.ZodTypeAny, {
|
|
14
17
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
15
|
-
index?: number | undefined;
|
|
16
18
|
value?: any;
|
|
19
|
+
index?: number | undefined;
|
|
17
20
|
}, {
|
|
18
21
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
19
|
-
index?: number | undefined;
|
|
20
22
|
value?: any;
|
|
23
|
+
index?: number | undefined;
|
|
21
24
|
}>;
|
|
22
|
-
}
|
|
25
|
+
}>, "strip", z.ZodTypeAny, {
|
|
23
26
|
conditionType: "json-api";
|
|
24
|
-
endpoint: string;
|
|
25
27
|
returnValueTest: {
|
|
26
28
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
27
|
-
index?: number | undefined;
|
|
28
29
|
value?: any;
|
|
30
|
+
index?: number | undefined;
|
|
29
31
|
};
|
|
32
|
+
endpoint: string;
|
|
30
33
|
parameters?: Record<string, unknown> | undefined;
|
|
31
34
|
query?: string | undefined;
|
|
32
35
|
authorizationToken?: string | undefined;
|
|
33
36
|
}, {
|
|
34
|
-
endpoint: string;
|
|
35
37
|
returnValueTest: {
|
|
36
38
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
37
|
-
index?: number | undefined;
|
|
38
39
|
value?: any;
|
|
40
|
+
index?: number | undefined;
|
|
39
41
|
};
|
|
42
|
+
endpoint: string;
|
|
40
43
|
conditionType?: "json-api" | undefined;
|
|
41
44
|
parameters?: Record<string, unknown> | undefined;
|
|
42
45
|
query?: string | undefined;
|
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const JsonRpcConditionType = "json-rpc";
|
|
3
|
-
export declare const jsonRpcConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const jsonRpcConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"json-rpc">>;
|
|
5
7
|
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
6
8
|
method: z.ZodString;
|
|
7
9
|
params: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
8
10
|
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
9
11
|
authorizationToken: z.ZodOptional<z.ZodString>;
|
|
10
|
-
returnValueTest: z.ZodObject<{
|
|
12
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
11
13
|
index: z.ZodOptional<z.ZodNumber>;
|
|
12
14
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
15
|
+
}, {
|
|
13
16
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
14
|
-
}
|
|
17
|
+
}>, "strip", z.ZodTypeAny, {
|
|
15
18
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
16
|
-
index?: number | undefined;
|
|
17
19
|
value?: any;
|
|
20
|
+
index?: number | undefined;
|
|
18
21
|
}, {
|
|
19
22
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
20
|
-
index?: number | undefined;
|
|
21
23
|
value?: any;
|
|
24
|
+
index?: number | undefined;
|
|
22
25
|
}>;
|
|
23
|
-
}
|
|
26
|
+
}>, "strip", z.ZodTypeAny, {
|
|
24
27
|
conditionType: "json-rpc";
|
|
25
|
-
endpoint: string;
|
|
26
28
|
method: string;
|
|
27
29
|
returnValueTest: {
|
|
28
30
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
29
|
-
index?: number | undefined;
|
|
30
31
|
value?: any;
|
|
32
|
+
index?: number | undefined;
|
|
31
33
|
};
|
|
34
|
+
endpoint: string;
|
|
32
35
|
params?: unknown[] | Record<string, unknown> | undefined;
|
|
33
36
|
query?: string | undefined;
|
|
34
37
|
authorizationToken?: string | undefined;
|
|
35
38
|
}, {
|
|
36
|
-
endpoint: string;
|
|
37
39
|
method: string;
|
|
38
40
|
returnValueTest: {
|
|
39
41
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
40
|
-
index?: number | undefined;
|
|
41
42
|
value?: any;
|
|
43
|
+
index?: number | undefined;
|
|
42
44
|
};
|
|
43
|
-
|
|
45
|
+
endpoint: string;
|
|
44
46
|
params?: unknown[] | Record<string, unknown> | undefined;
|
|
47
|
+
conditionType?: "json-rpc" | undefined;
|
|
45
48
|
query?: string | undefined;
|
|
46
49
|
authorizationToken?: string | undefined;
|
|
47
50
|
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const JWT_PARAM_DEFAULT = ":jwtToken";
|
|
3
|
+
export declare const JWTConditionType = "jwt";
|
|
4
|
+
export declare const jwtConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
5
|
+
conditionType: z.ZodString;
|
|
6
|
+
}, {
|
|
7
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"jwt">>;
|
|
8
|
+
publicKey: z.ZodString;
|
|
9
|
+
expectedIssuer: z.ZodOptional<z.ZodString>;
|
|
10
|
+
jwtToken: z.ZodDefault<z.ZodString>;
|
|
11
|
+
}>, "strip", z.ZodTypeAny, {
|
|
12
|
+
conditionType: "jwt";
|
|
13
|
+
publicKey: string;
|
|
14
|
+
jwtToken: string;
|
|
15
|
+
expectedIssuer?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
publicKey: string;
|
|
18
|
+
conditionType?: "jwt" | undefined;
|
|
19
|
+
expectedIssuer?: string | undefined;
|
|
20
|
+
jwtToken?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type JWTConditionProps = z.infer<typeof jwtConditionSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseConditionSchema } from './common';
|
|
3
|
+
import { contextParamSchema } from './context';
|
|
4
|
+
export const JWT_PARAM_DEFAULT = ':jwtToken';
|
|
5
|
+
export const JWTConditionType = 'jwt';
|
|
6
|
+
export const jwtConditionSchema = baseConditionSchema.extend({
|
|
7
|
+
conditionType: z.literal(JWTConditionType).default(JWTConditionType),
|
|
8
|
+
publicKey: z.string(),
|
|
9
|
+
expectedIssuer: z.string().optional(),
|
|
10
|
+
// TODO see https://github.com/nucypher/taco-web/pull/604#discussion_r1901746814
|
|
11
|
+
// subject: contextParamSchema.optional(),
|
|
12
|
+
// expirationWindow: z.number().int().nonnegative().optional(),
|
|
13
|
+
// issuedWindow: z.number().int().nonnegative().optional(),
|
|
14
|
+
jwtToken: contextParamSchema.default(JWT_PARAM_DEFAULT),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=jwt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,gFAAgF;IAChF,0CAA0C;IAC1C,+DAA+D;IAC/D,2DAA2D;IAC3D,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const returnValueTestSchema: z.ZodObject<{
|
|
2
|
+
export declare const returnValueTestSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
index: z.ZodOptional<z.ZodNumber>;
|
|
4
4
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
5
|
+
}, {
|
|
5
6
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
6
|
-
}
|
|
7
|
+
}>, "strip", z.ZodTypeAny, {
|
|
7
8
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
9
|
+
value?: any;
|
|
8
10
|
index?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
9
13
|
value?: any;
|
|
14
|
+
index?: number | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const blockchainReturnValueTestSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
17
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
10
19
|
}, {
|
|
20
|
+
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
21
|
+
}>, "strip", z.ZodTypeAny, {
|
|
11
22
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
23
|
+
value?: any;
|
|
12
24
|
index?: number | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
13
27
|
value?: any;
|
|
28
|
+
index?: number | undefined;
|
|
14
29
|
}>;
|
|
15
30
|
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
31
|
+
export type BlockchainReturnValueTestProps = z.infer<typeof blockchainReturnValueTestSchema>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { paramOrContextParamSchema } from './context';
|
|
3
|
-
|
|
2
|
+
import { blockchainParamOrContextParamSchema, paramOrContextParamSchema, } from './context';
|
|
3
|
+
const returnValueTestBaseSchema = z.object({
|
|
4
4
|
index: z.number().int().nonnegative().optional(),
|
|
5
5
|
comparator: z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
6
|
+
});
|
|
7
|
+
export const returnValueTestSchema = returnValueTestBaseSchema.extend({
|
|
6
8
|
value: paramOrContextParamSchema,
|
|
7
9
|
});
|
|
10
|
+
export const blockchainReturnValueTestSchema = returnValueTestBaseSchema.extend({
|
|
11
|
+
value: blockchainParamOrContextParamSchema,
|
|
12
|
+
});
|
|
8
13
|
//# sourceMappingURL=return-value-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"return-value-test.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/return-value-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"return-value-test.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/return-value-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,mCAAmC,EACnC,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAChD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;CACvD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC,MAAM,CAAC;IACpE,KAAK,EAAE,yBAAyB;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,CAC7E;IACE,KAAK,EAAE,mCAAmC;CAC3C,CACF,CAAC"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const RpcConditionType = "rpc";
|
|
3
|
-
export declare const rpcConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const rpcConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
5
7
|
chain: z.ZodNumber;
|
|
6
8
|
method: z.ZodEnum<["eth_getBalance"]>;
|
|
7
|
-
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.
|
|
8
|
-
returnValueTest: z.ZodObject<{
|
|
9
|
+
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
10
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
9
11
|
index: z.ZodOptional<z.ZodNumber>;
|
|
10
12
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
13
|
+
}, {
|
|
11
14
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
12
|
-
}
|
|
15
|
+
}>, "strip", z.ZodTypeAny, {
|
|
13
16
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
-
index?: number | undefined;
|
|
15
17
|
value?: any;
|
|
18
|
+
index?: number | undefined;
|
|
16
19
|
}, {
|
|
17
20
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
-
index?: number | undefined;
|
|
19
21
|
value?: any;
|
|
22
|
+
index?: number | undefined;
|
|
20
23
|
}>;
|
|
21
|
-
}
|
|
24
|
+
}>, "strip", z.ZodTypeAny, {
|
|
22
25
|
conditionType: "rpc";
|
|
26
|
+
chain: number;
|
|
23
27
|
method: "eth_getBalance";
|
|
28
|
+
parameters: [string, string | number] | [string];
|
|
24
29
|
returnValueTest: {
|
|
25
30
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
26
|
-
index?: number | undefined;
|
|
27
31
|
value?: any;
|
|
32
|
+
index?: number | undefined;
|
|
28
33
|
};
|
|
29
|
-
parameters: [string] | [string, string | number];
|
|
30
|
-
chain: number;
|
|
31
34
|
}, {
|
|
35
|
+
chain: number;
|
|
32
36
|
method: "eth_getBalance";
|
|
37
|
+
parameters: [string, string | number] | [string];
|
|
33
38
|
returnValueTest: {
|
|
34
39
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
35
|
-
index?: number | undefined;
|
|
36
40
|
value?: any;
|
|
41
|
+
index?: number | undefined;
|
|
37
42
|
};
|
|
38
|
-
parameters: [string] | [string, string | number];
|
|
39
|
-
chain: number;
|
|
40
43
|
conditionType?: "rpc" | undefined;
|
|
41
44
|
}>;
|
|
42
45
|
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
@@ -2,30 +2,36 @@ import { BlockIdentifierSchema, EthAddressSchema } from '@nucypher/shared';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { baseConditionSchema, UserAddressSchema } from './common';
|
|
4
4
|
import { contextParamSchema } from './context';
|
|
5
|
-
import {
|
|
5
|
+
import { blockchainReturnValueTestSchema } from './return-value-test';
|
|
6
6
|
export const RpcConditionType = 'rpc';
|
|
7
7
|
const EthAddressOrContextVariableSchema = z.union([
|
|
8
8
|
EthAddressSchema,
|
|
9
9
|
UserAddressSchema,
|
|
10
10
|
contextParamSchema,
|
|
11
11
|
]);
|
|
12
|
-
const BlockOrContextParamSchema = z
|
|
13
|
-
BlockIdentifierSchema,
|
|
14
|
-
|
|
15
|
-
]);
|
|
12
|
+
const BlockOrContextParamSchema = z
|
|
13
|
+
.union([BlockIdentifierSchema, contextParamSchema])
|
|
14
|
+
.describe('A block identifier or a context variable that will be replaced with a block identifier at execution time.');
|
|
16
15
|
// eth_getBalance schema specification
|
|
17
16
|
// - Ethereum spec: https://ethereum.github.io/execution-apis/api-documentation/
|
|
18
17
|
// - web3py: https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.get_balance
|
|
19
|
-
export const rpcConditionSchema = baseConditionSchema
|
|
18
|
+
export const rpcConditionSchema = baseConditionSchema
|
|
19
|
+
.extend({
|
|
20
20
|
conditionType: z.literal(RpcConditionType).default(RpcConditionType),
|
|
21
21
|
chain: z.number().int().nonnegative(),
|
|
22
|
-
method: z
|
|
22
|
+
method: z
|
|
23
|
+
.enum(['eth_getBalance'])
|
|
24
|
+
.describe("Only 'eth_getBalance' method is supported"),
|
|
23
25
|
parameters: z.union([
|
|
24
26
|
// Spec requires 2 parameters: an address and a block identifier
|
|
25
|
-
z
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
z
|
|
28
|
+
.tuple([EthAddressOrContextVariableSchema, BlockOrContextParamSchema])
|
|
29
|
+
.describe('Spec requires 2 parameters - an address and a block identifier'),
|
|
30
|
+
z
|
|
31
|
+
.tuple([EthAddressOrContextVariableSchema])
|
|
32
|
+
.describe("Block identifier, which defaults to 'latest' if not specified"),
|
|
28
33
|
]),
|
|
29
|
-
returnValueTest:
|
|
30
|
-
})
|
|
34
|
+
returnValueTest: blockchainReturnValueTestSchema, // Update to allow multiple return values after expanding supported methods
|
|
35
|
+
})
|
|
36
|
+
.describe('RPC Condition for calling [Ethereum JSON RPC APIs](https://ethereum.github.io/execution-apis/api-documentation/)');
|
|
31
37
|
//# sourceMappingURL=rpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MA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E,CACjE;QACH,CAAC;aACE,KAAK,CAAC,CAAC,iCAAiC,CAAC,CAAC;aAC1C,QAAQ,CACP,+DAA+D,CAChE;KACJ,CAAC;IACF,eAAe,EAAE,+BAA+B,EAAE,2EAA2E;CAC9H,CAAC;KACD,QAAQ,CACP,kHAAkH,CACnH,CAAC"}
|
|
@@ -5,35 +5,36 @@ export declare const timeConditionSchema: z.ZodObject<{
|
|
|
5
5
|
conditionType: z.ZodDefault<z.ZodLiteral<"time">>;
|
|
6
6
|
method: z.ZodDefault<z.ZodLiteral<"blocktime">>;
|
|
7
7
|
chain: z.ZodNumber;
|
|
8
|
-
returnValueTest: z.ZodObject<{
|
|
8
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
9
9
|
index: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
11
|
+
}, {
|
|
11
12
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
12
|
-
}
|
|
13
|
+
}>, "strip", z.ZodTypeAny, {
|
|
13
14
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
-
index?: number | undefined;
|
|
15
15
|
value?: any;
|
|
16
|
+
index?: number | undefined;
|
|
16
17
|
}, {
|
|
17
18
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
-
index?: number | undefined;
|
|
19
19
|
value?: any;
|
|
20
|
+
index?: number | undefined;
|
|
20
21
|
}>;
|
|
21
22
|
}, "strip", z.ZodTypeAny, {
|
|
22
23
|
conditionType: "time";
|
|
24
|
+
chain: number;
|
|
23
25
|
method: "blocktime";
|
|
24
26
|
returnValueTest: {
|
|
25
27
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
26
|
-
index?: number | undefined;
|
|
27
28
|
value?: any;
|
|
29
|
+
index?: number | undefined;
|
|
28
30
|
};
|
|
29
|
-
chain: number;
|
|
30
31
|
}, {
|
|
32
|
+
chain: number;
|
|
31
33
|
returnValueTest: {
|
|
32
34
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
33
|
-
index?: number | undefined;
|
|
34
35
|
value?: any;
|
|
36
|
+
index?: number | undefined;
|
|
35
37
|
};
|
|
36
|
-
chain: number;
|
|
37
38
|
conditionType?: "time" | undefined;
|
|
38
39
|
method?: "blocktime" | undefined;
|
|
39
40
|
}>;
|