@arkade-os/boltz-swap 0.3.46 → 0.3.48

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.
@@ -1,5 +1,5 @@
1
1
  import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
2
- import { r as BoltzSwapProvider, y as SwapManager, m as SwapRepository, q as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, j as ArkToBtcResponse, a as BoltzChainSwap, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, F as FeesResponse, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-CS62-oEy.cjs';
2
+ import { r as BoltzSwapProvider, y as SwapManager, m as SwapRepository, q as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, j as ArkToBtcResponse, a as BoltzChainSwap, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, F as FeesResponse, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-BKEkNZxK.js';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
 
5
5
  /**
@@ -313,6 +313,9 @@ declare class ArkadeSwaps {
313
313
  }>;
314
314
  /**
315
315
  * Claim sats on BTC chain by claiming the HTLC.
316
+ *
317
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
318
+ *
316
319
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
317
320
  * @returns The BTC transaction ID of the claim.
318
321
  */
@@ -1,5 +1,5 @@
1
1
  import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
2
- import { r as BoltzSwapProvider, y as SwapManager, m as SwapRepository, q as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, j as ArkToBtcResponse, a as BoltzChainSwap, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, F as FeesResponse, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-CS62-oEy.js';
2
+ import { r as BoltzSwapProvider, y as SwapManager, m as SwapRepository, q as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, j as ArkToBtcResponse, a as BoltzChainSwap, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, F as FeesResponse, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-BKEkNZxK.cjs';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
 
5
5
  /**
@@ -313,6 +313,9 @@ declare class ArkadeSwaps {
313
313
  }>;
314
314
  /**
315
315
  * Claim sats on BTC chain by claiming the HTLC.
316
+ *
317
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
318
+ *
316
319
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
317
320
  * @returns The BTC transaction ID of the claim.
318
321
  */
@@ -7,7 +7,7 @@ import {
7
7
  isSubmarineFinalStatus,
8
8
  isSubmarineSwapRefundable,
9
9
  logger
10
- } from "./chunk-GXO2EB6C.js";
10
+ } from "./chunk-VKHFXGKL.js";
11
11
 
12
12
  // src/expo/swapsPollProcessor.ts
13
13
  var SWAP_POLL_TASK_TYPE = "swap-poll";
@@ -1001,6 +1001,9 @@ var decodeInvoice = (invoice) => {
1001
1001
  const millisats = BigInt(decoded.sections.find((s) => s.name === "amount")?.value ?? "0");
1002
1002
  return {
1003
1003
  expiry: decoded.expiry ?? 3600,
1004
+ // The timestamp fallback to 0 is just to satisfy the type checker.
1005
+ // In practice, the timestamp is always present in well-formatted BOLT11 invoices.
1006
+ timestamp: decoded.sections.find((s) => s.name === "timestamp")?.value ?? 0,
1004
1007
  amountSats: Number(millisats / 1000n),
1005
1008
  description: decoded.sections.find((s) => s.name === "description")?.value ?? "",
1006
1009
  // description_hash (BOLT11 `h`) is missing from light-bolt11-decoder's
@@ -2723,8 +2726,8 @@ var constructClaimTransaction = (utxo, destinationScript, fee) => {
2723
2726
  return tx;
2724
2727
  };
2725
2728
  var targetFee = (satPerVbyte, constructTx) => {
2726
- const tx = constructTx(BigInt(1));
2727
- return constructTx(BigInt(Math.ceil((tx.vsize + tx.inputsLength) * satPerVbyte)));
2729
+ const probe = constructTx(BigInt(1));
2730
+ return constructTx(BigInt(Math.ceil(probe.vsize * satPerVbyte)));
2728
2731
  };
2729
2732
 
2730
2733
  // src/utils/restoration.ts
@@ -3429,6 +3432,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
3429
3432
  return {
3430
3433
  amount: pendingSwap.response.onchainAmount,
3431
3434
  expiry: decodedInvoice.expiry,
3435
+ timestamp: decodedInvoice.timestamp,
3432
3436
  invoice: pendingSwap.response.invoice,
3433
3437
  paymentHash: decodedInvoice.paymentHash,
3434
3438
  pendingSwap,
@@ -4396,6 +4400,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
4396
4400
  }
4397
4401
  /**
4398
4402
  * Claim sats on BTC chain by claiming the HTLC.
4403
+ *
4404
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
4405
+ *
4399
4406
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
4400
4407
  * @returns The BTC transaction ID of the claim.
4401
4408
  */
@@ -1306,8 +1306,8 @@ var constructClaimTransaction = (utxo, destinationScript, fee) => {
1306
1306
  return tx;
1307
1307
  };
1308
1308
  var targetFee = (satPerVbyte, constructTx) => {
1309
- const tx = constructTx(BigInt(1));
1310
- return constructTx(BigInt(Math.ceil((tx.vsize + tx.inputsLength) * satPerVbyte)));
1309
+ const probe = constructTx(BigInt(1));
1310
+ return constructTx(BigInt(Math.ceil(probe.vsize * satPerVbyte)));
1311
1311
  };
1312
1312
 
1313
1313
  // src/utils/decoding.ts
@@ -1318,6 +1318,9 @@ var decodeInvoice = (invoice) => {
1318
1318
  const millisats = BigInt(decoded.sections.find((s) => s.name === "amount")?.value ?? "0");
1319
1319
  return {
1320
1320
  expiry: decoded.expiry ?? 3600,
1321
+ // The timestamp fallback to 0 is just to satisfy the type checker.
1322
+ // In practice, the timestamp is always present in well-formatted BOLT11 invoices.
1323
+ timestamp: decoded.sections.find((s) => s.name === "timestamp")?.value ?? 0,
1321
1324
  amountSats: Number(millisats / 1000n),
1322
1325
  description: decoded.sections.find((s) => s.name === "description")?.value ?? "",
1323
1326
  // description_hash (BOLT11 `h`) is missing from light-bolt11-decoder's
@@ -3370,6 +3373,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
3370
3373
  return {
3371
3374
  amount: pendingSwap.response.onchainAmount,
3372
3375
  expiry: decodedInvoice.expiry,
3376
+ timestamp: decodedInvoice.timestamp,
3373
3377
  invoice: pendingSwap.response.invoice,
3374
3378
  paymentHash: decodedInvoice.paymentHash,
3375
3379
  pendingSwap,
@@ -4337,6 +4341,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
4337
4341
  }
4338
4342
  /**
4339
4343
  * Claim sats on BTC chain by claiming the HTLC.
4344
+ *
4345
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
4346
+ *
4340
4347
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
4341
4348
  * @returns The BTC transaction ID of the claim.
4342
4349
  */
@@ -1,8 +1,8 @@
1
- import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-B98F6MQF.cjs';
2
- export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-B98F6MQF.cjs';
1
+ import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-CIqTFkV1.cjs';
2
+ export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-CIqTFkV1.cjs';
3
3
  import '@arkade-os/sdk/worker/expo';
4
4
  import '@arkade-os/sdk';
5
- import '../types-CS62-oEy.cjs';
5
+ import '../types-BKEkNZxK.cjs';
6
6
 
7
7
  /**
8
8
  * Define the Expo background task handler for swap polling.
@@ -1,8 +1,8 @@
1
- import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-Ov-wp17v.js';
2
- export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-Ov-wp17v.js';
1
+ import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-C4HQHP9Z.js';
2
+ export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-C4HQHP9Z.js';
3
3
  import '@arkade-os/sdk/worker/expo';
4
4
  import '@arkade-os/sdk';
5
- import '../types-CS62-oEy.js';
5
+ import '../types-BKEkNZxK.js';
6
6
 
7
7
  /**
8
8
  * Define the Expo background task handler for swap polling.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SWAP_POLL_TASK_TYPE,
3
3
  swapsPollProcessor
4
- } from "../chunk-UJXW5JBT.js";
4
+ } from "../chunk-HIG2OOAN.js";
5
5
  import {
6
6
  BoltzSwapProvider
7
- } from "../chunk-GXO2EB6C.js";
7
+ } from "../chunk-VKHFXGKL.js";
8
8
  import "../chunk-SJQJQO7P.js";
9
9
 
10
10
  // src/expo/background.ts
@@ -1296,8 +1296,8 @@ var constructClaimTransaction = (utxo, destinationScript, fee) => {
1296
1296
  return tx;
1297
1297
  };
1298
1298
  var targetFee = (satPerVbyte, constructTx) => {
1299
- const tx = constructTx(BigInt(1));
1300
- return constructTx(BigInt(Math.ceil((tx.vsize + tx.inputsLength) * satPerVbyte)));
1299
+ const probe = constructTx(BigInt(1));
1300
+ return constructTx(BigInt(Math.ceil(probe.vsize * satPerVbyte)));
1301
1301
  };
1302
1302
 
1303
1303
  // src/utils/decoding.ts
@@ -1308,6 +1308,9 @@ var decodeInvoice = (invoice) => {
1308
1308
  const millisats = BigInt(decoded.sections.find((s) => s.name === "amount")?.value ?? "0");
1309
1309
  return {
1310
1310
  expiry: decoded.expiry ?? 3600,
1311
+ // The timestamp fallback to 0 is just to satisfy the type checker.
1312
+ // In practice, the timestamp is always present in well-formatted BOLT11 invoices.
1313
+ timestamp: decoded.sections.find((s) => s.name === "timestamp")?.value ?? 0,
1311
1314
  amountSats: Number(millisats / 1000n),
1312
1315
  description: decoded.sections.find((s) => s.name === "description")?.value ?? "",
1313
1316
  // description_hash (BOLT11 `h`) is missing from light-bolt11-decoder's
@@ -3360,6 +3363,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
3360
3363
  return {
3361
3364
  amount: pendingSwap.response.onchainAmount,
3362
3365
  expiry: decodedInvoice.expiry,
3366
+ timestamp: decodedInvoice.timestamp,
3363
3367
  invoice: pendingSwap.response.invoice,
3364
3368
  paymentHash: decodedInvoice.paymentHash,
3365
3369
  pendingSwap,
@@ -4327,6 +4331,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
4327
4331
  }
4328
4332
  /**
4329
4333
  * Claim sats on BTC chain by claiming the HTLC.
4334
+ *
4335
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
4336
+ *
4330
4337
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
4331
4338
  * @returns The BTC transaction ID of the claim.
4332
4339
  */
@@ -1,7 +1,7 @@
1
- import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-D-L0_0Ri.cjs';
2
- import { n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, j as ArkToBtcResponse, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-CS62-oEy.cjs';
3
- import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-B98F6MQF.cjs';
4
- export { D as DefineSwapBackgroundTaskOptions, b as ExpoArkadeLightningConfig, c as ExpoSwapBackgroundConfig, P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies } from '../swapsPollProcessor-B98F6MQF.cjs';
1
+ import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-BG3xEK31.cjs';
2
+ import { n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, j as ArkToBtcResponse, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-BKEkNZxK.cjs';
3
+ import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-CIqTFkV1.cjs';
4
+ export { D as DefineSwapBackgroundTaskOptions, b as ExpoArkadeLightningConfig, c as ExpoSwapBackgroundConfig, P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies } from '../swapsPollProcessor-CIqTFkV1.cjs';
5
5
  import { ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
6
6
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
7
7
  import '@arkade-os/sdk/worker/expo';
@@ -1,7 +1,7 @@
1
- import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-fmdCFjif.js';
2
- import { n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, j as ArkToBtcResponse, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-CS62-oEy.js';
3
- import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-Ov-wp17v.js';
4
- export { D as DefineSwapBackgroundTaskOptions, b as ExpoArkadeLightningConfig, c as ExpoSwapBackgroundConfig, P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies } from '../swapsPollProcessor-Ov-wp17v.js';
1
+ import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-A180YN8g.js';
2
+ import { n as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, o as SendLightningPaymentResponse, O as OptimisticSendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, j as ArkToBtcResponse, l as ChainArkRefundOutcome, k as BtcToArkResponse, d as Chain, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-BKEkNZxK.js';
3
+ import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-C4HQHP9Z.js';
4
+ export { D as DefineSwapBackgroundTaskOptions, b as ExpoArkadeLightningConfig, c as ExpoSwapBackgroundConfig, P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies } from '../swapsPollProcessor-C4HQHP9Z.js';
5
5
  import { ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
6
6
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
7
7
  import '@arkade-os/sdk/worker/expo';
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  SWAP_POLL_TASK_TYPE
3
- } from "../chunk-UJXW5JBT.js";
3
+ } from "../chunk-HIG2OOAN.js";
4
4
  import {
5
5
  ArkadeSwaps
6
- } from "../chunk-GXO2EB6C.js";
6
+ } from "../chunk-VKHFXGKL.js";
7
7
  import "../chunk-SJQJQO7P.js";
8
8
 
9
9
  // src/expo/arkade-lightning.ts
package/dist/index.cjs CHANGED
@@ -95,7 +95,7 @@ __export(index_exports, {
95
95
  module.exports = __toCommonJS(index_exports);
96
96
 
97
97
  // package.json
98
- var version = "0.3.46";
98
+ var version = "0.3.48";
99
99
 
100
100
  // src/errors.ts
101
101
  var SwapError = class extends Error {
@@ -1428,8 +1428,8 @@ var constructClaimTransaction = (utxo, destinationScript, fee) => {
1428
1428
  return tx;
1429
1429
  };
1430
1430
  var targetFee = (satPerVbyte, constructTx) => {
1431
- const tx = constructTx(BigInt(1));
1432
- return constructTx(BigInt(Math.ceil((tx.vsize + tx.inputsLength) * satPerVbyte)));
1431
+ const probe = constructTx(BigInt(1));
1432
+ return constructTx(BigInt(Math.ceil(probe.vsize * satPerVbyte)));
1433
1433
  };
1434
1434
 
1435
1435
  // src/utils/decoding.ts
@@ -1440,6 +1440,9 @@ var decodeInvoice = (invoice) => {
1440
1440
  const millisats = BigInt(decoded.sections.find((s) => s.name === "amount")?.value ?? "0");
1441
1441
  return {
1442
1442
  expiry: decoded.expiry ?? 3600,
1443
+ // The timestamp fallback to 0 is just to satisfy the type checker.
1444
+ // In practice, the timestamp is always present in well-formatted BOLT11 invoices.
1445
+ timestamp: decoded.sections.find((s) => s.name === "timestamp")?.value ?? 0,
1443
1446
  amountSats: Number(millisats / 1000n),
1444
1447
  description: decoded.sections.find((s) => s.name === "description")?.value ?? "",
1445
1448
  // description_hash (BOLT11 `h`) is missing from light-bolt11-decoder's
@@ -3513,6 +3516,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
3513
3516
  return {
3514
3517
  amount: pendingSwap.response.onchainAmount,
3515
3518
  expiry: decodedInvoice.expiry,
3519
+ timestamp: decodedInvoice.timestamp,
3516
3520
  invoice: pendingSwap.response.invoice,
3517
3521
  paymentHash: decodedInvoice.paymentHash,
3518
3522
  pendingSwap,
@@ -4480,6 +4484,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
4480
4484
  }
4481
4485
  /**
4482
4486
  * Claim sats on BTC chain by claiming the HTLC.
4487
+ *
4488
+ * The claim output is `swapOutput.amount − max(feeToDeliverExactAmount, targetFee)`.
4489
+ *
4483
4490
  * @param pendingSwap - The pending chain swap with BTC transaction hex.
4484
4491
  * @returns The BTC transaction ID of the claim.
4485
4492
  */
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-D-L0_0Ri.cjs';
2
- export { A as ArkadeSwaps } from './arkade-swaps-D-L0_0Ri.cjs';
3
- import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-CS62-oEy.cjs';
4
- export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-CS62-oEy.cjs';
1
+ import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-BG3xEK31.cjs';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-BG3xEK31.cjs';
3
+ import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-BKEkNZxK.cjs';
4
+ export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-BKEkNZxK.cjs';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { MessageHandler, RequestEnvelope, ArkInfo, ResponseEnvelope, IWallet, IReadonlyWallet, VHTLC, Identity, ArkTxInput } from '@arkade-os/sdk';
7
7
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-fmdCFjif.js';
2
- export { A as ArkadeSwaps } from './arkade-swaps-fmdCFjif.js';
3
- import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-CS62-oEy.js';
4
- export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-CS62-oEy.js';
1
+ import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-A180YN8g.js';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-A180YN8g.js';
3
+ import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-BKEkNZxK.js';
4
+ export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-BKEkNZxK.js';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { MessageHandler, RequestEnvelope, ArkInfo, ResponseEnvelope, IWallet, IReadonlyWallet, VHTLC, Identity, ArkTxInput } from '@arkade-os/sdk';
7
7
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
package/dist/index.js CHANGED
@@ -53,14 +53,14 @@ import {
53
53
  updateReverseSwapStatus,
54
54
  updateSubmarineSwapStatus,
55
55
  verifySignatures
56
- } from "./chunk-GXO2EB6C.js";
56
+ } from "./chunk-VKHFXGKL.js";
57
57
  import {
58
58
  applyCreatedAtOrder,
59
59
  applySwapsFilter
60
60
  } from "./chunk-SJQJQO7P.js";
61
61
 
62
62
  // package.json
63
- var version = "0.3.46";
63
+ var version = "0.3.48";
64
64
 
65
65
  // src/serviceWorker/arkade-swaps-message-handler.ts
66
66
  import { RestArkProvider, RestIndexerProvider } from "@arkade-os/sdk";
@@ -1,5 +1,5 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-CS62-oEy.cjs';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-BKEkNZxK.cjs';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-CS62-oEy.js';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-BKEkNZxK.js';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-CS62-oEy.cjs';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-BKEkNZxK.cjs';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-CS62-oEy.js';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-BKEkNZxK.js';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
2
2
  import { Identity, ArkProvider, IndexerProvider, IWallet } from '@arkade-os/sdk';
3
- import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-CS62-oEy.js';
3
+ import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-BKEkNZxK.js';
4
4
 
5
5
  /**
6
6
  * Dependencies injected into every swap processor at runtime.
@@ -1,6 +1,6 @@
1
1
  import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
2
2
  import { Identity, ArkProvider, IndexerProvider, IWallet } from '@arkade-os/sdk';
3
- import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-CS62-oEy.cjs';
3
+ import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-BKEkNZxK.cjs';
4
4
 
5
5
  /**
6
6
  * Dependencies injected into every swap processor at runtime.
@@ -935,8 +935,10 @@ interface CreateLightningInvoiceRequest {
935
935
  interface CreateLightningInvoiceResponse {
936
936
  /** The on-chain amount in satoshis (after Boltz fees). */
937
937
  amount: number;
938
- /** Invoice expiry timestamp (Unix seconds). */
938
+ /** Invoice expiry: seconds from invoice creation (timestamp) until it expires. */
939
939
  expiry: number;
940
+ /** Invoice creation timestamp (Unix seconds). Always present in a valid BOLT11 invoice; `0` should not occur in practice. */
941
+ timestamp: number;
940
942
  /** The BOLT11-encoded Lightning invoice string. */
941
943
  invoice: string;
942
944
  /** The payment hash (hex-encoded). */
@@ -1174,6 +1176,8 @@ type ArkadeSwapsCreateConfig = Omit<ArkadeSwapsConfig, "swapProvider"> & {
1174
1176
  interface DecodedInvoice {
1175
1177
  /** Invoice expiry timestamp (Unix seconds). */
1176
1178
  expiry: number;
1179
+ /** Invoice creation timestamp (Unix seconds). Always present in a valid BOLT11 invoice; `0` should not occur in practice. */
1180
+ timestamp: number;
1177
1181
  /** Invoice amount in satoshis. */
1178
1182
  amountSats: number;
1179
1183
  /** Invoice description string (BOLT11 `d` field; "" if none). */
@@ -935,8 +935,10 @@ interface CreateLightningInvoiceRequest {
935
935
  interface CreateLightningInvoiceResponse {
936
936
  /** The on-chain amount in satoshis (after Boltz fees). */
937
937
  amount: number;
938
- /** Invoice expiry timestamp (Unix seconds). */
938
+ /** Invoice expiry: seconds from invoice creation (timestamp) until it expires. */
939
939
  expiry: number;
940
+ /** Invoice creation timestamp (Unix seconds). Always present in a valid BOLT11 invoice; `0` should not occur in practice. */
941
+ timestamp: number;
940
942
  /** The BOLT11-encoded Lightning invoice string. */
941
943
  invoice: string;
942
944
  /** The payment hash (hex-encoded). */
@@ -1174,6 +1176,8 @@ type ArkadeSwapsCreateConfig = Omit<ArkadeSwapsConfig, "swapProvider"> & {
1174
1176
  interface DecodedInvoice {
1175
1177
  /** Invoice expiry timestamp (Unix seconds). */
1176
1178
  expiry: number;
1179
+ /** Invoice creation timestamp (Unix seconds). Always present in a valid BOLT11 invoice; `0` should not occur in practice. */
1180
+ timestamp: number;
1177
1181
  /** Invoice amount in satoshis. */
1178
1182
  amountSats: number;
1179
1183
  /** Invoice description string (BOLT11 `d` field; "" if none). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/boltz-swap",
3
- "version": "0.3.46",
3
+ "version": "0.3.48",
4
4
  "type": "module",
5
5
  "description": "A production-ready TypeScript package that brings Boltz submarine-swaps to Arkade.",
6
6
  "main": "./dist/index.js",
@@ -76,7 +76,7 @@
76
76
  "@scure/btc-signer": "2.0.1",
77
77
  "bip68": "1.0.4",
78
78
  "light-bolt11-decoder": "3.2.0",
79
- "@arkade-os/sdk": "0.4.41"
79
+ "@arkade-os/sdk": "0.4.43"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "expo-task-manager": ">=3.0.0",