Skip to content

Commit f0298ff

Browse files
chore(kleros-sdk): revert-policy-check-change
1 parent 48a757f commit f0298ff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kleros-sdk/src/dataMappings/utils/disputeDetailsSchema.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { normalize } from "viem/ens";
55
export const isHexAddress = (str: string): boolean => /^0x[a-fA-F0-9]{40}$/.test(str);
66
export const isHexId = (str: string): boolean => /^0x[a-fA-F0-9]{1,64}$/.test(str);
77
export const isMultiaddr = (str: string): boolean =>
8-
/^\/(?:ip4|ip6|dns4|dns6|dnsaddr|tcp|udp|utp|tls|ws|wss|p2p-circuit|p2p-webrtc-star|p2p-webrtc-direct|p2p-websocket-star|onion)(\/[^\s\/]+)+$|^ipfs:\/\/[a-zA-Z0-9]+(\/[^\s]*)?$/.test(
8+
/^\/(?:ip4|ip6|dns4|dns6|dnsaddr|tcp|udp|utp|tls|ws|wss|p2p-circuit|p2p-webrtc-star|p2p-webrtc-direct|p2p-websocket-star|onion|ipfs)(\/[^\s\/]+)+$|^ipfs:\/\/[a-zA-Z0-9]+\/[a-zA-Z0-9]+(\.[a-zA-Z0-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(),

0 commit comments

Comments
 (0)