import { z } from 'zod';
// --- Enums ---
export const WalletTypeSchema = z.enum(['EVM', 'SOLANA', 'COSMOS']);
export type WalletType = z.infer<typeof WalletTypeSchema>;
export const WalletStatusSchema = z.enum(['creating', 'ready', 'error']);
export type WalletStatus = z.infer<typeof WalletStatusSchema>;
export const SignatureSchemeSchema = z.enum(['DKLS', 'CGGMP', 'ED25519']);
export type SignatureScheme = z.infer<typeof SignatureSchemeSchema>;
export const UserIdentifierTypeSchema = z.enum([
'EMAIL',
'PHONE',
'CUSTOM_ID',
'GUEST_ID',
'TELEGRAM',
'DISCORD',
'TWITTER',
]);
export type UserIdentifierType = z.infer<typeof UserIdentifierTypeSchema>;
// --- Request / Response schemas ---
export const CreateWalletRequestSchema = z.object({
type: WalletTypeSchema,
userIdentifier: z.string().min(1),
userIdentifierType: UserIdentifierTypeSchema,
scheme: SignatureSchemeSchema.optional(),
cosmosPrefix: z.string().optional(),
});
export type CreateWalletRequest = z.infer<typeof CreateWalletRequestSchema>;
export const WalletSchema = z.object({
id: z.string(),
type: z.string(),
status: WalletStatusSchema,
address: z.string().optional(),
publicKey: z.string().optional(),
createdAt: z.string(),
});
export type Wallet = z.infer<typeof WalletSchema>;
export const CreateWalletResponseSchema = z.object({
wallet: WalletSchema,
scheme: z.string().optional(),
});
export type CreateWalletResponse = z.infer<typeof CreateWalletResponseSchema>;
export const SignRawRequestSchema = z.object({
data: z.string().regex(/^0x[0-9a-fA-F]+$/, 'data must be a 0x-prefixed hex string'),
});
export type SignRawRequest = z.infer<typeof SignRawRequestSchema>;
export const SignRawResponseSchema = z.object({
signature: z.string(),
});
export type SignRawResponse = z.infer<typeof SignRawResponseSchema>;
export const ErrorResponseSchema = z.object({
error: z.string(),
code: z.string().optional(),
});
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;