///
import { EventEmitter } from 'events';
import Logger from '../Logger';
import Swap from '../db/models/Swap';
import SwapRepository from './SwapRepository';
import BoltzClient from '../boltz/BoltzClient';
import ReverseSwap from '../db/models/ReverseSwap';
import ReverseSwapRepository from './ReverseSwapRepository';
import { ServiceWarning } from '../consts/Enums';
import { SwapUpdate, CurrencyConfig, PairConfig } from '../consts/Types';
interface Service {
on(event: 'swap.update', listener: (id: string, message: SwapUpdate) => void): this;
emit(event: 'swap.update', id: string, message: SwapUpdate): boolean;
on(event: 'swap.successful', listener: (swap: Swap | ReverseSwap) => void): this;
emit(event: 'swap.successful', swap: Swap | ReverseSwap): boolean;
on(event: 'swap.failed', listener: (swap: Swap | ReverseSwap, reason: string) => void): this;
emit(event: 'swap.failed', swap: Swap | ReverseSwap, reason: string): boolean;
}
declare class Service extends EventEmitter {
private logger;
private boltz;
allowReverseSwaps: boolean;
swapRepository: SwapRepository;
reverseSwapRepository: ReverseSwapRepository;
private pairRepository;
private feeProvider;
private rateProvider;
private pairs;
constructor(logger: Logger, boltz: BoltzClient, rateInterval: number, currencies: CurrencyConfig[]);
init: (pairs: PairConfig[]) => Promise;
/**
* Gets all supported pairs and their conversion rates
*/
getPairs: () => {
warnings: ServiceWarning[];
pairs: any;
};
/**
* Gets the fee estimation for all supported currencies
*/
getFeeEstimation: () => Promise;
/**
* Gets a hex encoded transaction from a transaction hash on the specified network
*/
getTransaction: (currency: string, transactionHash: string) => Promise;
/**
* Broadcasts a hex encoded transaction on the specified network
*/
broadcastTransaction: (currency: string, transactionHex: string) => Promise;
/**
* Creates a new Swap from the chain to Lightning
*/
createSwap: (pairId: string, orderSide: string, invoice: string, refundPublicKey: string) => Promise<{
id: string;
address: string;
redeemScript: string;
expectedAmount: number;
timeoutBlockHeight: number;
bip21: string;
}>;
/**
* Creates a new reverse Swap from Lightning to the chain
*/
createReverseSwap: (pairId: string, orderSide: string, claimPublicKey: string, amount: number) => Promise<{
id: string;
invoice: string;
redeemScript: string;
lockupTransaction: string;
lockupTransactionHash: string;
}>;
/**
* Gets the base and quote asset and the rate of a currency
*/
private getPair;
/**
* Verfies that the requested amount is neither above the maximal nor beneath the minimal
*/
private verifyAmount;
/**
* Gets the corresponding OrderSide enum of a string
*/
private getOrderSide;
private listenTransactions;
private listenInvoices;
private listenClaims;
private listenRefunds;
private updateSwapStatus;
}
export default Service;
export { PairConfig };