the zodSchema field to construct other types
keyp-dev opened this issue · 0 comments
keyp-dev commented
Lost all types
export const TransferTokenEVMSchema = z.object({
tokenContract: AddressSchema,
tokenId: z.string(),
to: AddressSchema,
deadline: z.string(),
v: z.string(),
r: AddressSchema,
s: AddressSchema,
type: z.enum(['ERC721', 'ERC1155']),
amount: z.string().nullish(),
});
export type TransferTokenEVM = z.infer<typeof TransferTokenEVMSchema>;
export const TransferTokenSUISchema = z.object({
tokenContract: AddressSchema,
tokenId: z.string(),
from: AddressSchema,
to: AddressSchema,
bcs: z.number().array(),
customSign: z.string(),
typeArguments: z.string().array(),
});
export type TransferTokenSUI = z.infer<typeof TransferTokenSUISchema>;
export const TransferTokenSchema = z.union([
TransferTokenEVMSchema,
TransferTokenSUISchema,
]);
class TransferTokenRequest extends createZodDto(TransferTokenSchema) {}
Lost artwork type
export const CreateGiftBoxParamsSchema = z
.object({
task_id: z.string().uuid().optional(),
owner: z.string().email(),
first_name: z.string(),
last_name: z.string(),
note_subject: z.string(),
signature: z.string(),
message: z.string(),
message_bless: z.string().optional(),
wrapping: z.string(),
artwork: CreateArtworkSchema,
})
.merge(ParamsForEventTransactionSchema)
.merge(LoginAndChainSchema);
export type CreateGiftBoxParams = z.infer<typeof CreateGiftBoxParamsSchema>;
class CreateGiftBoxRequest extends createZodDto(
CreateGiftBoxParamsSchema.omit({
chainName: true,
login: true,
event: true,
}).merge(
z.object({
event: z.object({
transaction_hash: z.string(),
}),
}),
),
) {}