/*
* 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";
import {
Transaction,
Transaction$inboundSchema,
Transaction$Outbound,
Transaction$outboundSchema,
} from "./transaction.js";
export type MempoolTransactionResponseMetadata = {};
/**
* A MempoolTransactionResponse contains an estimate of a mempool transaction. It may not be possible to know the full impact of a transaction in the mempool (ex: fee paid).
*/
export type MempoolTransactionResponse = {
/**
* Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
*/
transaction: Transaction;
metadata?: MempoolTransactionResponseMetadata | undefined;
};
/** @internal */
export const MempoolTransactionResponseMetadata$inboundSchema: z.ZodType<
MempoolTransactionResponseMetadata,
z.ZodTypeDef,
unknown
> = z.object({});
/** @internal */
export type MempoolTransactionResponseMetadata$Outbound = {};
/** @internal */
export const MempoolTransactionResponseMetadata$outboundSchema: z.ZodType<
MempoolTransactionResponseMetadata$Outbound,
z.ZodTypeDef,
MempoolTransactionResponseMetadata
> = z.object({});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace MempoolTransactionResponseMetadata$ {
/** @deprecated use `MempoolTransactionResponseMetadata$inboundSchema` instead. */
export const inboundSchema = MempoolTransactionResponseMetadata$inboundSchema;
/** @deprecated use `MempoolTransactionResponseMetadata$outboundSchema` instead. */
export const outboundSchema =
MempoolTransactionResponseMetadata$outboundSchema;
/** @deprecated use `MempoolTransactionResponseMetadata$Outbound` instead. */
export type Outbound = MempoolTransactionResponseMetadata$Outbound;
}
export function mempoolTransactionResponseMetadataToJSON(
mempoolTransactionResponseMetadata: MempoolTransactionResponseMetadata,
): string {
return JSON.stringify(
MempoolTransactionResponseMetadata$outboundSchema.parse(
mempoolTransactionResponseMetadata,
),
);
}
export function mempoolTransactionResponseMetadataFromJSON(
jsonString: string,
): SafeParseResult<MempoolTransactionResponseMetadata, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
MempoolTransactionResponseMetadata$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MempoolTransactionResponseMetadata' from JSON`,
);
}
/** @internal */
export const MempoolTransactionResponse$inboundSchema: z.ZodType<
MempoolTransactionResponse,
z.ZodTypeDef,
unknown
> = z.object({
transaction: Transaction$inboundSchema,
metadata: z.lazy(() => MempoolTransactionResponseMetadata$inboundSchema)
.optional(),
});
/** @internal */
export type MempoolTransactionResponse$Outbound = {
transaction: Transaction$Outbound;
metadata?: MempoolTransactionResponseMetadata$Outbound | undefined;
};
/** @internal */
export const MempoolTransactionResponse$outboundSchema: z.ZodType<
MempoolTransactionResponse$Outbound,
z.ZodTypeDef,
MempoolTransactionResponse
> = z.object({
transaction: Transaction$outboundSchema,
metadata: z.lazy(() => MempoolTransactionResponseMetadata$outboundSchema)
.optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace MempoolTransactionResponse$ {
/** @deprecated use `MempoolTransactionResponse$inboundSchema` instead. */
export const inboundSchema = MempoolTransactionResponse$inboundSchema;
/** @deprecated use `MempoolTransactionResponse$outboundSchema` instead. */
export const outboundSchema = MempoolTransactionResponse$outboundSchema;
/** @deprecated use `MempoolTransactionResponse$Outbound` instead. */
export type Outbound = MempoolTransactionResponse$Outbound;
}
export function mempoolTransactionResponseToJSON(
mempoolTransactionResponse: MempoolTransactionResponse,
): string {
return JSON.stringify(
MempoolTransactionResponse$outboundSchema.parse(mempoolTransactionResponse),
);
}
export function mempoolTransactionResponseFromJSON(
jsonString: string,
): SafeParseResult<MempoolTransactionResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => MempoolTransactionResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MempoolTransactionResponse' from JSON`,
);
}