/*
* 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 {
NetworkIdentifier,
NetworkIdentifier$inboundSchema,
NetworkIdentifier$Outbound,
NetworkIdentifier$outboundSchema,
} from "./networkidentifier.js";
/**
* ConstructionHashRequest is the input to the `/construction/hash` endpoint.
*/
export type ConstructionHashRequest = {
/**
* The network_identifier specifies which network a particular object is associated with.
*/
networkIdentifier: NetworkIdentifier;
signedTransaction: string;
};
/** @internal */
export const ConstructionHashRequest$inboundSchema: z.ZodType<
ConstructionHashRequest,
z.ZodTypeDef,
unknown
> = z.object({
network_identifier: NetworkIdentifier$inboundSchema,
signed_transaction: z.string(),
}).transform((v) => {
return remap$(v, {
"network_identifier": "networkIdentifier",
"signed_transaction": "signedTransaction",
});
});
/** @internal */
export type ConstructionHashRequest$Outbound = {
network_identifier: NetworkIdentifier$Outbound;
signed_transaction: string;
};
/** @internal */
export const ConstructionHashRequest$outboundSchema: z.ZodType<
ConstructionHashRequest$Outbound,
z.ZodTypeDef,
ConstructionHashRequest
> = z.object({
networkIdentifier: NetworkIdentifier$outboundSchema,
signedTransaction: z.string(),
}).transform((v) => {
return remap$(v, {
networkIdentifier: "network_identifier",
signedTransaction: "signed_transaction",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ConstructionHashRequest$ {
/** @deprecated use `ConstructionHashRequest$inboundSchema` instead. */
export const inboundSchema = ConstructionHashRequest$inboundSchema;
/** @deprecated use `ConstructionHashRequest$outboundSchema` instead. */
export const outboundSchema = ConstructionHashRequest$outboundSchema;
/** @deprecated use `ConstructionHashRequest$Outbound` instead. */
export type Outbound = ConstructionHashRequest$Outbound;
}
export function constructionHashRequestToJSON(
constructionHashRequest: ConstructionHashRequest,
): string {
return JSON.stringify(
ConstructionHashRequest$outboundSchema.parse(constructionHashRequest),
);
}
export function constructionHashRequestFromJSON(
jsonString: string,
): SafeParseResult<ConstructionHashRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => ConstructionHashRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ConstructionHashRequest' from JSON`,
);
}