File tree Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -191,9 +191,7 @@ export function FilterDetailsStep({
191
191
render = { ( { field } ) => (
192
192
< FormItem className = "flex flex-col" >
193
193
< div className = "flex items-center justify-between text-xs" >
194
- < FormLabel >
195
- Contract Addresses < span className = "text-red-500" > *</ span >
196
- </ FormLabel >
194
+ < FormLabel > Contract Addresses</ FormLabel >
197
195
< p className = "text-muted-foreground" >
198
196
Enter a contract address
199
197
</ p >
@@ -281,9 +279,7 @@ export function FilterDetailsStep({
281
279
render = { ( { field } ) => (
282
280
< FormItem className = "flex flex-col" >
283
281
< div className = "flex items-center justify-between text-xs" >
284
- < FormLabel >
285
- To Address < span className = "text-red-500" > *</ span >
286
- </ FormLabel >
282
+ < FormLabel > To Address</ FormLabel >
287
283
< p className = "text-muted-foreground" > Enter a to address</ p >
288
284
</ div >
289
285
< FormControl >
Original file line number Diff line number Diff line change @@ -36,25 +36,45 @@ export const webhookFormSchema = z.object({
36
36
. min ( 1 , { message : "Select at least one chain" } ) ,
37
37
addresses : z
38
38
. string ( )
39
- . min ( 1 , { message : "Addresses is required" } )
40
- . refine ( ( val ) => val . split ( / [ \, \s ] + / ) . every ( ( a ) => isAddress ( a . trim ( ) ) ) , {
41
- message : "Enter a valid address" ,
42
- } ) ,
39
+ . optional ( )
40
+ . refine (
41
+ ( val ) => {
42
+ if ( val === undefined || val . trim ( ) === "" ) {
43
+ return true ;
44
+ }
45
+ return val
46
+ . split ( / [ \, \s ] + / )
47
+ . filter ( Boolean )
48
+ . every ( ( a ) => isAddress ( a . trim ( ) ) ) ;
49
+ } ,
50
+ {
51
+ message : "Enter valid addresses (comma-separated) or leave empty" ,
52
+ } ,
53
+ ) ,
43
54
fromAddresses : z
44
55
. string ( )
45
56
. optional ( )
46
57
. refine (
47
58
( val ) => ! val || val . split ( / [ , \s ] + / ) . every ( ( a ) => isAddress ( a . trim ( ) ) ) ,
48
59
{
49
- message : "Enter a valid address " ,
60
+ message : "Enter valid addresses (comma-separated) or leave empty " ,
50
61
} ,
51
62
) ,
52
63
toAddresses : z
53
64
. string ( )
65
+ . optional ( )
54
66
. refine (
55
- ( val ) => ! val || val . split ( / [ , \s ] + / ) . every ( ( a ) => isAddress ( a . trim ( ) ) ) ,
67
+ ( val ) => {
68
+ if ( val === undefined || val . trim ( ) === "" ) {
69
+ return true ;
70
+ }
71
+ return val
72
+ . split ( / [ \, \s ] + / )
73
+ . filter ( Boolean )
74
+ . every ( ( a ) => isAddress ( a . trim ( ) ) ) ;
75
+ } ,
56
76
{
57
- message : "Enter a valid address (comma-separated)" ,
77
+ message : "Enter valid addresses (comma-separated) or leave empty " ,
58
78
} ,
59
79
) ,
60
80
sigHash : z . string ( ) . optional ( ) ,
You can’t perform that action at this time.
0 commit comments