import { HashComputationLevel, Node, Tree } from "@chainsafe/persistent-merkle-tree"; import { Require } from "../util/types.ts"; import { ByteViews, Type } from "./abstract.ts"; import { CompositeType } from "./composite.ts"; type Union = { readonly selector: number; value: T; }; type ValueOfTypes[]> = Types extends Type[] ? Union : never; export type UnionOpts = { typeName?: string; }; /** * Union: union type containing one of the given subtypes * - Notation: Union[type_0, type_1, ...], e.g. union[None, uint64, uint32] */ export declare class UnionType[]> extends CompositeType, ValueOfTypes, ValueOfTypes> { readonly types: Types; readonly typeName: string; readonly depth = 1; readonly maxChunkCount = 1; readonly fixedSize: null; readonly minSize: number; readonly maxSize: number; readonly isList = true; readonly isViewMutable = true; readonly mixInLengthBlockBytes: Uint8Array; readonly mixInLengthBuffer: Buffer; protected readonly maxSelector: number; constructor(types: Types, opts?: UnionOpts); static named[]>(types: Types, opts: Require): UnionType; defaultValue(): ValueOfTypes; getView(tree: Tree): ValueOfTypes; getViewDU(node: Node): ValueOfTypes; cacheOfViewDU(): unknown; commitView(view: ValueOfTypes): Node; commitViewDU(view: ValueOfTypes, hcOffset?: number, hcByLevel?: HashComputationLevel[] | null): Node; value_serializedSize(value: ValueOfTypes): number; value_serializeToBytes(output: ByteViews, offset: number, value: ValueOfTypes): number; value_deserializeFromBytes(data: ByteViews, start: number, end: number, reuseBytes?: boolean): ValueOfTypes; tree_serializedSize(node: Node): number; tree_serializeToBytes(output: ByteViews, offset: number, node: Node): number; tree_deserializeFromBytes(data: ByteViews, start: number, end: number): Node; hashTreeRoot(value: ValueOfTypes): Uint8Array; hashTreeRootInto(value: ValueOfTypes, output: Uint8Array, offset: number): void; protected getBlocksBytes(value: ValueOfTypes): Uint8Array; getPropertyGindex(prop: string): bigint; getPropertyType(): never; getIndexProperty(index: number): string | number; tree_getLeafGindices(rootGindex: bigint, rootNode?: Node): bigint[]; fromJson(json: unknown): ValueOfTypes; toJson(value: ValueOfTypes): Record; clone(value: ValueOfTypes): ValueOfTypes; equals(a: ValueOfTypes, b: ValueOfTypes): boolean; } export {};