import { default as Long } from 'long'; /** * Mapping of TL object IDs to reader functions. * * Note that these types should never be present in the map * and are parsed manually inside `.object()`: * - `0x1cb5c415` aka `vector` * - `0x3072cfa1` aka `gzip_packed` * - `0xbc799737` aka `boolFalse` * - `0x997275b5` aka `boolTrue` * - `0x3fedd339` aka `true` * - `0x56730bcc` aka `null` */ export type TlReaderMap = Record unknown> & { _results?: Record unknown>; }; export declare class TlUnknownObjectError extends Error { readonly objectId: number; constructor(objectId: number); } /** * Reader for TL objects. */ export declare class TlBinaryReader { readonly objectsMap: TlReaderMap | undefined; readonly dataView: DataView; readonly uint8View: Uint8Array; pos: number; _objectMapper?: (obj: any) => any; /** * @param objectsMap Readers map * @param data Buffer to read from * @param start Position to start reading from */ constructor(objectsMap: TlReaderMap | undefined, data: ArrayBuffer | ArrayBufferView, start?: number); /** * Create a new reader without objects map for manual usage * * @param data Buffer to read from * @param start Position to start reading from */ static manual(data: ArrayBuffer | ArrayBufferView, start?: number): TlBinaryReader; /** * Deserialize a single object * * @param objectsMap Readers map * @param data Buffer to read from * @param start Position to start reading from */ static deserializeObject(objectsMap: TlReaderMap, data: Uint8Array, start?: number): T; int(): number; uint(): number; /** * Get the next {@link uint} without advancing the reader cursor */ peekUint(): number; int53(): number; long(unsigned?: boolean): Long; float(): number; double(): number; boolean(): boolean; /** * Read raw bytes of the given length * @param bytes Length of the buffer to read */ raw(bytes?: number): Uint8Array; int128(): Uint8Array; int256(): Uint8Array; bytes(): Uint8Array; string(): string; object(id?: number): unknown; vector(reader?: (id?: number) => unknown, bare?: boolean): unknown[]; /** * Advance the reader cursor by the given amount of bytes * * @param delta Amount of bytes to advance (can be negative) */ seek(delta: number): void; /** * Seek to the given position * * @param pos Position to seek to */ seekTo(pos: number): void; }