import { Operation, Server } from "xdb-digitalbits-sdk"; import { Account, AccountDetails, Collection, CollectionParams, Offer, Payment, Trade, WatcherParams, WatcherResponse } from "../types"; export interface DataProviderParams { serverUrl: string; accountOrKey: Account | string; networkPassphrase: string; metadata?: { allowHttp?: boolean; appName?: string; appVersion?: string; }; } export declare class DataProvider { private accountKey; private serverUrl; private server; private networkPassphrase; private _watcherTimeouts; private effectStreamEnder?; private callbacks; private errorHandlers; constructor(params: DataProviderParams); /** * Return true if the key is valid. (It doesn't comment on whether the * key is a funded account.) */ isValidKey(): boolean; /** * Return the current key. */ getAccountKey(): string; /** * Return the server object, in case the consumer wants to call an * unsupported function. */ getServer(): Server; /** * Check if the current account is funded or not. */ isAccountFunded(): Promise; /** * Fetch outstanding offers. */ fetchOpenOffers(params?: CollectionParams): Promise>; /** * Fetch recent trades. */ fetchTrades(params?: CollectionParams): Promise>; /** * Fetch payments (also includes path payments account creation). */ fetchPayments(params?: CollectionParams): Promise>; /** * Fetch account details (balances, signers, etc.). */ fetchAccountDetails(): Promise; /** * Fetch account details, then re-fetch whenever the details update. * If the account doesn't exist yet, it will re-check it every 2 seconds. * Returns a function you can execute to stop the watcher. */ watchAccountDetails(params: WatcherParams): WatcherResponse; /** * Fetch payments, then re-fetch whenever the details update. * Returns a function you can execute to stop the watcher. */ watchPayments(params: WatcherParams): WatcherResponse; /** * Given a destination key, return a transaction that removes all trustlines * and offers on the tracked account and merges the account into a given one. * * @throws Throws if the account has balances. * @throws Throws if the destination account is invalid. */ getStripAndMergeAccountTransaction(destinationKey: string): Promise, Operation[]>>; /** * Stop acount details watcher. */ private stopWatchAccountDetails; /** * Stop payments watcher. */ private stopWatchPayments; private _processOpenOffers; private _processTrades; private _processPayments; private _startEffectWatcher; }