File tree 1 file changed +4
-2
lines changed
kleros-sdk/src/dataMappings/utils
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { normalize } from "viem/ens";
5
5
export const isHexAddress = ( str : string ) : boolean => / ^ 0 x [ a - f A - F 0 - 9 ] { 40 } $ / . test ( str ) ;
6
6
export const isHexId = ( str : string ) : boolean => / ^ 0 x [ a - f A - F 0 - 9 ] { 1 , 64 } $ / . test ( str ) ;
7
7
export const isMultiaddr = ( str : string ) : boolean =>
8
- / ^ \/ (?: i p 4 | i p 6 | d n s 4 | d n s 6 | d n s a d d r | t c p | u d p | u t p | t l s | w s | w s s | p 2 p - c i r c u i t | p 2 p - w e b r t c - s t a r | p 2 p - w e b r t c - d i r e c t | p 2 p - w e b s o c k e t - s t a r | o n i o n ) ( \/ [ ^ \s \/ ] + ) + $ | ^ i p f s : \/ \/ [ a - z A - Z 0 - 9 ] + ( \/ [ ^ \s ] * ) ? $ / . test (
8
+ / ^ \/ (?: i p 4 | i p 6 | d n s 4 | d n s 6 | d n s a d d r | t c p | u d p | u t p | t l s | w s | w s s | p 2 p - c i r c u i t | p 2 p - w e b r t c - s t a r | p 2 p - w e b r t c - d i r e c t | p 2 p - w e b s o c k e t - s t a r | o n i o n | i p f s ) ( \/ [ ^ \s \/ ] + ) + $ | ^ i p f s : \/ \/ [ a - z A - Z 0 - 9 ] + \/ [ a - z A - Z 0 - 9 ] + ( \. [ a - z A - Z 0 - 9 ] + ) ? $ / . test (
9
9
str
10
10
) ;
11
11
@@ -56,7 +56,9 @@ const DisputeDetailsSchema = z.object({
56
56
description : z . string ( ) ,
57
57
question : z . string ( ) ,
58
58
answers : z . array ( AnswerSchema ) ,
59
- policyURI : z . string ( ) ,
59
+ policyURI : z . string ( ) . refine ( ( value ) => isMultiaddr ( value ) , {
60
+ message : "Provided policy URI is not a valid multiaddr." ,
61
+ } ) ,
60
62
attachment : AttachmentSchema . optional ( ) ,
61
63
frontendUrl : z . string ( ) . optional ( ) ,
62
64
metadata : MetadataSchema . optional ( ) ,
You can’t perform that action at this time.
0 commit comments