@arkade-os/boltz-swap 0.3.34 → 0.3.35

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.
@@ -2670,6 +2670,20 @@ function extractInvoiceAmount(amountSats, fees) {
2670
2670
  if (miner >= amountSats) return 0;
2671
2671
  return Math.ceil((amountSats - miner) / (1 - percentage / 100));
2672
2672
  }
2673
+ function resolveVhtlcTimeouts(tree, timeoutBlockHeights) {
2674
+ const resolved = timeoutBlockHeights ?? {
2675
+ refund: extractTimeLockFromLeafOutput(tree.refundWithoutBoltzLeaf?.output ?? ""),
2676
+ unilateralClaim: extractTimeLockFromLeafOutput(tree.unilateralClaimLeaf?.output ?? ""),
2677
+ unilateralRefund: extractTimeLockFromLeafOutput(tree.unilateralRefundLeaf?.output ?? ""),
2678
+ unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
2679
+ tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
2680
+ )
2681
+ };
2682
+ if (!resolved.refund || !resolved.unilateralClaim || !resolved.unilateralRefund || !resolved.unilateralRefundWithoutReceiver) {
2683
+ return void 0;
2684
+ }
2685
+ return resolved;
2686
+ }
2673
2687
 
2674
2688
  // src/utils/identity.ts
2675
2689
  import { ConditionWitness, setArkPsbtField, Transaction as Transaction3 } from "@arkade-os/sdk";
@@ -5111,20 +5125,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
5111
5125
  onchainAmount: amount,
5112
5126
  lockupAddress,
5113
5127
  refundPublicKey: serverPublicKey,
5114
- timeoutBlockHeights: timeoutBlockHeights ?? {
5115
- refund: extractTimeLockFromLeafOutput(
5116
- tree.refundWithoutBoltzLeaf?.output ?? ""
5117
- ),
5118
- unilateralClaim: extractTimeLockFromLeafOutput(
5119
- tree.unilateralClaimLeaf?.output ?? ""
5120
- ),
5121
- unilateralRefund: extractTimeLockFromLeafOutput(
5122
- tree.unilateralRefundLeaf?.output ?? ""
5123
- ),
5124
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5125
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5126
- )
5127
- }
5128
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5128
5129
  },
5129
5130
  status,
5130
5131
  type: "reverse",
@@ -5157,26 +5158,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
5157
5158
  address: lockupAddress,
5158
5159
  expectedAmount: amount,
5159
5160
  claimPublicKey: serverPublicKey,
5160
- timeoutBlockHeights: timeoutBlockHeights ?? {
5161
- refund: extractTimeLockFromLeafOutput(
5162
- tree.refundWithoutBoltzLeaf?.output ?? ""
5163
- ),
5164
- unilateralClaim: extractTimeLockFromLeafOutput(
5165
- tree.unilateralClaimLeaf?.output ?? ""
5166
- ),
5167
- unilateralRefund: extractTimeLockFromLeafOutput(
5168
- tree.unilateralRefundLeaf?.output ?? ""
5169
- ),
5170
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5171
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5172
- )
5173
- }
5161
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5174
5162
  }
5175
5163
  });
5176
5164
  } else if (isRestoredChainSwap(swap)) {
5177
5165
  const refundDetails = swap.refundDetails;
5178
5166
  if (!refundDetails) continue;
5179
- const { amount, lockupAddress, serverPublicKey, timeoutBlockHeight } = refundDetails;
5167
+ const {
5168
+ amount,
5169
+ lockupAddress,
5170
+ serverPublicKey,
5171
+ timeoutBlockHeight,
5172
+ tree,
5173
+ timeoutBlockHeights
5174
+ } = refundDetails;
5180
5175
  chainSwaps.push({
5181
5176
  id,
5182
5177
  type: "chain",
@@ -5202,7 +5197,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
5202
5197
  amount,
5203
5198
  lockupAddress,
5204
5199
  serverPublicKey,
5205
- timeoutBlockHeight
5200
+ timeoutBlockHeight,
5201
+ timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5206
5202
  }
5207
5203
  }
5208
5204
  });
@@ -7,7 +7,7 @@ import {
7
7
  isSubmarineFinalStatus,
8
8
  isSubmarineSwapRefundable,
9
9
  logger
10
- } from "./chunk-TDBUZE4N.js";
10
+ } from "./chunk-B4CYBKFJ.js";
11
11
 
12
12
  // src/expo/swapsPollProcessor.ts
13
13
  var SWAP_POLL_TASK_TYPE = "swap-poll";
