swap logs
This commit is contained in:
parent
23156986b1
commit
070aa758d8
2 changed files with 3 additions and 0 deletions
|
|
@ -369,6 +369,7 @@ export class SubmarineSwaps {
|
|||
}
|
||||
|
||||
SubscribeToInvoiceSwap = (data: InvoiceSwapData, swapDone: (result: { ok: true } | { ok: false, error: string }) => void, waitingTx: () => void) => {
|
||||
this.log("subscribing to invoice swap", { id: data.createdResponse.id })
|
||||
const webSocket = new ws(`${this.wsUrl}/v2/ws`)
|
||||
const subReq = { op: 'subscribe', channel: 'swap.update', args: [data.createdResponse.id] }
|
||||
webSocket.on('open', () => {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ export class Swaps {
|
|||
}
|
||||
|
||||
RefundInvoiceSwap = async (swapOperationId: string, satPerVByte: number, refundAddress: string, currentHeight: number): Promise<{ published: false, txHex: string, txId: string } | { published: true, txId: string }> => {
|
||||
this.log("refunding invoice swap", { swapOperationId, satPerVByte, refundAddress, currentHeight })
|
||||
const swap = await this.storage.paymentStorage.GetRefundableInvoiceSwap(swapOperationId)
|
||||
if (!swap) {
|
||||
throw new Error("Swap not found or already used")
|
||||
|
|
@ -131,6 +132,7 @@ export class Swaps {
|
|||
}
|
||||
|
||||
PayInvoiceSwap = async (appUserId: string, swapOpId: string, satPerVByte: number, payAddress: (address: string, amt: number) => Promise<{ txId: string }>): Promise<void> => {
|
||||
this.log("paying invoice swap", { appUserId, swapOpId, satPerVByte })
|
||||
if (!this.settings.getSettings().swapsSettings.enableSwaps) {
|
||||
throw new Error("Swaps are not enabled")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue