import { Client } from '@airgap/beacon-core'; import { ExposedPromise } from '@airgap/beacon-utils'; import { ConnectionContext, ExtendedP2PPairingResponse, PeerInfo, TransportType, BeaconRequestOutputMessage, BeaconResponseInputMessage, AppMetadata, PermissionInfo, PushToken } from '@airgap/beacon-types'; import { WalletClientOptions } from './WalletClientOptions'; /** * @publicapi * * The WalletClient has to be used in the wallet. It handles all the logic related to connecting to beacon-compatible * dapps and handling/responding to requests. * * @category Wallet */ export declare class WalletClient extends Client { /** * Returns whether or not the transport is connected */ protected readonly _isConnected: ExposedPromise; get isConnected(): Promise; private readonly permissionManager; private readonly appMetadataManager; /** * This array stores pending requests, meaning requests we received and have not yet handled / sent a response. */ private pendingRequests; constructor(config: WalletClientOptions); init(): Promise; /** * This method initiates a connection to the P2P network and registers a callback that will be called * whenever a message is received. * * @param newMessageCallback The callback that will be invoked for every message the transport receives. */ connect(newMessageCallback: (message: BeaconRequestOutputMessage, connectionContext: ConnectionContext) => void): Promise; getRegisterPushChallenge(backendUrl: string, accountPublicKey: string, oracleUrl?: string): Promise<{ challenge: { id: string; timestamp: string; }; payloadToSign: string; }>; registerPush(challenge: { id: string; timestamp: string; }, signature: string, backendUrl: string, accountPublicKey: string, protocolIdentifier: string, deviceId: string, oracleUrl?: string): Promise; /** * The method will attempt to initiate a connection using the active transport. */ _connect(attempts?: number): Promise; /** * This method sends a response for a specific request back to the DApp * * @param message The BeaconResponseMessage that will be sent back to the DApp */ respond(message: BeaconResponseInputMessage): Promise; getAppMetadataList(): Promise; getAppMetadata(senderId: string): Promise; removeAppMetadata(senderId: string): Promise; removeAllAppMetadata(): Promise; getPermissions(): Promise; getPermission(accountIdentifier: string): Promise; removePermission(accountIdentifier: string, senderId: string): Promise; removeAllPermissions(): Promise; private getPeerInfo; /** * Add a new peer to the known peers * @param peer The new peer to add */ addPeer(peer: PeerInfo, sendPairingResponse?: boolean): Promise; removePeer(peer: ExtendedP2PPairingResponse, sendDisconnectToPeer?: boolean): Promise; removeAllPeers(sendDisconnectToPeers?: boolean): Promise; private removePermissionsForPeers; /** * Send an acknowledge message back to the sender * * @param message The message that was received */ private sendAcknowledgeResponse; /** * An internal method to send a BeaconMessage to the DApp * * @param response Send a message back to the DApp */ private respondToMessage; private disconnect; }