import { Address, BlockHeader, Client, ClientOptions, ControlMessage, ControlMessageStatusCode, Transaction, TransactionMessage } from "./interface"; import { JungleBusSubscription } from "./subscription"; import { SubscriptionErrorContext } from "centrifuge"; import "cross-fetch/polyfill"; /** * JungleBusClient class * * @constructor * @example * const jungleBusClient = new JungleBusClient(, { * protocol: 'protobuf', * }) */ export declare class JungleBusClient { client: Client; constructor(serverUrl: string, options?: ClientOptions); /** * Login to the JungleBus server and get a token * * @param username * @param password * @return error | null */ Login(username: string, password: string): Promise; private getToken; /** * Set the JWT token to use in all calls * * @param token string * @constructor */ SetToken(token: string): string; /** * Get an anonymous token based on a subscription ID to the JungleBus server * * @param subscriptionId * @return error | null */ GetTokenFromSubscription(subscriptionId: string): Promise; /** * Return the last error thrown * * @return Error */ GetLastError(): Error | undefined; /** * Create the connection to the JungleBus server * * @return void */ Connect(): void; /** * Disconnect the client from the server * * @return void */ Disconnect(): void; /** * Subscribe to a channel on the JungleBus server * * @param subscriptionID * @param fromBlock * @param onPublish * @param onStatus * @param onError * @param onMempool * @return JungleBusSubscription */ Subscribe(subscriptionID: string, fromBlock: number, onPublish?: (tx: Transaction) => void, onStatus?: (message: ControlMessage) => void, onError?: (error: SubscriptionErrorContext) => void, onMempool?: (tx: Transaction) => void, liteMode?: boolean): Promise; /** * Get a transaction from the JungleBus API * * @param txId Transaction ID in hex * @return Promise | null */ GetTransaction(txId: string): Promise; /** * Get block header info from JungleBus * * @param block Block header height or hash * @return Promise | null */ GetBlockHeader(block: string | number): Promise; /** * Get a list of block headers from JungleBus * * @param fromBlock Block header height or hash * @param limit Limit the number of results to this number (max 10,000) * @return Promise | null */ GetBlockHeaders(fromBlock: string | number, limit: number): Promise; /** * Get all transaction references for the given address * * @param address Bitcoin address * @return Promise | null */ GetAddressTransactions(address: string): Promise; /** * Get all transactions, including the hex and merkle proof, for the given address * * This function is much slower than GetAddressTransactions * * @param address Bitcoin address * @return Promise | null */ GetAddressTransactionDetails(address: string): Promise; private apiRequest; } export { Client, ClientOptions, ControlMessage, ControlMessageStatusCode, JungleBusSubscription, Transaction, TransactionMessage, };