import type { Bit } from '../types/bit'; import type { Slice } from './slice'; import type { Cell } from './cell'; export interface HashmapOptions { keySize?: number | 'auto'; prefixed?: boolean | 'auto'; nonEmpty?: boolean; serializers?: { key: (key: K) => Bit[]; value: (value: V) => Cell; }; deserializers?: { key: (key: Bit[]) => K; value: (value: Cell) => V; }; } declare type HashmapNode = [key: Bit[], value: Cell]; declare class Hashmap { protected hashmap: Map; protected keySize: number; protected serializeKey: (key: K) => Bit[]; protected serializeValue: (value: V) => Cell; protected deserializeKey: (key: Bit[]) => K; protected deserializeValue: (value: Cell) => V; constructor(keySize: number, options?: HashmapOptions); [Symbol.iterator](): IterableIterator<[K, V]>; get(key: K): V; has(key: K): boolean; set(key: K, value: V): this; add(key: K, value: V): this; replace(key: K, value: V): this; getSet(key: K, value: V): V; getAdd(key: K, value: V): V; getReplace(key: K, value: V): V; delete(key: K): this; isEmpty(): boolean; forEach(callbackfn: (key: K, value: V) => void): void; protected getRaw(key: Bit[]): Cell; protected setRaw(key: Bit[], value: Cell): this; protected sortHashmap(): HashmapNode[]; protected serialize(): Cell; protected static serializeEdge(nodes: HashmapNode[]): Cell; protected static serializeFork(nodes: HashmapNode[]): [HashmapNode[], HashmapNode[]]; protected static serializeLeaf(node: HashmapNode): Cell; protected static serializeLabel(nodes: HashmapNode[]): Bit[]; protected static serializeLabelShort(bits: Bit[]): Bit[]; protected static serializeLabelLong(bits: Bit[], m: number): Bit[]; protected static serializeLabelSame(bits: Bit[], m: number): Bit[]; protected static deserialize(keySize: number, slice: Slice, options?: HashmapOptions): Hashmap; protected static deserializeEdge(edge: Slice, keySize: number, key?: Bit[]): HashmapNode[]; protected static deserializeLabel(edge: Slice, m: number): Bit[]; protected static deserializeLabelShort(edge: Slice): Bit[]; protected static deserializeLabelLong(edge: Slice, m: number): Bit[]; protected static deserializeLabelSame(edge: Slice, m: number): Bit[]; cell(): Cell; static parse(keySize: number, slice: Slice, options?: HashmapOptions): Hashmap; } declare class HashmapE extends Hashmap { constructor(keySize: number, options?: HashmapOptions); protected serialize(): Cell; protected static deserialize(keySize: number, slice: Slice, options?: HashmapOptions): HashmapE; static parse(keySize: number, slice: Slice, options?: HashmapOptions): HashmapE; } export { HashmapE, Hashmap };