forked from Northgate-Systems/RemitX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidations.ts
More file actions
28 lines (23 loc) · 991 Bytes
/
Copy pathvalidations.ts
File metadata and controls
28 lines (23 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { z } from "zod";
export const registerSchema = z.object({
email: z.string().email("Invalid email address"),
password: z.string().min(8, "Password must be at least 8 characters"),
});
export const loginSchema = z.object({
email: z.string().email("Invalid email address"),
password: z.string().min(1, "Password is required"),
});
export const stellarSendSchema = z.object({
fromAsset: z.string().min(1, "Source asset is required").max(10),
toAsset: z.string().min(1, "Destination asset is required").max(10),
amount: z.string().regex(/^\d+(\.\d+)?$/, "Amount must be a positive number"),
recipientAddress: z.string().regex(/^G[A-Z2-7]{55}$/, "Invalid Stellar public key"),
});
export const stellarSubmitSchema = z.object({
signedXdr: z.string().min(1, "Signed XDR is required"),
transactionId: z.string().min(1, "Transaction ID is required"),
});
export const rateQuerySchema = z.object({
from: z.string().min(1).max(10),
to: z.string().min(1).max(10),
});