/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AmountDecimal, AmountDecimal$inboundSchema, AmountDecimal$Outbound, AmountDecimal$outboundSchema, } from "./amountdecimal.js"; import { WalletTransactionType, WalletTransactionType$inboundSchema, WalletTransactionType$outboundSchema, } from "./wallettransactiontype.js"; export type SweepSubtotal = { /** * The type of wallet transaction the subtotal is for. */ type: WalletTransactionType; /** * The number of transactions of this type accrued in the sweep. */ count: number; /** * The value of transactions of this type accrued in the sweep. */ amount: AmountDecimal; }; /** @internal */ export const SweepSubtotal$inboundSchema: z.ZodType< SweepSubtotal, z.ZodTypeDef, unknown > = z.object({ type: WalletTransactionType$inboundSchema, count: z.number().int(), amount: AmountDecimal$inboundSchema, }); /** @internal */ export type SweepSubtotal$Outbound = { type: string; count: number; amount: AmountDecimal$Outbound; }; /** @internal */ export const SweepSubtotal$outboundSchema: z.ZodType< SweepSubtotal$Outbound, z.ZodTypeDef, SweepSubtotal > = z.object({ type: WalletTransactionType$outboundSchema, count: z.number().int(), amount: AmountDecimal$outboundSchema, }); export function sweepSubtotalToJSON(sweepSubtotal: SweepSubtotal): string { return JSON.stringify(SweepSubtotal$outboundSchema.parse(sweepSubtotal)); } export function sweepSubtotalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SweepSubtotal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SweepSubtotal' from JSON`, ); }