UNPKG

postchain-client

Version:

Client library for accessing a Postchain node through REST.

35 lines (34 loc) 2.22 kB
/// <reference types="node" /> import { Buffer } from "buffer"; import { GTX, RellOperation } from "../gtx/types"; import { BlockInfo, BlockInfoResponse, ClientConfig, Endpoint, KeyPair, NetworkSettings, Operation, SignedTransaction, Transaction, TransactionInfo, TransactionInfoResponse } from "./types"; import { FailOverConfig } from "../restclient/types"; import { FailoverStrategy } from "./enums"; import { NodeManager } from "../restclient/nodeManager"; export declare function getClientConfigFromSettings(settings: NetworkSettings): Promise<ClientConfig>; export declare function validTxRid(txRID: Buffer): boolean; interface NodeDiscoveryProps { nodeManager: NodeManager; directoryEndpointPool: Endpoint[]; failOverConfig?: FailOverConfig; blockchainRid?: string; blockchainIid?: number; } export declare function nodeDiscovery({ nodeManager, directoryEndpointPool, failOverConfig, blockchainRid, blockchainIid, }: NodeDiscoveryProps): Promise<string[]>; export declare function convertToRellOperation(operations: Operation[]): RellOperation[]; export declare function getSerializedGTX(gtx: GTX): Buffer; export declare function getGTXFromBufferOrTransactionOrOperation(transaction: SignedTransaction | Transaction | Operation, blockchainRid: string): GTX; export declare const callbackPromiseBuilder: (reject: any, resolve: any, callback?: any) => (error: Error, result: any) => void; export declare const handlePostResponsePromisified: (error: Error | null, statusCode: number | null, rspBody: any) => Promise<void>; export declare const formatTransactionInfoResponse: (transactionInfoResponse: TransactionInfoResponse) => TransactionInfo; export declare const formatBlockInfoResponse: (blockInfoResponse: BlockInfoResponse) => BlockInfo; export declare const isKeyPair: (keypair: unknown) => keypair is KeyPair; 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 {};