import Logger from '../Logger'; import BaseClient from '../BaseClient'; import * as boltzrpc from '../proto/boltzrpc_pb'; /** * The configurable options of the Boltz client */ declare type BoltzConfig = { host: string; port: number; certpath: string; }; declare enum ConnectionStatus { Connected = 0, Disconnected = 1 } interface BoltzClient { on(event: 'status.updated', listener: (status: ConnectionStatus) => void): this; emit(event: 'status.updated', status: ConnectionStatus): boolean; on(event: 'transaction.confirmed', listener: (outputAddress: string, transactionHash: string, amountReceived: number) => void): this; emit(event: 'transaction.confirmed', outputAddress: string, transactionHash: string, amountReceived: number): boolean; on(even: 'invoice.paid', listener: (invoice: string, routingFee: number) => void): this; emit(event: 'invoice.paid', invoice: string, routingFee: number): boolean; on(event: 'invoice.failedToPay', listener: (invoice: string) => void): this; emit(event: 'invoice.failedToPay', invoice: string): boolean; on(even: 'invoice.settled', listener: (invoice: string, preimage: string) => void): this; emit(event: 'invoice.settled', invoice: string, preimage: string): boolean; on(event: 'claim', listener: (lockupTransactionHash: string, minerFee: number) => void): this; emit(event: 'claim', lockupTransactionHash: string, minerFee: number): boolean; on(event: 'refund', listener: (lockupTransactionHash: string, minerFee: number) => void): this; emit(event: 'refund', lockupTransactionHash: string, minerFee: number): boolean; on(event: 'channel.backup', listener: (currency: string, channelBackup: string) => void): this; emit(event: 'channel.backup', currency: string, channelBackup: string): boolean; } declare class BoltzClient extends BaseClient { private logger; private uri; private credentials; private boltz; private meta; private channelBackupSubscription?; private claimsSubscription?; private refundsSubscription?; private invoicesSubscription?; private transactionSubscription?; private isReconnecting; constructor(logger: Logger, config: BoltzConfig); /** * Connects to Boltz and subscribes to confirmed transactions and paid invoices afterwards */ connect: () => Promise; /** * Gets general information about this Boltz instance and the nodes it is connected to */ getInfo: () => Promise; /** * Gets the balance for either all wallets or just a single one if specified */ getBalance: (currency?: string | undefined) => Promise; /** * Gets a new address of a specified wallet. The "type" parameter is optional and defaults to "OutputType.LEGACY" */ newAddress: (currency: string, outputType?: boltzrpc.OutputType | undefined) => Promise; /** * Gets a hex encoded transaction from a transaction hash on the specified network */ getTransaction: (currency: string, transactionHash: string) => Promise; /** * Gets a fee estimation in satoshis per vbyte for either all currencies or just a single one if specified */ getFeeEstimation: (currency?: string | undefined, blocks?: number | undefined) => Promise; /** * Broadcasts a hex encoded transaction on the specified network */ broadcastTransaction: (currency: string, transactionHex: string) => Promise; /** * Adds an entry to the list of addresses SubscribeTransactions listens to */ listenOnAddress: (currency: string, address: string) => Promise; /** * Creates a new Swap from the chain to Lightning */ createSwap: (baseCurrency: string, quoteCurrency: string, orderSide: boltzrpc.OrderSide, rate: number, fee: number, invoice: string, refundPublicKey: string, outputType?: boltzrpc.OutputType | undefined) => Promise; /** * Creates a new reverse Swap from Lightning to the chain */ createReverseSwap: (baseCurrency: string, quoteCurrency: string, orderSide: boltzrpc.OrderSide, rate: number, fee: number, claimPublicKey: string, amount: number) => Promise; /** * Subscribes to a stream of confirmed transactions to addresses that were specified with "ListenOnAddress" */ private subscribeTransactions; /** * Subscribes to a stream of settled invoices and those paid by Boltz */ private subscribeInvoices; /** * Subscribes to a stream of swap outputs that Boltz claims */ private subscribeClaims; /** * Subscribes to a stream of lockup transactions that Boltz refunds */ private subscribeRefunds; /** * Subscribes to a stream of channel backups */ private subscribeChannelBackups; private startReconnectTimer; private reconnect; private unaryCall; } export default BoltzClient; export { BoltzConfig, ConnectionStatus };