/** * `queries` submodule. Contains logic pertaining to anything that * requires an external node to be queried, including robust queries. */ import { hexstring, P2P } from '@shardeum-foundation/lib-types'; import { ResultAsync } from 'neverthrow'; import { Logger } from 'log4js'; import { JoinRequest } from '@shardeum-foundation/lib-types/build/src/p2p/JoinTypes'; /** A `ResultAsync` that wraps an `UnwrappedRobustResult`. */ export type RobustQueryResultAsync = ResultAsync, Error>; /** A successful RobustQueryResult whose value is an unwrapped `Ok` `Result`. */ type UnwrappedRobustResult = { winningNodes: N[]; value: V; }; type ActiveNode = P2P.SyncTypes.ActiveNode; type Validator = P2P.NodeListTypes.Node; type Archiver = P2P.ArchiversTypes.JoinedArchiver; type CycleRecord = P2P.CycleCreatorTypes.CycleRecord; export declare let p2pLogger: Logger; export declare function initLogger(): void; /** Executes a robust query to retrieve the cycle marker from the network. */ export declare function robustQueryForCycleRecordHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ currentCycleHash: hexstring; }>; /** Executes a robust query to retrieve the validator list hash and next cycle timestamp from the network. */ export declare function robustQueryForValidatorListHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ nodeListHash: hexstring; nextCycleTimestamp: number; }>; /** Executes a robust query to retrieve the archiver list hash from the network. */ export declare function robustQueryForArchiverListHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ archiverListHash: hexstring; }>; /** Executes a robust query to retrieve the standby list hash from the network. */ export declare function robustQueryForStandbyNodeListHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ standbyNodeListHash: hexstring; }>; /** Executes a robust query to retrieve the txList hash from the network. */ export declare function robustQueryForTxListHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ txListHash: hexstring; }>; /** Retrives the cycle by marker from the node. */ export declare function getCycleDataFromNode(node: ActiveNode, expectedMarker: hexstring): ResultAsync; /** Gets the full validator list from the specified node. */ export declare function getValidatorListFromNode(node: ActiveNode, expectedHash: hexstring): ResultAsync; /** Gets the full archiver list from the specified archiver. */ export declare function getArchiverListFromNode(node: ActiveNode, expectedHash: hexstring): ResultAsync; /** Gets the full standby list from the specified standby. */ export declare function getStandbyNodeListFromNode(node: ActiveNode, expectedHash: hexstring): ResultAsync; /** Gets the full tx list from the specified node */ export declare function getTxListFromNode(node: ActiveNode, expectedHash: hexstring): ResultAsync<{ hash: string; tx: P2P.ServiceQueueTypes.AddNetworkTx; }[], Error>; export {};