This commit is contained in:
danidfra 2024-09-19 01:13:20 -03:00
parent 3e36cc8078
commit 0d8f7ebe64
1 changed files with 22 additions and 0 deletions

22
src/schemas/zap-split.ts Normal file
View File

@ -0,0 +1,22 @@
import { z } from 'zod';
import { type Account, accountSchema } from './account';
const addMethodsToAccount = (account: Account) => {
return {
...account,
get: (key: string) => (account as any)[key],
getIn: (path: string[]) => path.reduce((acc, key) => (acc as any)[key], account),
toJS: () => account,
};
};
const baseZapAccountSchema = z.object({
account: accountSchema.transform(addMethodsToAccount),
message: z.string().catch(''),
weight: z.number().catch(0),
});
type ZapSplitData = z.infer<typeof baseZapAccountSchema>;
export { baseZapAccountSchema, type ZapSplitData };