/*
* 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 {
AccountIdentifier,
AccountIdentifier$inboundSchema,
AccountIdentifier$Outbound,
AccountIdentifier$outboundSchema,
} from "./accountidentifier.js";
import {
Currency,
Currency$inboundSchema,
Currency$Outbound,
Currency$outboundSchema,
} from "./currency.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
import {
NetworkIdentifier,
NetworkIdentifier$inboundSchema,
NetworkIdentifier$Outbound,
NetworkIdentifier$outboundSchema,
} from "./networkidentifier.js";
/**
* AccountCoinsRequest is utilized to make a request on the /account/coins endpoint.
*/
export type AccountCoinsRequest = {
/**
* The network_identifier specifies which network a particular object is associated with.
*/
networkIdentifier: NetworkIdentifier;
/**
* The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).
*/
accountIdentifier: AccountIdentifier;
/**
* Include state from the mempool when looking up an account's unspent coins. Note, using this functionality breaks any guarantee of idempotency.
*/
includeMempool: boolean;
/**
* In some cases, the caller may not want to retrieve coins for all currencies for an AccountIdentifier. If the currencies field is populated, only coins for the specified currencies will be returned. If not populated, all unspent coins will be returned.
*/
currencies?: Array<Currency> | undefined;
};
/** @internal */
export const AccountCoinsRequest$inboundSchema: z.ZodType<
AccountCoinsRequest,
z.ZodTypeDef,
unknown
> = z.object({
network_identifier: NetworkIdentifier$inboundSchema,
account_identifier: AccountIdentifier$inboundSchema,
include_mempool: z.boolean(),
currencies: z.array(Currency$inboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
"network_identifier": "networkIdentifier",
"account_identifier": "accountIdentifier",
"include_mempool": "includeMempool",
});
});
/** @internal */
export type AccountCoinsRequest$Outbound = {
network_identifier: NetworkIdentifier$Outbound;
account_identifier: AccountIdentifier$Outbound;
include_mempool: boolean;
currencies?: Array<Currency$Outbound> | undefined;
};
/** @internal */
export const AccountCoinsRequest$outboundSchema: z.ZodType<
AccountCoinsRequest$Outbound,
z.ZodTypeDef,
AccountCoinsRequest
> = z.object({
networkIdentifier: NetworkIdentifier$outboundSchema,
accountIdentifier: AccountIdentifier$outboundSchema,
includeMempool: z.boolean(),
currencies: z.array(Currency$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
networkIdentifier: "network_identifier",
accountIdentifier: "account_identifier",
includeMempool: "include_mempool",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AccountCoinsRequest$ {
/** @deprecated use `AccountCoinsRequest$inboundSchema` instead. */
export const inboundSchema = AccountCoinsRequest$inboundSchema;
/** @deprecated use `AccountCoinsRequest$outboundSchema` instead. */
export const outboundSchema = AccountCoinsRequest$outboundSchema;
/** @deprecated use `AccountCoinsRequest$Outbound` instead. */
export type Outbound = AccountCoinsRequest$Outbound;
}
export function accountCoinsRequestToJSON(
accountCoinsRequest: AccountCoinsRequest,
): string {
return JSON.stringify(
AccountCoinsRequest$outboundSchema.parse(accountCoinsRequest),
);
}
export function accountCoinsRequestFromJSON(
jsonString: string,
): SafeParseResult<AccountCoinsRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => AccountCoinsRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AccountCoinsRequest' from JSON`,
);
}