Skip to content

Commit ca659ba

Browse files
committed
set the tokenId zod schema to string
1 parent b2d4446 commit ca659ba

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/Claimable.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ export function ClaimableModuleUI(
282282
}
283283

284284
const claimConditionFormSchema = z.object({
285-
tokenId: z.number().min(0, { message: "Invalid tokenId" }).optional(),
285+
tokenId: z.string().refine((v) => v.length === 0 || Number(v) >= 0, {
286+
message: "Invalid tokenId",
287+
}),
286288

287289
pricePerToken: z.coerce
288290
.number()
@@ -329,6 +331,7 @@ function ClaimConditionSection(props: {
329331
const form = useForm<ClaimConditionFormValues>({
330332
resolver: zodResolver(claimConditionFormSchema),
331333
values: {
334+
tokenId: "",
332335
currencyAddress:
333336
props.claimCondition?.currency ===
334337
"0x0000000000000000000000000000000000000000"
@@ -640,7 +643,9 @@ function PrimarySaleRecipientSection(props: {
640643
}
641644

642645
const mintFormSchema = z.object({
643-
tokenId: z.coerce.number().min(0, { message: "Invalid tokenId" }).optional(),
646+
tokenId: z.string().refine((v) => v.length === 0 || Number(v) >= 0, {
647+
message: "Invalid tokenId",
648+
}),
644649
quantity: z.coerce.number().min(0, { message: "Invalid quantity" }),
645650
recipient: addressSchema,
646651
});
@@ -654,6 +659,7 @@ function MintNFTSection(props: {
654659
const form = useForm<MintFormValues>({
655660
resolver: zodResolver(mintFormSchema),
656661
values: {
662+
tokenId: "",
657663
quantity: 0,
658664
recipient: "",
659665
},

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/Royalty.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ export function RoyaltyModuleUI(
225225
}
226226

227227
const royaltyInfoFormSchema = z.object({
228-
tokenId: z.coerce.number().min(0, { message: "Invalid tokenId" }),
228+
tokenId: z.string().refine((v) => v.length > 0 && Number(v) >= 0, {
229+
message: "Invalid tokenId",
230+
}),
231+
229232
recipient: addressSchema,
230233
bps: z
231234
.string()
@@ -241,7 +244,7 @@ function RoyaltyInfoPerTokenSection(props: {
241244
const form = useForm<RoyaltyInfoFormValues>({
242245
resolver: zodResolver(royaltyInfoFormSchema),
243246
values: {
244-
tokenId: 0,
247+
tokenId: "",
245248
recipient: "",
246249
bps: "",
247250
},

0 commit comments

Comments
 (0)