/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The notional value the order is not reasonably expected to exceed in USD. This value is always positive. */ export type ExpectedNotionalCeilingAmount = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * A summary of an open order. */ export type CalculateCashBalanceResponseOpenOrderSummary = { /** * The asset for the open order. */ asset?: string | undefined; /** * The notional value the order is not reasonably expected to exceed in USD. This value is always positive. */ expectedNotionalCeilingAmount?: | ExpectedNotionalCeilingAmount | null | undefined; }; /** @internal */ export const ExpectedNotionalCeilingAmount$inboundSchema: z.ZodType< ExpectedNotionalCeilingAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ExpectedNotionalCeilingAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const ExpectedNotionalCeilingAmount$outboundSchema: z.ZodType< ExpectedNotionalCeilingAmount$Outbound, z.ZodTypeDef, ExpectedNotionalCeilingAmount > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExpectedNotionalCeilingAmount$ { /** @deprecated use `ExpectedNotionalCeilingAmount$inboundSchema` instead. */ export const inboundSchema = ExpectedNotionalCeilingAmount$inboundSchema; /** @deprecated use `ExpectedNotionalCeilingAmount$outboundSchema` instead. */ export const outboundSchema = ExpectedNotionalCeilingAmount$outboundSchema; /** @deprecated use `ExpectedNotionalCeilingAmount$Outbound` instead. */ export type Outbound = ExpectedNotionalCeilingAmount$Outbound; } export function expectedNotionalCeilingAmountToJSON( expectedNotionalCeilingAmount: ExpectedNotionalCeilingAmount, ): string { return JSON.stringify( ExpectedNotionalCeilingAmount$outboundSchema.parse( expectedNotionalCeilingAmount, ), ); } export function expectedNotionalCeilingAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExpectedNotionalCeilingAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExpectedNotionalCeilingAmount' from JSON`, ); } /** @internal */ export const CalculateCashBalanceResponseOpenOrderSummary$inboundSchema: z.ZodType< CalculateCashBalanceResponseOpenOrderSummary, z.ZodTypeDef, unknown > = z.object({ asset: z.string().optional(), expected_notional_ceiling_amount: z.nullable( z.lazy(() => ExpectedNotionalCeilingAmount$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "expected_notional_ceiling_amount": "expectedNotionalCeilingAmount", }); }); /** @internal */ export type CalculateCashBalanceResponseOpenOrderSummary$Outbound = { asset?: string | undefined; expected_notional_ceiling_amount?: | ExpectedNotionalCeilingAmount$Outbound | null | undefined; }; /** @internal */ export const CalculateCashBalanceResponseOpenOrderSummary$outboundSchema: z.ZodType< CalculateCashBalanceResponseOpenOrderSummary$Outbound, z.ZodTypeDef, CalculateCashBalanceResponseOpenOrderSummary > = z.object({ asset: z.string().optional(), expectedNotionalCeilingAmount: z.nullable( z.lazy(() => ExpectedNotionalCeilingAmount$outboundSchema), ).optional(), }).transform((v) => { return remap$(v, { expectedNotionalCeilingAmount: "expected_notional_ceiling_amount", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CalculateCashBalanceResponseOpenOrderSummary$ { /** @deprecated use `CalculateCashBalanceResponseOpenOrderSummary$inboundSchema` instead. */ export const inboundSchema = CalculateCashBalanceResponseOpenOrderSummary$inboundSchema; /** @deprecated use `CalculateCashBalanceResponseOpenOrderSummary$outboundSchema` instead. */ export const outboundSchema = CalculateCashBalanceResponseOpenOrderSummary$outboundSchema; /** @deprecated use `CalculateCashBalanceResponseOpenOrderSummary$Outbound` instead. */ export type Outbound = CalculateCashBalanceResponseOpenOrderSummary$Outbound; } export function calculateCashBalanceResponseOpenOrderSummaryToJSON( calculateCashBalanceResponseOpenOrderSummary: CalculateCashBalanceResponseOpenOrderSummary, ): string { return JSON.stringify( CalculateCashBalanceResponseOpenOrderSummary$outboundSchema.parse( calculateCashBalanceResponseOpenOrderSummary, ), ); } export function calculateCashBalanceResponseOpenOrderSummaryFromJSON( jsonString: string, ): SafeParseResult< CalculateCashBalanceResponseOpenOrderSummary, SDKValidationError > { return safeParse( jsonString, (x) => CalculateCashBalanceResponseOpenOrderSummary$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CalculateCashBalanceResponseOpenOrderSummary' from JSON`, ); }