/*
* 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";
import {
TransactionIdentifier,
TransactionIdentifier$inboundSchema,
TransactionIdentifier$Outbound,
TransactionIdentifier$outboundSchema,
} from "./transactionidentifier.js";
/**
* A MempoolResponse contains all transaction identifiers in the mempool for a particular network_identifier.
*/
export type MempoolResponse = {
transactionIdentifiers: Array<TransactionIdentifier>;
};
/** @internal */
export const MempoolResponse$inboundSchema: z.ZodType<
MempoolResponse,
z.ZodTypeDef,
unknown
> = z.object({
transaction_identifiers: z.array(TransactionIdentifier$inboundSchema),
}).transform((v) => {
return remap$(v, {
"transaction_identifiers": "transactionIdentifiers",
});
});
/** @internal */
export type MempoolResponse$Outbound = {
transaction_identifiers: Array<TransactionIdentifier$Outbound>;
};
/** @internal */
export const MempoolResponse$outboundSchema: z.ZodType<
MempoolResponse$Outbound,
z.ZodTypeDef,
MempoolResponse
> = z.object({
transactionIdentifiers: z.array(TransactionIdentifier$outboundSchema),
}).transform((v) => {
return remap$(v, {
transactionIdentifiers: "transaction_identifiers",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace MempoolResponse$ {
/** @deprecated use `MempoolResponse$inboundSchema` instead. */
export const inboundSchema = MempoolResponse$inboundSchema;
/** @deprecated use `MempoolResponse$outboundSchema` instead. */
export const outboundSchema = MempoolResponse$outboundSchema;
/** @deprecated use `MempoolResponse$Outbound` instead. */
export type Outbound = MempoolResponse$Outbound;
}
export function mempoolResponseToJSON(
mempoolResponse: MempoolResponse,
): string {
return JSON.stringify(MempoolResponse$outboundSchema.parse(mempoolResponse));
}
export function mempoolResponseFromJSON(
jsonString: string,
): SafeParseResult<MempoolResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => MempoolResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MempoolResponse' from JSON`,
);
}