@@ -1373,6 +1373,20 @@ function extractInvoiceAmount(amountSats, fees) {
1373
1373
  if (miner >= amountSats) return 0;
1374
1374
  return Math.ceil((amountSats - miner) / (1 - percentage / 100));
1375
1375
  }
1376
+ function resolveVhtlcTimeouts(tree, timeoutBlockHeights) {
1377
+ const resolved = timeoutBlockHeights ?? {
1378
+ refund: extractTimeLockFromLeafOutput(tree.refundWithoutBoltzLeaf?.output ?? ""),
1379
+ unilateralClaim: extractTimeLockFromLeafOutput(tree.unilateralClaimLeaf?.output ?? ""),
1380
+ unilateralRefund: extractTimeLockFromLeafOutput(tree.unilateralRefundLeaf?.output ?? ""),
1381
+ unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
1382
+ tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
1383
+ )
1384
+ };
1385
+ if (!resolved.refund || !resolved.unilateralClaim || !resolved.unilateralRefund || !resolved.unilateralRefundWithoutReceiver) {
1386
+ return void 0;
1387
+ }
1388
+ return resolved;
1389
+ }
1376
1390
 
1377
1391
  // src/logger.ts
1378
1392
  var logger = console;
@@ -5054,20 +5068,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
5054
5068
  onchainAmount: amount,
5055
5069
  lockupAddress,
5056
5070
  refundPublicKey: serverPublicKey,
5057
- timeoutBlockHeights: timeoutBlockHeights ?? {
5058
- refund: extractTimeLockFromLeafOutput(
5059
- tree.refundWithoutBoltzLeaf?.output ?? ""
5060
- ),
5061
- unilateralClaim: extractTimeLockFromLeafOutput(
5062
- tree.unilateralClaimLeaf?.output ?? ""
5063
- ),
5064
- unilateralRefund: extractTimeLockFromLeafOutput(
5065
- tree.unilateralRefundLeaf?.output ?? ""
5066
- ),
5067
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5068
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5069
- )
5070
- }
5071
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5071
5072
  },
5072
5073
  status,
5073
5074
  type: "reverse",
@@ -5100,26 +5101,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
5100
5101
  address: lockupAddress,
5101
5102
  expectedAmount: amount,
5102
5103
  claimPublicKey: serverPublicKey,
5103
- timeoutBlockHeights: timeoutBlockHeights ?? {
5104
- refund: extractTimeLockFromLeafOutput(
5105
- tree.refundWithoutBoltzLeaf?.output ?? ""
5106
- ),
5107
- unilateralClaim: extractTimeLockFromLeafOutput(
5108
- tree.unilateralClaimLeaf?.output ?? ""
5109
- ),
5110
- unilateralRefund: extractTimeLockFromLeafOutput(
5111
- tree.unilateralRefundLeaf?.output ?? ""
5112
- ),
5113
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5114
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5115
- )
5116
- }
5104
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5117
5105
  }
5118
5106
  });
5119
5107
  } else if (isRestoredChainSwap(swap)) {
5120
5108
  const refundDetails = swap.refundDetails;
5121
5109
  if (!refundDetails) continue;
5122
- const { amount, lockupAddress, serverPublicKey, timeoutBlockHeight } = refundDetails;
5110
+ const {
5111
+ amount,
5112
+ lockupAddress,
5113
+ serverPublicKey,
5114
+ timeoutBlockHeight,
5115
+ tree,
5116
+ timeoutBlockHeights
5117
+ } = refundDetails;
5123
5118
  chainSwaps.push({
5124
5119
  id,
5125
5120
  type: "chain",
@@ -5145,7 +5140,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
5145
5140
  amount,
5146
5141
  lockupAddress,
5147
5142
  serverPublicKey,
5148
- timeoutBlockHeight
5143
+ timeoutBlockHeight,
5144
+ timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5149
5145
  }
5150
5146
  }
5151
5147
  });
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SWAP_POLL_TASK_TYPE,
3
3
  swapsPollProcessor
4
- } from "../chunk-5K2FS2FE.js";
4
+ } from "../chunk-H6F67K2A.js";
5
5
  import {
6
6
  BoltzSwapProvider
7
- } from "../chunk-TDBUZE4N.js";
7
+ } from "../chunk-B4CYBKFJ.js";
8
8
  import "../chunk-SJQJQO7P.js";
9
9
 
10
10
  // src/expo/background.ts
