import { PrefixedStore, Store, StoreChange } from "../store"; import BTree from "sorted-btree"; import { ABI, Name } from "@greymass/eosio"; import Buffer from "../buffer"; import { Blockchain } from "./blockchain"; declare class KeyValueObject { id: number; tableId: number; primaryKey: bigint; payer: bigint; value: Uint8Array; constructor(args: Partial); clone(): KeyValueObject; } declare class Table extends PrefixedStore { private _code; private _scope; private _table; private payer; private _prefix?; private seq; private _size; static serializePrefix(code: bigint, scope: bigint, table: bigint): Buffer; static bigintToBuffer(v: bigint): Buffer; constructor(store: TableStore, options?: any); get code(): bigint; get scope(): bigint; get table(): bigint; get size(): number; prefix(): Buffer; key(key: bigint): Buffer; lowestKey(): bigint; highestKey(): bigint; parsePrefix(key: Buffer): Uint8Array; set(key: bigint, value: KeyValueObject): void; delete(key: bigint): void; has(key: bigint): boolean; revert(change: StoreChange): void; } declare class IndexObject implements IndexKey { tableId: number; primaryKey: bigint; payer: bigint; secondaryKey: K; constructor(args: Partial>); static compareTable(a: any, b: any): 1 | -1 | 0; static compare(a: any, b: any): number; static comparePrimitives(a: any, b: any): number; static compareBuffer(a: IndexObject, b: IndexObject): number; clone(): IndexObject; } interface IndexPrimaryKey { tableId: number; primaryKey: bigint; } interface IndexKey extends IndexPrimaryKey { secondaryKey: K; ignorePrimaryKey?: boolean; } declare class SecondaryKeyStore { private parent; byPrimary: BTree>; bySecondary: BTree, IndexObject>; constructor(parent: TableStore, comparePrimary: any, compareSecondary: any); get(key: IndexPrimaryKey): IndexObject; set(key: IndexKey | undefined, newKey: IndexObject, isReverting?: boolean): void; delete(key: IndexKey, isReverting?: boolean): void; next(key: IndexPrimaryKey): IndexObject; lowerbound(key: IndexPrimaryKey): IndexObject; upperbound(key: IndexPrimaryKey): IndexObject; secondary: { lowest: any; highest: any; get: (key: IndexKey) => IndexObject; penultimate: (tableId: number) => IndexObject; lowerbound: (key: IndexKey) => IndexObject; upperbound: (key: IndexKey) => IndexObject; prev: (key: IndexKey) => IndexObject; next: (key: IndexKey) => IndexObject; }; } declare class Index64 extends SecondaryKeyStore { constructor(store: TableStore); } declare class Index128 extends SecondaryKeyStore { constructor(store: TableStore); } declare class Index256 extends SecondaryKeyStore { constructor(store: TableStore); } declare class IndexDouble extends SecondaryKeyStore { constructor(store: TableStore); } declare class TableStore extends Store { idx64: Index64; idx128: Index128; idx256: Index256; idxDouble: IndexDouble; constructor(Prefix?: typeof Table); createTable(code: bigint, scope: bigint, table: bigint, payer: bigint): Table; findTable(code: bigint, scope: bigint, table: bigint): Table; getTableById(id: number): Table; } declare class TableView { private tab; private abi; private bc; readonly name: string; readonly type: ABI.Table; constructor(tab: Table, abi: ABI, bc: Blockchain); get(primaryKey: bigint): any; set(primaryKey: bigint, payer: Name, tableData: object): void; getTableRow(primaryKey: bigint): any; getTableRows(lowerBound?: bigint): any; } export { Table, KeyValueObject, IndexObject, SecondaryKeyStore, TableStore, TableView, };