@atomiqlabs/lp-lib 16.2.1 → 17.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,12 +152,13 @@ class ToBtcAbs extends ToBtcBaseSwapHandler_1.ToBtcBaseSwapHandler {
152
152
  }
153
153
  }
154
154
  async processBtcTx(swap, tx) {
155
- tx.confirmations = tx.confirmations || 0;
155
+ tx.confirmations = tx.confirmations ?? 0;
156
156
  //Check transaction has enough confirmations
157
157
  const hasEnoughConfirmations = tx.confirmations >= swap.requiredConfirmations;
158
- if (!hasEnoughConfirmations) {
158
+ if (!hasEnoughConfirmations || tx.blockhash == null) {
159
159
  return false;
160
160
  }
161
+ const _tx = tx;
161
162
  this.swapLogger.debug(swap, "processBtcTx(): address: " + swap.address + " amount: " + swap.amount.toString(10) + " btcTx: " + tx);
162
163
  //Search for required transaction output (vout)
163
164
  const outputScript = this.bitcoin.toOutputScript(swap.address);
@@ -171,7 +172,7 @@ class ToBtcAbs extends ToBtcBaseSwapHandler_1.ToBtcBaseSwapHandler {
171
172
  }
172
173
  if (swap.metadata != null)
173
174
  swap.metadata.times.payTxConfirmed = Date.now();
174
- const success = await this.tryClaimSwap(tx, swap, vout.n);
175
+ const success = await this.tryClaimSwap(_tx, swap, vout.n);
175
176
  return success;
176
177
  }
177
178
  /**
@@ -48,6 +48,7 @@ export type OpenChannelRequest = {
48
48
  feeRatePPM?: bigint;
49
49
  baseFeeMsat?: bigint;
50
50
  };
51
+ private?: boolean;
51
52
  };
52
53
  export type CloseChannelRequest = {
53
54
  channelId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/lp-lib",
3
- "version": "16.2.1",
3
+ "version": "17.0.1",
4
4
  "description": "Main functionality implementation for atomiq LP node",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "author": "adambor",
23
23
  "license": "ISC",
24
24
  "dependencies": {
25
- "@atomiqlabs/base": "^12.0.0",
25
+ "@atomiqlabs/base": "^13.0.4",
26
26
  "@atomiqlabs/server-base": "^3.0.0",
27
27
  "@scure/btc-signer": "1.6.0",
28
28
  "express": "4.21.1",
@@ -223,13 +223,14 @@ export class ToBtcAbs extends ToBtcBaseSwapHandler<ToBtcSwapAbs, ToBtcSwapState>
223
223
  }
224
224
 
225
225
  protected async processBtcTx(swap: ToBtcSwapAbs, tx: BtcTx): Promise<boolean> {
226
- tx.confirmations = tx.confirmations || 0;
226
+ tx.confirmations = tx.confirmations ?? 0;
227
227
 
228
228
  //Check transaction has enough confirmations
229
229
  const hasEnoughConfirmations = tx.confirmations>=swap.requiredConfirmations;
230
- if(!hasEnoughConfirmations) {
230
+ if(!hasEnoughConfirmations || tx.blockhash==null) {
231
231
  return false;
232
232
  }
233
+ const _tx = tx as BtcTx & {blockhash: string, confirmations: number};
233
234
 
234
235
  this.swapLogger.debug(swap, "processBtcTx(): address: "+swap.address+" amount: "+swap.amount.toString(10)+" btcTx: "+tx);
235
236
 
@@ -246,7 +247,7 @@ export class ToBtcAbs extends ToBtcBaseSwapHandler<ToBtcSwapAbs, ToBtcSwapState>
246
247
 
247
248
  if(swap.metadata!=null) swap.metadata.times.payTxConfirmed = Date.now();
248
249
 
249
- const success = await this.tryClaimSwap(tx, swap, vout.n);
250
+ const success = await this.tryClaimSwap(_tx, swap, vout.n);
250
251
 
251
252
  return success;
252
253
  }
@@ -61,7 +61,8 @@ export type OpenChannelRequest = {
61
61
  channelFees?: {
62
62
  feeRatePPM?: bigint,
63
63
  baseFeeMsat?: bigint
64
- }
64
+ },
65
+ private?: boolean
65
66
  }
66
67
 
67
68
  export type CloseChannelRequest = {