/*
* 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 {
Allow,
Allow$inboundSchema,
Allow$Outbound,
Allow$outboundSchema,
} from "./allow.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
import {
Version,
Version$inboundSchema,
Version$Outbound,
Version$outboundSchema,
} from "./version.js";
/**
* NetworkOptionsResponse contains information about the versioning of the node and the allowed operation statuses, operation types, and errors.
*/
export type NetworkOptionsResponse = {
/**
* The Version object is utilized to inform the client of the versions of different components of the Rosetta implementation.
*/
version: Version;
/**
* Allow specifies supported Operation status, Operation types, and all possible error statuses. This Allow object is used by clients to validate the correctness of a Rosetta Server implementation. It is expected that these clients will error if they receive some response that contains any of the above information that is not specified here.
*/
allow: Allow;
};
/** @internal */
export const NetworkOptionsResponse$inboundSchema: z.ZodType<
NetworkOptionsResponse,
z.ZodTypeDef,
unknown
> = z.object({
version: Version$inboundSchema,
allow: Allow$inboundSchema,
});
/** @internal */
export type NetworkOptionsResponse$Outbound = {
version: Version$Outbound;
allow: Allow$Outbound;
};
/** @internal */
export const NetworkOptionsResponse$outboundSchema: z.ZodType<
NetworkOptionsResponse$Outbound,
z.ZodTypeDef,
NetworkOptionsResponse
> = z.object({
version: Version$outboundSchema,
allow: Allow$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace NetworkOptionsResponse$ {
/** @deprecated use `NetworkOptionsResponse$inboundSchema` instead. */
export const inboundSchema = NetworkOptionsResponse$inboundSchema;
/** @deprecated use `NetworkOptionsResponse$outboundSchema` instead. */
export const outboundSchema = NetworkOptionsResponse$outboundSchema;
/** @deprecated use `NetworkOptionsResponse$Outbound` instead. */
export type Outbound = NetworkOptionsResponse$Outbound;
}
export function networkOptionsResponseToJSON(
networkOptionsResponse: NetworkOptionsResponse,
): string {
return JSON.stringify(
NetworkOptionsResponse$outboundSchema.parse(networkOptionsResponse),
);
}
export function networkOptionsResponseFromJSON(
jsonString: string,
): SafeParseResult<NetworkOptionsResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => NetworkOptionsResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'NetworkOptionsResponse' from JSON`,
);
}