File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
kleros-sdk/src/dataMappings/utils Expand file tree Collapse file tree 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";
55export const isHexAddress = ( str : string ) : boolean => / ^ 0 x [ a - f A - F 0 - 9 ] { 40 } $ / . test ( str ) ;
66export const isHexId = ( str : string ) : boolean => / ^ 0 x [ a - f A - F 0 - 9 ] { 1 , 64 } $ / . test ( str ) ;
77export 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 (
99 str
1010 ) ;
1111
@@ -56,7 +56,9 @@ const DisputeDetailsSchema = z.object({
5656 description : z . string ( ) ,
5757 question : z . string ( ) ,
5858 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+ } ) ,
6062 attachment : AttachmentSchema . optional ( ) ,
6163 frontendUrl : z . string ( ) . optional ( ) ,
6264 metadata : MetadataSchema . optional ( ) ,
You can’t perform that action at this time.
0 commit comments