@@ -1363,6 +1363,20 @@ function extractInvoiceAmount(amountSats, fees) {
1363
1363
  if (miner >= amountSats) return 0;
1364
1364
  return Math.ceil((amountSats - miner) / (1 - percentage / 100));
1365
1365
  }
1366
+ function resolveVhtlcTimeouts(tree, timeoutBlockHeights) {
1367
+ const resolved = timeoutBlockHeights ?? {
1368
+ refund: extractTimeLockFromLeafOutput(tree.refundWithoutBoltzLeaf?.output ?? ""),
1369
+ unilateralClaim: extractTimeLockFromLeafOutput(tree.unilateralClaimLeaf?.output ?? ""),
1370
+ unilateralRefund: extractTimeLockFromLeafOutput(tree.unilateralRefundLeaf?.output ?? ""),
1371
+ unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
1372
+ tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
1373
+ )
1374
+ };
1375
+ if (!resolved.refund || !resolved.unilateralClaim || !resolved.unilateralRefund || !resolved.unilateralRefundWithoutReceiver) {
1376
+ return void 0;
1377
+ }
1378
+ return resolved;
1379
+ }
1366
1380
 
1367
1381
  // src/logger.ts
1368
1382
  var logger = console;
@@ -5044,20 +5058,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
5044
5058
  onchainAmount: amount,
5045
5059
  lockupAddress,
5046
5060
  refundPublicKey: serverPublicKey,
5047
- timeoutBlockHeights: timeoutBlockHeights ?? {
5048
- refund: extractTimeLockFromLeafOutput(
5049
- tree.refundWithoutBoltzLeaf?.output ?? ""
5050
- ),
5051
- unilateralClaim: extractTimeLockFromLeafOutput(
5052
- tree.unilateralClaimLeaf?.output ?? ""
5053
- ),
5054
- unilateralRefund: extractTimeLockFromLeafOutput(
5055
- tree.unilateralRefundLeaf?.output ?? ""
5056
- ),
5057
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5058
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5059
- )
5060
- }
5061
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5061
5062
  },
5062
5063
  status,
5063
5064
  type: "reverse",
@@ -5090,26 +5091,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
5090
5091
  address: lockupAddress,
5091
5092
  expectedAmount: amount,
5092
5093
  claimPublicKey: serverPublicKey,
5093
- timeoutBlockHeights: timeoutBlockHeights ?? {
5094
- refund: extractTimeLockFromLeafOutput(
5095
- tree.refundWithoutBoltzLeaf?.output ?? ""
5096
- ),
5097
- unilateralClaim: extractTimeLockFromLeafOutput(
5098
- tree.unilateralClaimLeaf?.output ?? ""
5099
- ),
5100
- unilateralRefund: extractTimeLockFromLeafOutput(
5101
- tree.unilateralRefundLeaf?.output ?? ""
5102
- ),
5103
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5104
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5105
- )
5106
- }
5094
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5107
5095
  }
5108
5096
  });
5109
5097
  } else if (isRestoredChainSwap(swap)) {
5110
5098
  const refundDetails = swap.refundDetails;
5111
5099
  if (!refundDetails) continue;
5112
- const { amount, lockupAddress, serverPublicKey, timeoutBlockHeight } = refundDetails;
5100
+ const {
5101
+ amount,
5102
+ lockupAddress,
5103
+ serverPublicKey,
5104
+ timeoutBlockHeight,
5105
+ tree,
5106
+ timeoutBlockHeights
5107
+ } = refundDetails;
5113
5108
  chainSwaps.push({
5114
5109
  id,
5115
5110
  type: "chain",
@@ -5135,7 +5130,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
5135
5130
  amount,
5136
5131
  lockupAddress,
5137
5132
  serverPublicKey,
5138
- timeoutBlockHeight
5133
+ timeoutBlockHeight,
5134
+ timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5139
5135
  }
5140
5136
  }
5141
5137
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  SWAP_POLL_TASK_TYPE
3
- } from "../chunk-5K2FS2FE.js";
3
+ } from "../chunk-H6F67K2A.js";
4
4
  import {
5
5
  ArkadeSwaps
6
- } from "../chunk-TDBUZE4N.js";
6
+ } from "../chunk-B4CYBKFJ.js";
7
7
  import "../chunk-SJQJQO7P.js";
8
8
 
9
9
  // src/expo/arkade-lightning.ts
package/dist/index.cjs CHANGED
@@ -1501,6 +1501,20 @@ function extractInvoiceAmount(amountSats, fees) {
1501
1501
  if (miner >= amountSats) return 0;
1502
1502
  return Math.ceil((amountSats - miner) / (1 - percentage / 100));
1503
1503
  }
