import { AppHeader } from '@shardeum-foundation/lib-net/build/src/types'; import { P2P } from '@shardeum-foundation/lib-types'; import { ShardusTypes } from '../shardus'; import { InternalBinaryHandler } from '../types/Handler'; import { VectorBufferStream } from '../utils/serialization/VectorBufferStream'; import * as Shardus from '../shardus/shardus-types'; /** FUNCTIONS */ export declare function setAcceptInternal(enabled: boolean): void; export declare function init(): void; export declare function tell(nodes: ShardusTypes.Node[] | ShardusTypes.NodeWithRank[], route: any, message: any, logged?: boolean, tracker?: string, subRoute?: string): Promise; export declare function tellBinary(nodes: ShardusTypes.Node[] | ShardusTypes.NodeWithRank[], route: string, message: TReq, serializerFunc: (stream: VectorBufferStream, obj: TReq, root?: boolean) => void, appHeader: AppHeader, logged?: boolean, tracker?: string): Promise; export declare function ask(node: ShardusTypes.Node, route: string, message?: {}, logged?: boolean, tracker?: string, extraTime?: number): Promise; export declare function askBinary(node: ShardusTypes.Node, route: string, message: TReq, reqSerializerFunc: (stream: VectorBufferStream, obj: TReq, root?: boolean) => void, respDeserializerFunc: (stream: VectorBufferStream, root?: boolean) => TResp, appHeader: AppHeader, tracker?: string, logged?: boolean, extraTime?: number): Promise; export declare function evictCachedSockets(nodes: ShardusTypes.Node[]): void; export declare function registerInternal(route: any, handler: any): void; export declare function registerInternalBinary(route: string, handler: InternalBinaryHandler): void; export declare function unregisterInternal(route: any): void; export declare function isNodeValidForInternalMessage(node: P2P.NodeListTypes.Node, debugMsg: string, checkForNodeDown?: boolean, checkForNodeLost?: boolean, checkIsUpRecent?: boolean, checkNodesRotationBounds?: boolean, txId?: string): boolean; /** * Are we in a mode that should be doing additional "validNode" checks * before sending an outgoing message * @returns */ export declare function modeAllowsValidNodeChecks(): boolean; /** * Send Gossip to all nodes, using gossip in */ export declare function sendGossip(type: string, payload: any, tracker?: string, sender?: any, inpNodes?: Shardus.Node[] | Shardus.NodeWithRank[], // Joining nodes need gossip too; we don't isOrigin?: boolean, factor?: number, txId?: string, context?: string, commonOrigin?: boolean): Promise; export declare function sendGossipAll(type: string, payload: any, tracker?: string, sender?: any, inpNodes?: P2P.NodeListTypes.Node[]): Promise; /** * Handle Goosip Transactions * Payload: {type: ['receipt', 'trustedTransaction'], data: {}} */ export declare function handleGossip(payload: any, sender: any, tracker?: string, msgSize?: number): Promise; /** * Callback for handling gossip. * * @callback handleGossipCallback * @param {any} data the data response of the callback * @param {Node} sender * @param {string} tracker the tracking string */ /** * @param {string} type * @param {handleGossipCallback} handler */ export declare function registerGossipHandler(type: any, handler: any): void; export declare function unregisterGossipHandler(type: any): void;