/*
* 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";
/**
* A BlockTransactionResponse contains information about a block transaction.
*/
export type BlockTransactionResponse = {
/**
* Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
*/
transaction: Transaction;
};
/** @internal */
export const BlockTransactionResponse$inboundSchema: z.ZodType<
BlockTransactionResponse,
z.ZodTypeDef,
unknown
> = z.object({
transaction: Transaction$inboundSchema,
});
/** @internal */
export type BlockTransactionResponse$Outbound = {
transaction: Transaction$Outbound;
};
/** @internal */
export const BlockTransactionResponse$outboundSchema: z.ZodType<
BlockTransactionResponse$Outbound,
z.ZodTypeDef,
BlockTransactionResponse
> = z.object({
transaction: Transaction$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace BlockTransactionResponse$ {
/** @deprecated use `BlockTransactionResponse$inboundSchema` instead. */
export const inboundSchema = BlockTransactionResponse$inboundSchema;
/** @deprecated use `BlockTransactionResponse$outboundSchema` instead. */
export const outboundSchema = BlockTransactionResponse$outboundSchema;
/** @deprecated use `BlockTransactionResponse$Outbound` instead. */
export type Outbound = BlockTransactionResponse$Outbound;
}
export function blockTransactionResponseToJSON(
blockTransactionResponse: BlockTransactionResponse,
): string {
return JSON.stringify(
BlockTransactionResponse$outboundSchema.parse(blockTransactionResponse),
);
}
export function blockTransactionResponseFromJSON(
jsonString: string,
): SafeParseResult<BlockTransactionResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => BlockTransactionResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BlockTransactionResponse' from JSON`,
);
}