/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
/**
* CoinIdentifier uniquely identifies a Coin.
*/
export type CoinIdentifier = {
/**
* Identifier should be populated with a globally unique identifier of a Coin. In Bitcoin, this identifier would be transaction_hash:index.
*/
identifier: string;
};
/** @internal */
export const CoinIdentifier$inboundSchema: z.ZodType<
CoinIdentifier,
z.ZodTypeDef,
unknown
> = z.object({
identifier: z.string(),
});
/** @internal */
export type CoinIdentifier$Outbound = {
identifier: string;
};
/** @internal */
export const CoinIdentifier$outboundSchema: z.ZodType<
CoinIdentifier$Outbound,
z.ZodTypeDef,
CoinIdentifier
> = z.object({
identifier: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace CoinIdentifier$ {
/** @deprecated use `CoinIdentifier$inboundSchema` instead. */
export const inboundSchema = CoinIdentifier$inboundSchema;
/** @deprecated use `CoinIdentifier$outboundSchema` instead. */
export const outboundSchema = CoinIdentifier$outboundSchema;
/** @deprecated use `CoinIdentifier$Outbound` instead. */
export type Outbound = CoinIdentifier$Outbound;
}
export function coinIdentifierToJSON(coinIdentifier: CoinIdentifier): string {
return JSON.stringify(CoinIdentifier$outboundSchema.parse(coinIdentifier));
}
export function coinIdentifierFromJSON(
jsonString: string,
): SafeParseResult<CoinIdentifier, SDKValidationError> {
return safeParse(
jsonString,
(x) => CoinIdentifier$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CoinIdentifier' from JSON`,
);
}