import { hexstring, P2P, publicKey } from '@shardeum-foundation/lib-types';
import { CycleRecord } from '@shardeum-foundation/lib-types/build/src/p2p/CycleCreatorTypes';
import { StateMetaData } from '@shardeum-foundation/lib-types/build/src/p2p/SnapshotTypes';
import { DataRequest, JoinedArchiver } from '@shardeum-foundation/lib-types/build/src/p2p/ArchiversTypes';
import { ActiveNode } from '@shardeum-foundation/lib-types/build/src/p2p/SyncTypes';
import { ResultAsync } from 'neverthrow';
export declare let archivers: Map<P2P.ArchiversTypes.JoinedArchiver['publicKey'], P2P.ArchiversTypes.JoinedArchiver>;
export declare let recipients: Map<P2P.ArchiversTypes.JoinedArchiver['publicKey'], P2P.ArchiversTypes.DataRecipient | any>;
export declare let connectedSockets: {};
export declare const RECEIPT_FORWARD_INTERVAL_MS = 5000;
export declare enum DataRequestTypes {
    SUBSCRIBE = "SUBSCRIBE",
    UNSUBSCRIBE = "UNSUBSCRIBE"
}
export declare let archiverDataSubscriptionsUpdateFeatureActivated: boolean;
/** FUNCTIONS */
/** Accessor Functions */
export declare function getNumArchivers(): number;
export declare function getArchiverWithPublicKey(publicKey: publicKey): P2P.ArchiversTypes.JoinedArchiver | undefined;
export declare function getRandomArchiver(): P2P.ArchiversTypes.JoinedArchiver | null;
/** CycleCreator Functions */
export declare function init(): void;
export declare function reset(): void;
export declare function getTxs(): P2P.ArchiversTypes.Txs;
export declare function validateRecordTypes(rec: P2P.ArchiversTypes.Record): string;
export declare function updateRecord(txs: P2P.ArchiversTypes.Txs, record: P2P.CycleCreatorTypes.CycleRecord): void;
export declare function parseRecord(record: P2P.CycleCreatorTypes.CycleRecord): P2P.CycleParserTypes.Change;
/** Not used by Archivers */
export declare function sendRequests(): void;
/** Not used by Archivers */
export declare function queueRequest(): void;
/** Original Functions */
export declare function resetJoinRequests(): void;
export declare function resetLeaveRequests(): void;
export declare function addArchiverJoinRequest(joinRequest: P2P.ArchiversTypes.Request, tracker?: any, gossip?: boolean): {
    success: boolean;
    reason?: string;
};
export declare function addLeaveRequest(leaveRequest: P2P.ArchiversTypes.Request, tracker?: any, gossip?: boolean): {
    success: boolean;
    reason: string;
} | {
    success: boolean;
    reason?: undefined;
};
export declare function getArchiverUpdates(): P2P.ArchiversTypes.Request[];
export declare function removeArchiverByPublicKey(publicKey: publicKey): void;
export declare function removeArchiver(nodeInfo: JoinedArchiver): void;
export declare function updateArchivers(record: P2P.CycleCreatorTypes.CycleRecord): void;
export declare function addDataRecipient(nodeInfo: P2P.ArchiversTypes.JoinedArchiver, dataRequests: {
    dataRequestCycle?: number;
} | DataRequest<CycleRecord | StateMetaData>[], overrideLastSentCycle?: number): void;
export declare function getArchiversList(): P2P.ArchiversTypes.JoinedArchiver[];
export declare function instantForwardReceipts(receipts: any): Promise<void>;
export declare function instantForwardOriginalTxData(originalTxData: any): Promise<void>;
export interface InitialAccountsData {
    accounts: any[];
    receipts: any[];
}
export declare function forwardAccounts(data: InitialAccountsData): Promise<void>;
export declare function removeDataRecipient(publicKey: any): void;
export declare function sendData(): void;
export declare function getRefreshedArchivers(record: any): P2P.ArchiversTypes.JoinedArchiver[];
export declare function addArchiverConnection(publicKey: any, socketId: any): void;
export declare function removeArchiverConnection(publicKey: any): void;
export declare function registerRoutes(): void;
export declare function sortedByPubKey(): P2P.ArchiversTypes.JoinedArchiver[];
/** Calculates and returns a hash based on the list of archivers, sorted by public key. This will also update the recorded `lastHashedList` of nodes, which can be retrieved via `getLastHashedArchiverList`. */
export declare function computeNewArchiverListHash(): hexstring;
/**
 * Returns the archiver list hash from the last complete cycle, if available. If you
 * want to compute a new hash instead, use `computeNewArchiverListHash`.
 */
export declare function getArchiverListHash(): hexstring | undefined;
/** Returns the last list of archivers that had its hash computed. */
export declare function getLastHashedArchiverList(): P2P.ArchiversTypes.JoinedArchiver[];
/**
 * A utility function that performs an HTTP GET request to an archiver. If
 * there is an error, it will handle scheduling a lost archiver report and
 * return undefined.
 */
export declare function getFromArchiver<R>(archiver: ActiveNode, endpoint: string, failureReportMessage?: string, timeout?: number): ResultAsync<R, Error>;
/**
 * A utility function that performs an HTTP POST request to an archiver. If
 * there is an error, it will handle scheduling a lost archiver report and
 * return undefined.
 */
export declare function postToArchiver<B, R>(archiver: ActiveNode, endpoint: string, body?: B, timeout?: number, failureReportMessage?: string): ResultAsync<R, Error>;
