/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; 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/sdk-validation-error.js"; import * as models from "../index.js"; export type PrepareSecurity = { keyAuth?: string | undefined; x402Payment?: string | undefined; }; export type PrepareRequest = { xSessionUserAddress?: string | undefined; xNetworkId?: string | undefined; xX402MaxAmountWei?: string | undefined; body: models.PaymentPrepareRequest; }; export type PrepareResponse = { headers: { [k: string]: Array }; result: models.PaymentPrepareResponse; }; /** @internal */ export type PrepareSecurity$Outbound = { KeyAuth?: string | undefined; X402Payment?: string | undefined; }; /** @internal */ export const PrepareSecurity$outboundSchema: z.ZodMiniType< PrepareSecurity$Outbound, PrepareSecurity > = z.pipe( z.object({ keyAuth: z.optional(z.string()), x402Payment: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { keyAuth: "KeyAuth", x402Payment: "X402Payment", }); }), ); export function prepareSecurityToJSON( prepareSecurity: PrepareSecurity, ): string { return JSON.stringify(PrepareSecurity$outboundSchema.parse(prepareSecurity)); } /** @internal */ export type PrepareRequest$Outbound = { "x-session-user-address"?: string | undefined; "x-network-id"?: string | undefined; "x-x402-max-amount-wei"?: string | undefined; body: models.PaymentPrepareRequest$Outbound; }; /** @internal */ export const PrepareRequest$outboundSchema: z.ZodMiniType< PrepareRequest$Outbound, PrepareRequest > = z.pipe( z.object({ xSessionUserAddress: z.optional(z.string()), xNetworkId: z.optional(z.string()), xX402MaxAmountWei: z.optional(z.string()), body: models.PaymentPrepareRequest$outboundSchema, }), z.transform((v) => { return remap$(v, { xSessionUserAddress: "x-session-user-address", xNetworkId: "x-network-id", xX402MaxAmountWei: "x-x402-max-amount-wei", }); }), ); export function prepareRequestToJSON(prepareRequest: PrepareRequest): string { return JSON.stringify(PrepareRequest$outboundSchema.parse(prepareRequest)); } /** @internal */ export const PrepareResponse$inboundSchema: z.ZodMiniType< PrepareResponse, unknown > = z.pipe( z.object({ Headers: z._default(z.record(z.string(), z.array(z.string())), {}), Result: models.PaymentPrepareResponse$inboundSchema, }), z.transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }), ); export function prepareResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PrepareResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PrepareResponse' from JSON`, ); }