import { ExposedPromise } from '@tezos-x/octez.connect-utils'; import { ConnectionContext, TransportType, TransportStatus, BeaconBaseMessage, AccountInfo, PeerInfo, AppMetadata, BeaconRequestMessage, BeaconMessageWrapper, NodeDistributions, Blockchain } from '@tezos-x/octez.connect-types'; import { BeaconClient } from '../beacon-client/BeaconClient'; import { AccountManager } from '../../managers/AccountManager'; import { ClientOptions } from './ClientOptions'; import { Transport } from '../../transports/Transport'; /** * @internalapi * * This abstract class handles the a big part of the logic that is shared between the dapp and wallet client. * For example, it selects and manages the transport and accounts. */ export declare abstract class Client extends BeaconClient { protected readonly accountManager: AccountManager; protected readonly blockchains: Map; protected handleResponse: (_event: BeaconRequestMessage | BeaconMessageWrapper, connectionInfo: ConnectionContext) => void; /** * How many requests can be sent after another */ protected readonly rateLimit: number; /** * The time window in seconds in which the "rateLimit" is checked */ protected readonly rateLimitWindowInSeconds: number; /** * Stores the times when requests have been made to determine if the rate limit has been reached */ protected requestCounter: number[]; protected readonly matrixNodes: NodeDistributions; private transportListeners; protected _transport: ExposedPromise>; protected get transport(): Promise>; /** * Returns the connection status of the Client */ get connectionStatus(): TransportStatus; /** * Returns whether or not the transaport is ready */ get ready(): Promise; constructor(config: ClientOptions); protected cleanup(): Promise; /** * Register a blockchain to the client * @param chain The blockchain to register */ addBlockchain(chain: Blockchain): void; /** * Remove a blockchain from the client by its identifier * @param chainIdentifier The identifier of the blockchain to remove */ removeBlockchain(chainIdentifier: string): void; /** * Return all locally known accounts */ getAccounts(): Promise; /** * Return the account by ID * @param accountIdentifier The ID of an account */ getAccount(accountIdentifier: string): Promise; /** * Remove the account by ID * @param accountIdentifier The ID of an account */ removeAccount(accountIdentifier: string): Promise; /** * Remove all locally stored accounts */ removeAllAccounts(): Promise; /** * Add a new request (current timestamp) to the pending requests, remove old ones and check if we are above the limit */ addRequestAndCheckIfRateLimited(): Promise; /** * This method initializes the client. It will check if the connection should be established to a * browser extension or if the P2P transport should be used. * * @param transport A transport that can be provided by the user */ init(transport: Transport): Promise; /** * Returns the metadata of this DApp */ getOwnAppMetadata(): Promise; /** * Return all known peers */ getPeers(): Promise; /** * Add a new peer to the known peers * @param peer The new peer to add */ addPeer(peer: PeerInfo): Promise; destroy(): Promise; /** * A "setter" for when the transport needs to be changed. */ protected setTransport(transport?: Transport): Promise; protected addListener(transport: Transport): Promise; protected sendDisconnectToPeer(peer: PeerInfo, transport?: Transport): Promise; protected findPeer(publicKey?: string): Promise; private getLocalProtocolVersion; private extractPeerProtocolVersion; protected getPeerProtocolVersion(peer?: PeerInfo): number; }