1504
+ function resolveVhtlcTimeouts(tree, timeoutBlockHeights) {
1505
+ const resolved = timeoutBlockHeights ?? {
1506
+ refund: extractTimeLockFromLeafOutput(tree.refundWithoutBoltzLeaf?.output ?? ""),
1507
+ unilateralClaim: extractTimeLockFromLeafOutput(tree.unilateralClaimLeaf?.output ?? ""),
1508
+ unilateralRefund: extractTimeLockFromLeafOutput(tree.unilateralRefundLeaf?.output ?? ""),
1509
+ unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
1510
+ tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
1511
+ )
1512
+ };
1513
+ if (!resolved.refund || !resolved.unilateralClaim || !resolved.unilateralRefund || !resolved.unilateralRefundWithoutReceiver) {
1514
+ return void 0;
1515
+ }
1516
+ return resolved;
1517
+ }
1504
1518
 
1505
1519
  // src/logger.ts
1506
1520
  var logger = console;
@@ -5192,20 +5206,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
5192
5206
  onchainAmount: amount,
5193
5207
  lockupAddress,
5194
5208
  refundPublicKey: serverPublicKey,
5195
- timeoutBlockHeights: timeoutBlockHeights ?? {
5196
- refund: extractTimeLockFromLeafOutput(
5197
- tree.refundWithoutBoltzLeaf?.output ?? ""
5198
- ),
5199
- unilateralClaim: extractTimeLockFromLeafOutput(
5200
- tree.unilateralClaimLeaf?.output ?? ""
5201
- ),
5202
- unilateralRefund: extractTimeLockFromLeafOutput(
5203
- tree.unilateralRefundLeaf?.output ?? ""
5204
- ),
5205
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5206
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5207
- )
5208
- }
5209
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5209
5210
  },
5210
5211
  status,
5211
5212
  type: "reverse",
@@ -5238,26 +5239,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
5238
5239
  address: lockupAddress,
5239
5240
  expectedAmount: amount,
5240
5241
  claimPublicKey: serverPublicKey,
5241
- timeoutBlockHeights: timeoutBlockHeights ?? {
5242
- refund: extractTimeLockFromLeafOutput(
5243
- tree.refundWithoutBoltzLeaf?.output ?? ""
5244
- ),
5245
- unilateralClaim: extractTimeLockFromLeafOutput(
5246
- tree.unilateralClaimLeaf?.output ?? ""
5247
- ),
5248
- unilateralRefund: extractTimeLockFromLeafOutput(
5249
- tree.unilateralRefundLeaf?.output ?? ""
5250
- ),
5251
- unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
5252
- tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
5253
- )
5254
- }
5242
+ timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5255
5243
  }
5256
5244
  });
5257
5245
  } else if (isRestoredChainSwap(swap)) {
5258
5246
  const refundDetails = swap.refundDetails;
5259
5247
  if (!refundDetails) continue;
5260
- const { amount, lockupAddress, serverPublicKey, timeoutBlockHeight } = refundDetails;
5248
+ const {
5249
+ amount,
5250
+ lockupAddress,
5251
+ serverPublicKey,
5252
+ timeoutBlockHeight,
5253
+ tree,
5254
+ timeoutBlockHeights
5255
+ } = refundDetails;
5261
5256
  chainSwaps.push({
5262
5257
  id,
5263
5258
  type: "chain",
@@ -5283,7 +5278,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
5283
5278
  amount,
5284
5279
  lockupAddress,
5285
5280
  serverPublicKey,
5286
- timeoutBlockHeight
5281
+ timeoutBlockHeight,
5282
+ timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
5287
5283
  }
5288
5284
  }
5289
5285
  });
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  updateReverseSwapStatus,
53
53
  updateSubmarineSwapStatus,
54
54
  verifySignatures
55
- } from "./chunk-TDBUZE4N.js";
55
+ } from "./chunk-B4CYBKFJ.js";
56
56
  import {
57
57
  applyCreatedAtOrder,
58
58
  applySwapsFilter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/boltz-swap",
3
- "version": "0.3.34",
3
+ "version": "0.3.35",
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.29"
79
+ "@arkade-os/sdk": "0.4.30"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "expo-task-manager": ">=3.0.0",
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "devDependencies": {
94
94
  "@types/ws": "^8.18.1",
95
- "vite": "7.1.11"
95
+ "vite": "^7.3.2"
96
96
  },
97
97
  "publishConfig": {
98
98
  "access": "public",