/*
* 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";
/**
* If the SubAccount address is not sufficient to uniquely specify a SubAccount, any other identifying information can be stored here. It is important to note that two SubAccounts with identical addresses but differing metadata will not be considered equal by clients.
*/
export type SubAccountIdentifierMetadata = {};
/**
* An account may have state specific to a contract address (ERC-20 token) and/or a stake (delegated balance). The sub_account_identifier should specify which state (if applicable) an account instantiation refers to.
*/
export type SubAccountIdentifier = {
/**
* The SubAccount address may be a cryptographic value or some other identifier (ex: bonded) that uniquely specifies a SubAccount.
*/
address: string;
/**
* If the SubAccount address is not sufficient to uniquely specify a SubAccount, any other identifying information can be stored here. It is important to note that two SubAccounts with identical addresses but differing metadata will not be considered equal by clients.
*/
metadata?: SubAccountIdentifierMetadata | undefined;
};
/** @internal */
export const SubAccountIdentifierMetadata$inboundSchema: z.ZodType<
SubAccountIdentifierMetadata,
z.ZodTypeDef,
unknown
> = z.object({});
/** @internal */
export type SubAccountIdentifierMetadata$Outbound = {};
/** @internal */
export const SubAccountIdentifierMetadata$outboundSchema: z.ZodType<
SubAccountIdentifierMetadata$Outbound,
z.ZodTypeDef,
SubAccountIdentifierMetadata
> = 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 SubAccountIdentifierMetadata$ {
/** @deprecated use `SubAccountIdentifierMetadata$inboundSchema` instead. */
export const inboundSchema = SubAccountIdentifierMetadata$inboundSchema;
/** @deprecated use `SubAccountIdentifierMetadata$outboundSchema` instead. */
export const outboundSchema = SubAccountIdentifierMetadata$outboundSchema;
/** @deprecated use `SubAccountIdentifierMetadata$Outbound` instead. */
export type Outbound = SubAccountIdentifierMetadata$Outbound;
}
export function subAccountIdentifierMetadataToJSON(
subAccountIdentifierMetadata: SubAccountIdentifierMetadata,
): string {
return JSON.stringify(
SubAccountIdentifierMetadata$outboundSchema.parse(
subAccountIdentifierMetadata,
),
);
}
export function subAccountIdentifierMetadataFromJSON(
jsonString: string,
): SafeParseResult<SubAccountIdentifierMetadata, SDKValidationError> {
return safeParse(
jsonString,
(x) => SubAccountIdentifierMetadata$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'SubAccountIdentifierMetadata' from JSON`,
);
}
/** @internal */
export const SubAccountIdentifier$inboundSchema: z.ZodType<
SubAccountIdentifier,
z.ZodTypeDef,
unknown
> = z.object({
address: z.string(),
metadata: z.lazy(() => SubAccountIdentifierMetadata$inboundSchema).optional(),
});
/** @internal */
export type SubAccountIdentifier$Outbound = {
address: string;
metadata?: SubAccountIdentifierMetadata$Outbound | undefined;
};
/** @internal */
export const SubAccountIdentifier$outboundSchema: z.ZodType<
SubAccountIdentifier$Outbound,
z.ZodTypeDef,
SubAccountIdentifier
> = z.object({
address: z.string(),
metadata: z.lazy(() => SubAccountIdentifierMetadata$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 SubAccountIdentifier$ {
/** @deprecated use `SubAccountIdentifier$inboundSchema` instead. */
export const inboundSchema = SubAccountIdentifier$inboundSchema;
/** @deprecated use `SubAccountIdentifier$outboundSchema` instead. */
export const outboundSchema = SubAccountIdentifier$outboundSchema;
/** @deprecated use `SubAccountIdentifier$Outbound` instead. */
export type Outbound = SubAccountIdentifier$Outbound;
}
export function subAccountIdentifierToJSON(
subAccountIdentifier: SubAccountIdentifier,
): string {
return JSON.stringify(
SubAccountIdentifier$outboundSchema.parse(subAccountIdentifier),
);
}
export function subAccountIdentifierFromJSON(
jsonString: string,
): SafeParseResult<SubAccountIdentifier, SDKValidationError> {
return safeParse(
jsonString,
(x) => SubAccountIdentifier$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'SubAccountIdentifier' from JSON`,
);
}