-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathevmSchema.ts
More file actions
875 lines (826 loc) · 28.8 KB
/
evmSchema.ts
File metadata and controls
875 lines (826 loc) · 28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
import { Abi, Address } from "abitype/zod";
import { z } from "zod";
/**
* Enum for EthValueOperator values
*/
export const EthValueOperatorEnum = z.enum([">", ">=", "<", "<=", "=="]);
/**
* Type representing the operators that can be used for ETH value comparisons.
* These operators determine how transaction values are compared against thresholds.
*/
export type EthValueOperator = z.infer<typeof EthValueOperatorEnum>;
/**
* Enum for EvmAddressOperator values
*/
export const EvmAddressOperatorEnum = z.enum(["in", "not in"]);
/**
* Type representing the operators that can be used for EVM address comparisons.
* These operators determine how transaction recipient addresses are evaluated against a list.
*/
export type EvmAddressOperator = z.infer<typeof EvmAddressOperatorEnum>;
/**
* Enum for EvmNetworkOperator values
*/
export const EvmNetworkOperatorEnum = z.enum(["in", "not in"]);
/**
* Type representing the operators that can be used for EVM network comparisons.
* These operators determine how the transaction's network is evaluated against a list.
*/
export type EvmNetworkOperator = z.infer<typeof EvmNetworkOperatorEnum>;
/**
* Schema for ETH value criterions
*/
export const EthValueCriterionSchema = z.object({
/** The type of criterion, must be "ethValue" for Ethereum value-based rules. */
type: z.literal("ethValue"),
/**
* The ETH value amount in wei to compare against, as a string.
* Must contain only digits.
*/
ethValue: z.string().regex(/^[0-9]+$/),
/** The comparison operator to use for evaluating transaction values against the threshold. */
operator: EthValueOperatorEnum,
});
export type EthValueCriterion = z.infer<typeof EthValueCriterionSchema>;
/**
* Schema for EVM address criterions
*/
export const EvmAddressCriterionSchema = z.object({
/** The type of criterion, must be "evmAddress" for EVM address-based rules. */
type: z.literal("evmAddress"),
/**
* Array of EVM addresses to compare against.
* Each address must be a 0x-prefixed 40-character hexadecimal string.
* Limited to a maximum of 300 addresses per criterion.
*/
addresses: z.array(Address).max(300),
/**
* The operator to use for evaluating transaction addresses.
* "in" checks if an address is in the provided list.
* "not in" checks if an address is not in the provided list.
*/
operator: EvmAddressOperatorEnum,
});
export type EvmAddressCriterion = z.infer<typeof EvmAddressCriterionSchema>;
/**
* Enum for PrepareUserOperation EVM Network values
*/
export const PrepareUserOperationEvmNetworkEnum = z.enum([
"base-sepolia",
"base",
"arbitrum",
"optimism",
"zora",
"polygon",
"bnb",
"avalanche",
"ethereum",
"ethereum-sepolia",
]);
export type PrepareUserOperationEvmNetwork = z.infer<typeof PrepareUserOperationEvmNetworkEnum>;
/**
* Enum for SendEvmTransaction EVM Network values
*/
export const SendEvmTransactionEvmNetworkEnum = z.enum([
"base",
"base-sepolia",
"ethereum",
"ethereum-sepolia",
"avalanche",
"polygon",
"optimism",
"arbitrum",
]);
/**
* Type representing the valid networks used with CDP transaction API's.
*/
export type EvmNetwork = z.ZodUnion<
[typeof SendEvmTransactionEvmNetworkEnum, typeof PrepareUserOperationEvmNetworkEnum]
>;
/**
* Schema for EVM network criterions
*/
export const SendEvmTransactionEvmNetworkCriterionSchema = z.object({
/** The type of criterion, must be "evmAddress" for EVM address-based rules. */
type: z.literal("evmNetwork"),
/**
* Array of EVM network identifiers to compare against.
* Either "base", "base-sepolia", "ethereum", "ethereum-sepolia", "avalanche", "polygon", "optimism", "arbitrum"
*/
networks: z.array(SendEvmTransactionEvmNetworkEnum),
/**
* The operator to use for evaluating transaction network.
* "in" checks if a network is in the provided list.
* "not in" checks if a network is not in the provided list.
*/
operator: EvmNetworkOperatorEnum,
});
export const PrepareUserOperationEvmNetworkCriterionSchema = z.object({
/** The type of criterion, must be "evmAddress" for EVM address-based rules. */
type: z.literal("evmNetwork"),
/**
* Array of EVM network identifiers to compare against.
* Either "base-sepolia", "base", "arbitrum", "optimism", "zora", "polygon", "bnb", "avalanche", "ethereum", "ethereum-sepolia"
*/
networks: z.array(PrepareUserOperationEvmNetworkEnum),
/**
* The operator to use for evaluating transaction network.
* "in" checks if a network is in the provided list.
* "not in" checks if a network is not in the provided list.
*/
operator: EvmNetworkOperatorEnum,
});
export const EvmNetworkCriterionSchema = z.union([
SendEvmTransactionEvmNetworkCriterionSchema,
PrepareUserOperationEvmNetworkCriterionSchema,
]);
export type EvmNetworkCriterion = z.ZodUnion<
[
typeof SendEvmTransactionEvmNetworkCriterionSchema,
typeof PrepareUserOperationEvmNetworkCriterionSchema,
]
>;
/**
* Schema for EVM message criterions
*/
export const EvmMessageCriterionSchema = z.object({
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
type: z.literal("evmMessage"),
/**
* A regular expression the message is matched against.
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
*/
match: z.string().min(1),
});
export type EvmMessageCriterion = z.infer<typeof EvmMessageCriterionSchema>;
/**
* Schema for Net USD change criterion
*/
export const NetUSDChangeCriterionSchema = z.object({
/** The type of criterion, must be "netUSDChange" for USD denominated asset transfer rules. */
type: z.literal("netUSDChange"),
/**
* The amount of USD, in cents, that the total USD value of a transaction's asset transfer and exposure should be compared to.
*/
changeCents: z.number().int().nonnegative(),
/**
* The operator to use for the comparison. The total value of a transaction's asset transfer and exposure in USD will be on the left-hand side of the operator, and the `changeCents` field will be on the right-hand side.
*/
operator: EthValueOperatorEnum,
});
export type NetUSDChangeCriterion = z.infer<typeof NetUSDChangeCriterionSchema>;
/**
* Schema for EVM typed address conditions
*/
export const EvmTypedAddressConditionSchema = z.object({
/**
* Array of EVM addresses to compare against.
* Each address must be a 0x-prefixed 40-character hexadecimal string.
* Limited to a maximum of 300 addresses per condition.
*/
addresses: z.array(Address).max(300),
/**
* The operator to use for evaluating addresses.
* "in" checks if an address is in the provided list.
* "not in" checks if an address is not in the provided list.
*/
operator: EvmAddressOperatorEnum,
/**
* The path to the field to compare against this criterion.
* To reference deeply nested fields, use dot notation (e.g., "order.buyer").
*/
path: z.string().min(1),
});
export type EvmTypedAddressCondition = z.infer<typeof EvmTypedAddressConditionSchema>;
/**
* Schema for EVM typed numerical conditions
*/
export const EvmTypedNumericalConditionSchema = z.object({
/**
* The numerical value to compare against, as a string.
* Must contain only digits.
*/
value: z.string().regex(/^[0-9]+$/),
/**
* The comparison operator to use.
*/
operator: EthValueOperatorEnum,
/**
* The path to the field to compare against this criterion.
* To reference deeply nested fields, use dot notation (e.g., "order.price").
*/
path: z.string().min(1),
});
export type EvmTypedNumericalCondition = z.infer<typeof EvmTypedNumericalConditionSchema>;
/**
* Schema for EVM typed string conditions
*/
export const EvmTypedStringConditionSchema = z.object({
/**
* A regular expression the string field is matched against.
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
*/
match: z.string().min(1),
/**
* The path to the field to compare against this criterion.
* To reference deeply nested fields, use dot notation (e.g., "metadata.description").
*/
path: z.string().min(1),
});
export type EvmTypedStringCondition = z.infer<typeof EvmTypedStringConditionSchema>;
/**
* Schema for SignEvmTypedData field criterion
*/
export const SignEvmTypedDataFieldCriterionSchema = z.object({
/** The type of criterion, must be "evmTypedDataField" for typed data field-based rules. */
type: z.literal("evmTypedDataField"),
/**
* The EIP-712 type definitions for the typed data.
* Must include at minimum the primary type being signed.
*/
types: z.object({
/**
* EIP-712 compliant map of model names to model definitions.
*/
types: z.record(
z.array(
z.object({
name: z.string(),
type: z.string(),
}),
),
),
/**
* The name of the root EIP-712 type. This value must be included in the `types` object.
*/
primaryType: z.string(),
}),
/**
* Array of conditions to apply against typed data fields.
* Each condition specifies how to validate a specific field within the typed data.
*/
conditions: z
.array(
z.union([
EvmTypedAddressConditionSchema,
EvmTypedNumericalConditionSchema,
EvmTypedStringConditionSchema,
]),
)
.min(1),
});
export type SignEvmTypedDataFieldCriterion = z.infer<typeof SignEvmTypedDataFieldCriterionSchema>;
/**
* Schema for SignEvmTypedData verifying contract criterion
*/
export const SignEvmTypedDataVerifyingContractCriterionSchema = z.object({
/** The type of criterion, must be "evmTypedDataVerifyingContract" for verifying contract-based rules. */
type: z.literal("evmTypedDataVerifyingContract"),
/**
* Array of EVM addresses allowed or disallowed as verifying contracts.
* Each address must be a 0x-prefixed 40-character hexadecimal string.
* Limited to a maximum of 300 addresses per criterion.
*/
addresses: z.array(Address).max(300),
/**
* The operator to use for evaluating verifying contract addresses.
* "in" checks if the verifying contract is in the provided list.
* "not in" checks if the verifying contract is not in the provided list.
*/
operator: EvmAddressOperatorEnum,
});
export type SignEvmTypedDataVerifyingContractCriterion = z.infer<
typeof SignEvmTypedDataVerifyingContractCriterionSchema
>;
/**
* Schema for criteria used in SignEvmTypedData operations
*/
export const SignEvmTypedDataCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
SignEvmTypedDataFieldCriterionSchema,
SignEvmTypedDataVerifyingContractCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEvmTypedData operation.
* Can contain up to 10 individual criterion objects for typed data field or verifying contract checks.
*/
export type SignEvmTypedDataCriteria = z.infer<typeof SignEvmTypedDataCriteriaSchema>;
/**
* A list of comparables to apply against encoded arguments in the transaction's `data` field.
*/
export const EvmDataParameterConditionListSchema = z.object({
/**
* The name of the parameter to check against a transaction's calldata.
* If name is unknown, or is not named, you may supply an array index, e.g., `0` for first parameter.
*/
name: z.union([z.string().min(1), z.string().regex(/^\d+$/)]),
/**
* The operator to use for the comparison. The value resolved at the `name` will be on the
* left-hand side of the operator, and the `values` field will be on the right-hand side.
*/
operator: z.enum(["in", "not in"]),
/**
* Values to compare against the resolved `name` value.
* All values are encoded as strings. Refer to the table in the documentation for how values
* should be encoded, and which operators are supported for each type.
*/
values: z.array(z.string()),
});
export type EvmDataParameterConditionList = z.infer<typeof EvmDataParameterConditionListSchema>;
/**
* A single condition to apply against encoded arguments in the transaction's `data` field.
*/
export const EvmDataParameterConditionSchema = z.object({
/**
* The name of the parameter to check against a transaction's calldata.
* If name is unknown, or is not named, you may supply an array index, e.g., `0` for first parameter.
*/
name: z.union([z.string().min(1), z.string().regex(/^\d+$/)]),
/**
* The operator to use for the comparison. The value resolved at the `name` will be on the
* left-hand side of the operator, and the `value` field will be on the right-hand side.
*/
operator: EthValueOperatorEnum,
/**
* A single value to compare the value resolved at `name` to.
* All values are encoded as strings. Refer to the table in the documentation for how values
* should be encoded, and which operators are supported for each type.
*/
value: z.string(),
});
export type EvmDataParameterCondition = z.infer<typeof EvmDataParameterConditionSchema>;
/**
* A single condition to apply against the function and encoded arguments in the transaction's `data` field.
* Each `parameter` configuration must be successfully evaluated against the corresponding function argument
* in order for a policy to be accepted.
*/
export const EvmDataConditionSchema = z.object({
/**
* The name of a smart contract function being called.
*/
function: z.string().min(1),
/**
* An optional list of parameter conditions to apply against encoded arguments in the transaction's `data` field.
*/
params: z
.array(z.union([EvmDataParameterConditionSchema, EvmDataParameterConditionListSchema]))
.min(1)
.optional(),
});
export type EvmDataCondition = z.infer<typeof EvmDataConditionSchema>;
/**
* Schema for EVM data criterion
*/
export const EvmDataCriterionSchema = z.object({
/** The type of criterion, must be "evmData" for EVM transaction rules. */
type: z.literal("evmData"),
/**
* The ABI of the smart contract being called. This can be a partial structure with only specific functions.
*/
abi: z.union([z.enum(["erc20", "erc721", "erc1155"]), Abi]),
/**
* A list of conditions to apply against the function and encoded arguments in the transaction's `data` field.
* Each condition must be met in order for this policy to be accepted or rejected.
*/
conditions: z.array(EvmDataConditionSchema).min(1),
});
export type EvmDataCriterion = z.infer<typeof EvmDataCriterionSchema>;
/**
* Schema for criteria used in SignEvmTransaction operations
*/
export const SignEvmTransactionCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEvmTransaction operation.
* Can contain up to 10 individual criterion objects of ETH value or EVM address types.
*/
export type SignEvmTransactionCriteria = z.infer<typeof SignEvmTransactionCriteriaSchema>;
/**
* Schema for criteria used in SignEvmMessage operations
*/
export const SignEvmMessageCriteriaSchema = z
.array(z.discriminatedUnion("type", [EvmMessageCriterionSchema]))
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEvmMessage operation.
* Can contain up to 10 individual EVM message criterion objects.
*/
export type SignEvmMessageCriteria = z.infer<typeof SignEvmMessageCriteriaSchema>;
/**
* Schema for criteria used in SendEvmTransaction operations
*/
export const SendEvmTransactionCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
SendEvmTransactionEvmNetworkCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
// Type representing a set of criteria for the sendEvmTransaction operation. Can contain up to 10 individual criterion objects of ETH value or EVM address types.
export type SendEvmTransactionCriteria = z.infer<typeof SendEvmTransactionCriteriaSchema>;
/**
* Schema for criteria used in PrepareUserOperation operations
*/
export const PrepareUserOperationCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
PrepareUserOperationEvmNetworkCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the prepareUserOperation operation.
* Can contain up to 10 individual criterion objects of ETH value, EVM address, EVM network, or EVM data types.
*/
export type PrepareUserOperationCriteria = z.infer<typeof PrepareUserOperationCriteriaSchema>;
/**
* Schema for criteria used in SendUserOperation operations
*/
export const SendUserOperationCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the sendUserOperation operation.
* Can contain up to 10 individual criterion objects of ETH value, EVM address, or EVM data types.
*/
export type SendUserOperationCriteria = z.infer<typeof SendUserOperationCriteriaSchema>;
/**
* Schema for criteria used in SignEndUserEvmTransaction operations
*/
export const SignEndUserEvmTransactionCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEndUserEvmTransaction operation.
*/
export type SignEndUserEvmTransactionCriteria = z.infer<
typeof SignEndUserEvmTransactionCriteriaSchema
>;
/**
* Schema for criteria used in SendEndUserEvmTransaction operations
*/
export const SendEndUserEvmTransactionCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
EthValueCriterionSchema,
EvmAddressCriterionSchema,
PrepareUserOperationEvmNetworkCriterionSchema,
EvmDataCriterionSchema,
NetUSDChangeCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the sendEndUserEvmTransaction operation.
*/
export type SendEndUserEvmTransactionCriteria = z.infer<
typeof SendEndUserEvmTransactionCriteriaSchema
>;
/**
* Schema for criteria used in SignEndUserEvmMessage operations
*/
export const SignEndUserEvmMessageCriteriaSchema = z
.array(z.discriminatedUnion("type", [EvmMessageCriterionSchema]))
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEndUserEvmMessage operation.
*/
export type SignEndUserEvmMessageCriteria = z.infer<typeof SignEndUserEvmMessageCriteriaSchema>;
/**
* Schema for criteria used in SignEndUserEvmTypedData operations
*/
export const SignEndUserEvmTypedDataCriteriaSchema = z
.array(
z.discriminatedUnion("type", [
SignEvmTypedDataFieldCriterionSchema,
SignEvmTypedDataVerifyingContractCriterionSchema,
]),
)
.max(10)
.min(1);
/**
* Type representing a set of criteria for the signEndUserEvmTypedData operation.
*/
export type SignEndUserEvmTypedDataCriteria = z.infer<typeof SignEndUserEvmTypedDataCriteriaSchema>;
/**
* Enum for Evm Operation types
*/
export const EvmOperationEnum = z.enum([
"signEvmTransaction",
"sendEvmTransaction",
"signEvmMessage",
"signEvmTypedData",
"signEvmHash",
"prepareUserOperation",
"sendUserOperation",
]);
/**
* Type representing the operations that can be governed by a policy.
* Defines what EVM operations the policy applies to.
*/
export type EvmOperation = z.infer<typeof EvmOperationEnum>;
/**
* Enum for Action types
*/
export const ActionEnum = z.enum(["reject", "accept"]);
/**
* Type representing the possible policy actions.
* Determines whether matching the rule will cause a request to be accepted or rejected.
*/
export type Action = z.infer<typeof ActionEnum>;
/**
* Type representing a 'signEvmTransaction' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEvmTransactionRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the transaction, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEvmTransaction".
*/
operation: z.literal("signEvmTransaction"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEvmTransactionCriteriaSchema,
});
export type SignEvmTransactionRule = z.infer<typeof SignEvmTransactionRuleSchema>;
/**
* Type representing a 'signEvmHash' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEvmHashRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEvmHash".
*/
operation: z.literal("signEvmHash"),
});
export type SignEvmHashRule = z.infer<typeof SignEvmHashRuleSchema>;
/**
* Type representing a 'signEvmMessage' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEvmMessageRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEvmMessage".
*/
operation: z.literal("signEvmMessage"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEvmMessageCriteriaSchema,
});
export type SignEvmMessageRule = z.infer<typeof SignEvmMessageRuleSchema>;
/**
* Type representing a 'signEvmTypedData' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEvmTypedDataRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEvmTypedData".
*/
operation: z.literal("signEvmTypedData"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEvmTypedDataCriteriaSchema,
});
export type SignEvmTypedDataRule = z.infer<typeof SignEvmTypedDataRuleSchema>;
/**
* Type representing a 'sendEvmTransaction' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SendEvmTransactionRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the transaction, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "sendEvmTransaction".
*/
operation: z.literal("sendEvmTransaction"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SendEvmTransactionCriteriaSchema,
});
export type SendEvmTransactionRule = z.infer<typeof SendEvmTransactionRuleSchema>;
/**
* Type representing a 'prepareUserOperation' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const PrepareUserOperationRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the operation, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "prepareUserOperation".
*/
operation: z.literal("prepareUserOperation"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: PrepareUserOperationCriteriaSchema,
});
export type PrepareUserOperationRule = z.infer<typeof PrepareUserOperationRuleSchema>;
/**
* Type representing a 'sendUserOperation' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SendUserOperationRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the operation, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "sendUserOperation".
*/
operation: z.literal("sendUserOperation"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SendUserOperationCriteriaSchema,
});
export type SendUserOperationRule = z.infer<typeof SendUserOperationRuleSchema>;
/**
* Type representing a 'signEndUserEvmTransaction' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEndUserEvmTransactionRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the transaction, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEndUserEvmTransaction".
*/
operation: z.literal("signEndUserEvmTransaction"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEndUserEvmTransactionCriteriaSchema,
});
export type SignEndUserEvmTransactionRule = z.infer<typeof SignEndUserEvmTransactionRuleSchema>;
/**
* Type representing a 'sendEndUserEvmTransaction' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SendEndUserEvmTransactionRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the transaction, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "sendEndUserEvmTransaction".
*/
operation: z.literal("sendEndUserEvmTransaction"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SendEndUserEvmTransactionCriteriaSchema,
});
export type SendEndUserEvmTransactionRule = z.infer<typeof SendEndUserEvmTransactionRuleSchema>;
/**
* Type representing a 'signEndUserEvmMessage' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEndUserEvmMessageRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEndUserEvmMessage".
*/
operation: z.literal("signEndUserEvmMessage"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEndUserEvmMessageCriteriaSchema,
});
export type SignEndUserEvmMessageRule = z.infer<typeof SignEndUserEvmMessageRuleSchema>;
/**
* Type representing a 'signEndUserEvmTypedData' policy rule that can accept or reject specific operations
* based on a set of criteria.
*/
export const SignEndUserEvmTypedDataRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEndUserEvmTypedData".
*/
operation: z.literal("signEndUserEvmTypedData"),
/**
* The set of criteria that must be matched for this rule to apply.
* Must be compatible with the specified operation type.
*/
criteria: SignEndUserEvmTypedDataCriteriaSchema,
});
export type SignEndUserEvmTypedDataRule = z.infer<typeof SignEndUserEvmTypedDataRuleSchema>;
/**
* Type representing a 'signEndUserEvmHash' policy rule that can accept or reject
* end-user EVM hash signing operations.
*/
export const SignEndUserEvmHashRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEndUserEvmHash".
*/
operation: z.literal("signEndUserEvmHash"),
});
export type SignEndUserEvmHashRule = z.infer<typeof SignEndUserEvmHashRuleSchema>;