import { Node, Tree } from "@chainsafe/persistent-merkle-tree"; import { ValueOf } from "../type/abstract.ts"; import { CompositeType, CompositeView, CompositeViewDU } from "../type/composite.ts"; import { TreeView } from "./abstract.ts"; import { ArrayType } from "./arrayBasic.ts"; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ArrayCompositeType, CompositeViewDU>> = CompositeType[], unknown, unknown> & ArrayType & { readonly elementType: ElementType; readonly chunkDepth: number; }; export declare class ArrayCompositeTreeView, CompositeView, CompositeViewDU>> extends TreeView> { readonly type: ArrayCompositeType; protected tree: Tree; constructor(type: ArrayCompositeType, tree: Tree); /** * Number of elements in the array. Equal to the Uint32 value of the Tree's length node */ get length(): number; /** * Returns the View's Tree rootNode */ get node(): Node; /** * Get element at `index`. Returns a view of the Composite element type */ get(index: number): CompositeView; /** * Get element at `index`. Returns a view of the Composite element type. * DOES NOT PROPAGATE CHANGES: use only for reads and to skip parent references. */ getReadonly(index: number): CompositeView; /** * Set Composite element type `view` at `index` */ set(index: number, view: CompositeView): void; /** * Returns an array of views of all elements in the array, from index zero to `this.length - 1`. * The returned views don't have a parent hook to this View's Tree, so changes in the returned views won't be * propagated upwards. To get linked element Views use `this.get()` * @param views optional output parameter, if is provided it must be an array of the same length as this array */ getAllReadonly(views?: CompositeView[]): CompositeView[]; /** * Returns an array of values of all elements in the array, from index zero to `this.length - 1`. * The returned values are not Views so any changes won't be propagated upwards. * To get linked element Views use `this.get()` * @param values optional output parameter, if is provided it must be an array of the same length as this array */ getAllReadonlyValues(values?: ValueOf[]): ValueOf[]; }