import { Gindex, HashComputationLevel, Node, Proof, Tree } from "@chainsafe/persistent-merkle-tree"; import { Require } from "../util/types.ts"; import { BitArray } from "../value/bitArray.ts"; import { TreeView } from "../view/abstract.ts"; import { TreeViewDU } from "../viewDU/abstract.ts"; import { Type, ValueOf } from "./abstract.ts"; import { BasicType } from "./basic.ts"; import { ByteViews, CompositeType } from "./composite.ts"; type BytesRange = { start: number; end: number; }; export type ProgressiveContainerOptions> = { typeName?: string; jsonCase?: KeyCase; casingMap?: CasingMap; cachePermanentRootStruct?: boolean; }; export type KeyCase = "eth2" | "snake" | "constant" | "camel" | "header" | "pascal"; type CasingMap> = Partial<{ [K in keyof Fields]: string; }>; export type ValueOfFields>> = { [K in keyof Fields]: ValueOf; }; type FieldsView>> = { [K in keyof Fields]: Fields[K] extends CompositeType ? TV : Fields[K] extends BasicType ? V : never; }; type FieldsViewDU>> = { [K in keyof Fields]: Fields[K] extends CompositeType ? TVDU : Fields[K] extends BasicType ? V : never; }; export type ProgressiveContainerTreeViewType>> = FieldsView & TreeView>; export type ProgressiveContainerTreeViewDUType>> = FieldsViewDU & TreeViewDU>; type ProgressiveContainerTreeViewTypeConstructor>> = new (type: ProgressiveContainerType, tree: Tree) => ProgressiveContainerTreeViewType; type ProgressiveContainerTreeViewDUTypeConstructor>> = new (type: ProgressiveContainerType, node: Node, cache?: unknown) => ProgressiveContainerTreeViewDUType; type FieldEntry>> = { fieldName: keyof Fields; fieldType: Fields[keyof Fields]; jsonKey: string; gindex: Gindex; chunkIndex: number; }; /** * ProgressiveContainer: ordered heterogeneous collection with EIP-7916 progressive merkleization. * - Serialization is identical to Container over the active fields. * - Hash tree root mixes in the active-fields bitvector from the type definition. */ export declare class ProgressiveContainerType>> extends CompositeType, ProgressiveContainerTreeViewType, ProgressiveContainerTreeViewDUType> { readonly fields: Fields; readonly opts?: ProgressiveContainerOptions | undefined; readonly typeName: string; readonly depth = 2; readonly maxChunkCount: number; readonly fixedSize: number | null; readonly minSize: number; readonly maxSize: number; readonly isList = false; readonly isViewMutable = true; readonly fieldsEntries: FieldEntry[]; readonly activeFields: BitArray; protected readonly fieldsGindex: Record; protected readonly jsonKeyToFieldName: Record; protected readonly isFixedLen: boolean[]; protected readonly fieldRangesFixedLen: BytesRange[]; protected readonly variableOffsetsPosition: number[]; readonly fixedEnd: number; protected readonly TreeView: ProgressiveContainerTreeViewTypeConstructor; protected readonly TreeViewDU: ProgressiveContainerTreeViewDUTypeConstructor; private readonly tempRoot; constructor(fields: Fields, activeFields: BitArray | boolean[], opts?: ProgressiveContainerOptions | undefined); static named>>(fields: Fields, activeFields: BitArray | boolean[], opts: Require, "typeName">): ProgressiveContainerType; defaultValue(): ValueOfFields; getView(tree: Tree): ProgressiveContainerTreeViewType; getViewDU(node: Node, cache?: unknown): ProgressiveContainerTreeViewDUType; cacheOfViewDU(view: ProgressiveContainerTreeViewDUType): unknown; commitView(view: ProgressiveContainerTreeViewType): Node; commitViewDU(view: ProgressiveContainerTreeViewDUType, hcOffset?: number, hcByLevel?: HashComputationLevel[] | null): Node; createFromProof(proof: Proof, root?: Uint8Array): ProgressiveContainerTreeViewType; value_serializedSize(value: ValueOfFields): number; value_serializeToBytes(output: ByteViews, offset: number, value: ValueOfFields): number; value_deserializeFromBytes(data: ByteViews, start: number, end: number, reuseBytes?: boolean): ValueOfFields; tree_serializedSize(node: Node): number; tree_serializeToBytes(output: ByteViews, offset: number, node: Node): number; tree_deserializeFromBytes(data: ByteViews, start: number, end: number): Node; hashTreeRootInto(value: ValueOfFields, output: Uint8Array, offset: number, safeCache?: boolean): void; protected getBlocksBytes(struct: ValueOfFields): Uint8Array; getPropertyGindex(prop: string): Gindex | null; getPropertyType(prop: string): Type; getIndexProperty(index: number): string | null; tree_getLeafGindices(rootGindex: Gindex, rootNode?: Node): Gindex[]; tree_fromProofNode(node: Node): { node: Node; done: boolean; }; fromJson(json: unknown): ValueOfFields; toJson(value: ValueOfFields): Record; clone(value: ValueOfFields): ValueOfFields; equals(a: ValueOfFields, b: ValueOfFields): boolean; getFieldRanges(data: DataView, start: number, end: number): BytesRange[]; } export {};