import { BlockReference } from '@near-js/types'; export declare class BlockQuery { private readonly reference; private constructor(); static fromReference(reference: BlockReference): BlockQuery; toReference(): BlockReference; /** * Query at optimistic block */ static get OPTIMISTIC(): BlockQuery; /** * Query at doomslug final block */ static get DOOMSLUG(): BlockQuery; /** * Query at final block */ static get FINAL(): BlockQuery; /** * Query at earliest available block */ static get EARLIEST(): BlockQuery; /** * Query at genesis block */ static get GENESIS(): BlockQuery; /** * Query at certain block with block height */ static height(height: number): BlockQuery; /** * Query at certain block with block hash */ static hash(hash: string): BlockQuery; /** * Convert block query to that with certain block height. * This is useful when need multiple queries at the same block * * @example * const blockQuery = BlockQuery.FINAL; * * const supply1: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * * // supply2 may not be equal to supply1 because they may be queried at different block * const supply2: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * *@example * const blockQuery = await BlockQuery.FINAL.height(provider); * * const supply1: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * * // supply2 must be equal to supply1 because they are queried at the same block * const supply2: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); */ height(provider: BlockQueryProvider): Promise; /** * Convert block query to that with certain block hash. * This is useful when need multiple queries at the same block * * @example * const blockQuery = BlockQuery.FINAL; * * const supply1: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * * // supply2 may not be equal to supply1 because they may be queried at different block * const supply2: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * *@example * const blockQuery = await BlockQuery.FINAL.hash(provider); * * const supply1: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); * * // supply2 must be equal to supply1 because they are queried at the same block * const supply2: string = await account.view({ * contractId: 'wrap.near', * methodName: 'ft_total_supply', * blockQuery * }); */ hash(provider: BlockQueryProvider): Promise; } export type BlockWithHeader = { header: { height: number; hash: string; }; }; export interface BlockQueryProvider { block(reference: BlockReference): Promise; }