import { Buffer } from "buffer"; import { Web3PromiEvent } from "../promiEvent/promiEvents"; import { GTX, RellOperation } from "../gtx/types"; import { BlockInfo, BlockInfoResponse, ClientConfig, Endpoint, KeyPair, NetworkSettings, Operation, SignedTransaction, Transaction, TransactionInfo, TransactionInfoResponse, TransactionStatusReponse, ClusterAnchoringConfirmation, TransactionReceipt, BufferId, AnchoringClientAndSystemBrid, StatusPolling, FailOverConfig, ClientCallback, RejectedTransactionResponse, RejectedTransaction } from "./types"; import { AnchoringStatus, ChainConfirmationLevel, FailoverStrategy } from "./enums"; import { NodeManager } from "./nodeManager"; import { IClient } from "./interface"; import { AnchoringTransaction } from "../ICCF/types"; import { RawGtv } from "../gtv/types"; import { Web3EventMap } from "../promiEvent/promiEventEmitter"; export declare function getClientConfigFromSettings(settings: NetworkSettings): Promise; export declare function getMerkleHashVersionFromDapp(config: ClientConfig): Promise; export declare function validTxRid(txRID: Buffer): boolean; interface NodeDiscoveryProps { nodeManager: NodeManager; directoryEndpointPool: Endpoint[]; blockedNodeUrlSubstrings?: string[]; nodeUrlFilter?: (url: string) => boolean; connectTimeout?: number; responseTimeout?: number; failOverConfig?: FailOverConfig; blockchainRid?: string; blockchainIid?: number; } export declare function nodeDiscovery({ nodeManager, directoryEndpointPool, blockedNodeUrlSubstrings, nodeUrlFilter, failOverConfig, blockchainRid, blockchainIid, connectTimeout, responseTimeout, }: NodeDiscoveryProps): Promise; export declare function getBlockchainApiUrls(directoryClient: IClient, blockchainRid: Buffer): Promise; export declare function convertToRellOperation(operations: Operation[]): RellOperation[]; export declare function getSerializedGTX(gtx: GTX): Buffer; export declare function getGTXFromBufferOrTransactionOrOperation(transaction: SignedTransaction | Transaction | Operation, blockchainRid: BufferId): GTX; export declare const callbackPromiseBuilder: (reject: (reason?: Error | null) => void, resolve: (value: T | PromiseLike) => void, callback?: (error: Error | null, result: U | null) => void) => ClientCallback; export declare const handlePostResponsePromisified: (error: Error | null, statusCode: number | null, rspBody: RawGtv | null | undefined) => Promise; export declare const formatTransactionInfoResponse: (transactionInfoResponse: TransactionInfoResponse) => TransactionInfo; export declare const formatBlockInfoResponse: (blockInfoResponse: BlockInfoResponse) => BlockInfo; export declare function formatRejectedTransactionFromResponse(rejectedTransactionResponse: RejectedTransactionResponse): RejectedTransaction; export declare const isKeyPair: (keypair: unknown) => keypair is KeyPair; export declare function getSystemClient(directoryNodeUrlPool: string[], directoryChainRid: string): Promise; export declare function getSystemAnchoringChain(directoryClient: IClient): Promise; export declare const defaultFailoverConfig: { strategy: FailoverStrategy.AbortOnError; attemptsPerEndpoint: number; attemptInterval: number; unreachableDuration: number; }; export declare const createEndpointObjects: (endpointPoolUrls: readonly string[]) => Endpoint[]; export declare const getUrlsFromEndpoints: (endpointPool: Endpoint[]) => string[]; export declare function awaitDappConfirmation(txRID: Buffer, dappStatusPolling: StatusPolling, getTransactionStatus: (txRID: Buffer) => Promise): Promise; export declare function awaitClusterAnchoringChainConfirmation(txRID: Buffer, clusterAnchoringStatusPolling: StatusPolling, getClusterAnchoringTransactionConfirmation: (txRID: Buffer) => Promise): Promise; export declare function handleDappConfirmations(transactionRid: Buffer, doStatusPolling: boolean, confirmationLevel: ChainConfirmationLevel, promiEvent: Web3PromiEvent, dappStatusPolling: StatusPolling, getTransactionStatus: () => Promise, client: IClient): Promise; export declare function handleSystemConfirmations(transactionReceipt: TransactionReceipt, confirmationLevel: ChainConfirmationLevel, promiEvent: Web3PromiEvent, statusPollingConfig: { dappStatusPolling: StatusPolling; clusterAnchoringStatusPolling: StatusPolling; systemAnchoringStatusPolling: StatusPolling; }, anchoringClient: IClient, systemAnchoringChainBrid: string, getClusterAnchoringTransactionConfirmation: () => Promise, getSystemAnchoringTransactionConfirmation: (anchoredTxRid: Buffer, anchoringClient: IClient, systemAnchoringChainBrid: string) => Promise): Promise; export declare function getAnchoringClientAndSystemChainRid(client: IClient): Promise; export declare function getSystemAnchoringTransaction(dappClientEndpointPool: Endpoint[], anchoredTxRid: BufferId, anchoringClient: IClient, systemAnchoringChainRid: string, systemAnchoringStatusPolling: StatusPolling, merkleHashVersion: number): Promise; /** * Should be used to configure the `IClient` `ClientConfig` (config) properties * `dappStatusPolling`, `clusterAnchoringStatusPolling` and `systemAnchoringStatusPolling` with * the corresponding status polling configuration `interval` and `status`. * If the values are not provided, they do default to `500` for `interval` and `20` for `count` * * @param statusPolling - An optional partial configuration object, that can set the status polling interval and count properties * @returns - Returns a complete `StatusPolling` configuration object, with default values for any missing properties * of the provided partial configuration */ export declare function setStatusPolling(statusPolling?: Partial): StatusPolling; export declare function setRetryTransactionPolling(statusPolling?: Partial): StatusPolling; export declare function linkPromiEvents(event1: Web3PromiEvent, event2: Web3PromiEvent): void; /** * @param error response error * @param statusCode response status code * @param responseObject the responsebody from the server * @param callback the callback function to propagate the error and response back to the caller */ export declare function handleGetResponse(error: Error | null | undefined, statusCode: number | null, responseObject: RawGtv | null | undefined, callback: ClientCallback): void; /** * @param error response error * @param statusCode response status code * @param responseObject the responsebody from the server * @param callback the callback function to propagate the error and response back to the caller */ export declare function handlePostResponse(error: Error | null | undefined, statusCode: number | null, responseObject: RawGtv | null | undefined, callback: ClientCallback): void; interface BlockchainRidFromIidPops { endpointPool: Endpoint[]; chainId: number; nodeManager: NodeManager; connectTimeout?: number; responseTimeout?: number; failOverConfig?: FailOverConfig; merkleHashVersion?: number; } export declare function getBlockchainRidFromIid({ endpointPool, chainId, failOverConfig, nodeManager, connectTimeout, responseTimeout, }: BlockchainRidFromIidPops): Promise; export declare const sleep: (ms: number) => Promise; export declare function convertToPrintable(responseObject: unknown): string; export {};