/// import { Blockchain } from "./helpers/blockchain"; import { BroadcastAPI } from "./helpers/broadcast"; import { DatabaseAPI } from "./helpers/database"; import { HivemindAPI } from "./helpers/hivemind"; import { AccountByKeyAPI } from "./helpers/key"; import { RCAPI } from "./helpers/rc"; import { TransactionStatusAPI } from "./helpers/transaction"; /** * Library version. */ export declare const VERSION: string; /** * Main Steem network chain id. */ export declare const DEFAULT_CHAIN_ID: Buffer; /** * Main Steem network address prefix. */ export declare const DEFAULT_ADDRESS_PREFIX = "STM"; /** * RPC Client options * ------------------ */ export interface ClientOptions { /** * Steem chain id. Defaults to main steem network: * need the new id? * `beeab0de00000000000000000000000000000000000000000000000000000000` * */ chainId?: string; /** * Steem address prefix. Defaults to main network: * `STM` */ addressPrefix?: string; /** * Send timeout, how long to wait in milliseconds before giving * up on a rpc call. Note that this is not an exact timeout, * no in-flight requests will be aborted, they will just not * be retried any more past the timeout. * Can be set to 0 to retry forever. Defaults to 60 * 1000 ms. */ timeout?: number; /** * Specifies the amount of times the urls (RPC nodes) should be * iterated and retried in case of timeout errors. * (important) Requires url parameter to be an array (string[])! * Can be set to 0 to iterate and retry forever. Defaults to 3 rounds. */ failoverThreshold?: number; /** * Whether a console.log should be made when RPC failed over to another one */ consoleOnFailover?: boolean; /** * Retry backoff function, returns milliseconds. Default = {@link defaultBackoff}. */ backoff?: (tries: number) => number; /** * Node.js http(s) agent, use if you want http keep-alive. * Defaults to using https.globalAgent. * @see https://nodejs.org/api/http.html#http_new_agent_options. */ agent?: any; /** * Deprecated - don't use */ rebrandedApi?: boolean; } /** * RPC Client * ---------- * Can be used in both node.js and the browser. Also see {@link ClientOptions}. */ export declare class Client { /** * Client options, *read-only*. */ readonly options: ClientOptions; /** * Address to Steem RPC server. * String or String[] *read-only* */ address: string | string[]; /** * Database API helper. */ readonly database: DatabaseAPI; /** * RC API helper. */ readonly rc: RCAPI; /** * Broadcast API helper. */ readonly broadcast: BroadcastAPI; /** * Blockchain helper. */ readonly blockchain: Blockchain; /** * Hivemind helper. */ readonly hivemind: HivemindAPI; /** * Accounts by key API helper. */ readonly keys: AccountByKeyAPI; /** * Transaction status API helper. */ readonly transaction: TransactionStatusAPI; /** * Chain ID for current network. */ readonly chainId: Buffer; /** * Address prefix for current network. */ readonly addressPrefix: string; private timeout; private backoff; private failoverThreshold; private consoleOnFailover; currentAddress: string; /** * @param address The address to the Steem RPC server, * e.g. `https://api.upvu.org`. or [`https://api.steemit.com`, `https://another.api.com`] * @param options Client options. */ constructor(address: string | string[], options?: ClientOptions); /** * Create a new client instance configured for the testnet. */ static testnet(options?: ClientOptions): Client; /** * Make a RPC call to the server. * * @param api The API to call, e.g. `database_api`. * @param method The API method, e.g. `get_dynamic_global_properties`. * @param params Array of parameters to pass to the method, optional. * */ call(api: string, method: string, params?: any): Promise; updateOperations(rebrandedApi: any): void; }