/** This module defines the Option type and its methods to represent and handle an optional value. */ import type { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client'; import { PhantomReified, Reified, StructClass, ToField, ToJSON, ToTypeArgument, ToTypeStr, TypeArgument } from '../../../_framework/reified'; import { FieldsWithTypes } from '../../../_framework/util'; import { Vector } from '../../../_framework/vector'; export declare function isOption(type: string): boolean; export interface OptionFields { vec: ToField>; } export type OptionReified = Reified, OptionFields>; export type OptionJSONField = { vec: ToJSON[]; }; export type OptionJSON = { $typeName: typeof Option.$typeName; $typeArgs: [ToTypeStr]; } & OptionJSONField; /** * Abstraction of a value that may or may not be present. Implemented with a vector of size * zero or one because Move bytecode does not have ADTs. */ export declare class Option implements StructClass { __StructClass: true; static readonly $typeName: `0x1::option::Option`; static readonly $numTypeParams = 1; static readonly $isPhantom: readonly [false]; __inner: Element; readonly $typeName: typeof Option.$typeName; readonly $fullTypeName: `0x1::option::Option<${ToTypeStr}>`; readonly $typeArgs: [ToTypeStr]; readonly $isPhantom: typeof Option.$isPhantom; readonly vec: ToField>; private constructor(); static reified>(Element: Element): OptionReified>; static get r(): typeof Option.reified; static phantom>(Element: Element): PhantomReified>>>; static get p(): typeof Option.phantom; private static instantiateBcs; private static cachedBcs; static get bcs(): ReturnType; static fromFields>(typeArg: Element, fields: Record): Option>; static fromFieldsWithTypes>(typeArg: Element, item: FieldsWithTypes): Option>; static fromBcs>(typeArg: Element, data: Uint8Array): Option>; toJSONField(): OptionJSONField; toJSON(): OptionJSON; static fromJSONField>(typeArg: Element, field: any): Option>; static fromJSON>(typeArg: Element, json: Record): Option>; static fromCoreObject>(typeArg: Element, obj: SuiClientTypes.Object<{ content: true; }>): Option>; static fetch>(client: ClientWithCoreApi, typeArg: Element, id: string): Promise>>; }