@arkade-os/boltz-swap 0.3.34 → 0.3.36
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.
- package/dist/{arkade-swaps-CfMets16.d.cts → arkade-swaps-DG9UepoS.d.cts} +26 -5
- package/dist/{arkade-swaps-BXAD1s8j.d.ts → arkade-swaps-Uet3tgN6.d.ts} +26 -5
- package/dist/{chunk-TDBUZE4N.js → chunk-CFB2NNGT.js} +168 -70
- package/dist/{chunk-5K2FS2FE.js → chunk-DNCIVDU5.js} +1 -1
- package/dist/expo/background.cjs +168 -70
- package/dist/expo/background.d.cts +3 -3
- package/dist/expo/background.d.ts +3 -3
- package/dist/expo/background.js +2 -2
- package/dist/expo/index.cjs +168 -70
- package/dist/expo/index.d.cts +10 -6
- package/dist/expo/index.d.ts +10 -6
- package/dist/expo/index.js +2 -2
- package/dist/index.cjs +180 -78
- package/dist/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +13 -9
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{swapsPollProcessor-BpAqG0V6.d.cts → swapsPollProcessor-BlyUrhtO.d.cts} +1 -1
- package/dist/{swapsPollProcessor-DFVOAy_-.d.ts → swapsPollProcessor-Bv4Z2R7g.d.ts} +1 -1
- package/dist/{types--axEWA8c.d.cts → types-D97i1LFu.d.cts} +47 -4
- package/dist/{types--axEWA8c.d.ts → types-D97i1LFu.d.ts} +47 -4
- package/package.json +3 -3
package/dist/expo/index.cjs
CHANGED
|
@@ -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;
|
|
@@ -1424,6 +1438,13 @@ var SwapManager = class _SwapManager {
|
|
|
1424
1438
|
swapsInProgress = /* @__PURE__ */ new Set();
|
|
1425
1439
|
// Per-swap subscriptions for UI hooks
|
|
1426
1440
|
swapSubscriptions = /* @__PURE__ */ new Map();
|
|
1441
|
+
// In-flight (or settled) chain-swap claim promises, keyed by swap id. The
|
|
1442
|
+
// manager performs chain claims itself, so the claim tx it broadcasts is
|
|
1443
|
+
// the swap's on-chain completion; getSwapStatus does not surface that txid
|
|
1444
|
+
// at transaction.claimed. resolveClaimedTxid awaits the stored promise so a
|
|
1445
|
+
// transaction.claimed update that races an in-flight claim still resolves
|
|
1446
|
+
// the real txid instead of falling back to the provider and failing.
|
|
1447
|
+
chainClaimPromises = /* @__PURE__ */ new Map();
|
|
1427
1448
|
// Action callbacks (injected via setCallbacks)
|
|
1428
1449
|
claimCallback = null;
|
|
1429
1450
|
refundCallback = null;
|
|
@@ -1565,6 +1586,7 @@ var SwapManager = class _SwapManager {
|
|
|
1565
1586
|
}
|
|
1566
1587
|
this.isRunning = true;
|
|
1567
1588
|
this.initialSwaps.clear();
|
|
1589
|
+
this.chainClaimPromises.clear();
|
|
1568
1590
|
for (const swap of pendingSwaps) {
|
|
1569
1591
|
this.initialSwaps.set(swap.id, swap);
|
|
1570
1592
|
}
|
|
@@ -1658,6 +1680,7 @@ var SwapManager = class _SwapManager {
|
|
|
1658
1680
|
async removeSwap(swapId) {
|
|
1659
1681
|
this.monitoredSwaps.delete(swapId);
|
|
1660
1682
|
this.swapSubscriptions.delete(swapId);
|
|
1683
|
+
this.chainClaimPromises.delete(swapId);
|
|
1661
1684
|
const retryTimer = this.pollRetryTimers.get(swapId);
|
|
1662
1685
|
if (retryTimer) {
|
|
1663
1686
|
clearTimeout(retryTimer);
|
|
@@ -1700,9 +1723,14 @@ var SwapManager = class _SwapManager {
|
|
|
1700
1723
|
* Blocks until the swap reaches a final status or fails.
|
|
1701
1724
|
* Useful when you want blocking behavior even with SwapManager enabled.
|
|
1702
1725
|
*
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
1726
|
+
* If the swap is already in a final status, resolves immediately with the
|
|
1727
|
+
* on-chain txid of the successfully claimed swap (reverse: from
|
|
1728
|
+
* getReverseSwapTxId; submarine/chain: from getSwapStatus) and throws for a
|
|
1729
|
+
* failed final status.
|
|
1730
|
+
*
|
|
1731
|
+
* @throws If the swap is already in a failed final status.
|
|
1705
1732
|
* @throws If the swap is not found in the manager.
|
|
1733
|
+
* @throws If a completed swap has no transaction id available yet.
|
|
1706
1734
|
*/
|
|
1707
1735
|
async waitForSwapCompletion(swapId) {
|
|
1708
1736
|
let swap = this.monitoredSwaps.get(swapId);
|
|
@@ -1717,10 +1745,12 @@ var SwapManager = class _SwapManager {
|
|
|
1717
1745
|
const response = await this.swapProvider.getReverseSwapTxId(swap.id);
|
|
1718
1746
|
return { txid: response.id };
|
|
1719
1747
|
}
|
|
1720
|
-
if (isPendingSubmarineSwap(swap)) {
|
|
1721
|
-
|
|
1748
|
+
if (isPendingSubmarineSwap(swap) || isPendingChainSwap(swap)) {
|
|
1749
|
+
if (swap.status === "transaction.claimed") {
|
|
1750
|
+
return this.resolveClaimedTxid(swap.id);
|
|
1751
|
+
}
|
|
1752
|
+
throw new Error(`Swap ${swap.id} already in final status: ${swap.status}`);
|
|
1722
1753
|
}
|
|
1723
|
-
throw new Error("Chain swap already completed");
|
|
1724
1754
|
}
|
|
1725
1755
|
return new Promise((resolve, reject) => {
|
|
1726
1756
|
let unsubscribe = null;
|
|
@@ -1735,13 +1765,13 @@ var SwapManager = class _SwapManager {
|
|
|
1735
1765
|
}
|
|
1736
1766
|
} else if (isPendingSubmarineSwap(updatedSwap)) {
|
|
1737
1767
|
if (updatedSwap.status === "transaction.claimed") {
|
|
1738
|
-
|
|
1768
|
+
this.resolveClaimedTxid(updatedSwap.id).then(resolve).catch(reject);
|
|
1739
1769
|
} else {
|
|
1740
1770
|
reject(new Error(`Swap failed with status: ${updatedSwap.status}`));
|
|
1741
1771
|
}
|
|
1742
1772
|
} else if (isPendingChainSwap(updatedSwap)) {
|
|
1743
1773
|
if (updatedSwap.status === "transaction.claimed") {
|
|
1744
|
-
|
|
1774
|
+
this.resolveClaimedTxid(updatedSwap.id).then(resolve).catch(reject);
|
|
1745
1775
|
} else {
|
|
1746
1776
|
reject(new Error(`Swap failed with status: ${updatedSwap.status}`));
|
|
1747
1777
|
}
|
|
@@ -1752,6 +1782,37 @@ var SwapManager = class _SwapManager {
|
|
|
1752
1782
|
}).catch(reject);
|
|
1753
1783
|
});
|
|
1754
1784
|
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Resolve the on-chain txid for a claimed submarine/chain swap.
|
|
1787
|
+
*
|
|
1788
|
+
* Chain swaps are claimed by the manager itself, so the claim txid captured
|
|
1789
|
+
* from the claimArk/claimBtc callback is the swap's on-chain completion and
|
|
1790
|
+
* is preferred — Boltz does not surface it via getSwapStatus at
|
|
1791
|
+
* transaction.claimed. Submarine swaps (claimed by Boltz) and chain swaps
|
|
1792
|
+
* we never claimed in this session (e.g. restored already-claimed) fall
|
|
1793
|
+
* back to the provider status. Rejects when no transaction id is available,
|
|
1794
|
+
* so callers never receive the Boltz swap id in place of a real txid.
|
|
1795
|
+
*/
|
|
1796
|
+
async resolveClaimedTxid(swapId) {
|
|
1797
|
+
const claimPromise = this.chainClaimPromises.get(swapId);
|
|
1798
|
+
if (claimPromise) {
|
|
1799
|
+
const claimTxid = await claimPromise.then(
|
|
1800
|
+
(result) => result?.txid,
|
|
1801
|
+
() => void 0
|
|
1802
|
+
);
|
|
1803
|
+
if (claimTxid && claimTxid.trim() !== "") {
|
|
1804
|
+
return { txid: claimTxid };
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
const status = await this.swapProvider.getSwapStatus(swapId);
|
|
1808
|
+
const txid = status.transaction?.id;
|
|
1809
|
+
if (!txid || txid.trim() === "") {
|
|
1810
|
+
throw new SwapError({
|
|
1811
|
+
message: `Transaction ID not available for completed swap ${swapId}`
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
return { txid };
|
|
1815
|
+
}
|
|
1755
1816
|
/**
|
|
1756
1817
|
* Check if a swap is currently being processed
|
|
1757
1818
|
* Useful for preventing race conditions
|
|
@@ -1955,6 +2016,7 @@ var SwapManager = class _SwapManager {
|
|
|
1955
2016
|
if (!this.monitoredSwaps.has(swap.id)) return;
|
|
1956
2017
|
this.monitoredSwaps.delete(swap.id);
|
|
1957
2018
|
this.swapSubscriptions.delete(swap.id);
|
|
2019
|
+
this.chainClaimPromises.delete(swap.id);
|
|
1958
2020
|
const retryTimer = this.pollRetryTimers.get(swap.id);
|
|
1959
2021
|
if (retryTimer) {
|
|
1960
2022
|
clearTimeout(retryTimer);
|
|
@@ -2125,7 +2187,9 @@ var SwapManager = class _SwapManager {
|
|
|
2125
2187
|
logger.error("claimArk callback not set");
|
|
2126
2188
|
return;
|
|
2127
2189
|
}
|
|
2128
|
-
|
|
2190
|
+
const claimPromise = this.claimArkCallback(swap);
|
|
2191
|
+
this.rememberChainClaim(swap.id, claimPromise);
|
|
2192
|
+
await claimPromise;
|
|
2129
2193
|
}
|
|
2130
2194
|
/**
|
|
2131
2195
|
* Execute claim action for chain swap Ark to Btc
|
|
@@ -2135,7 +2199,23 @@ var SwapManager = class _SwapManager {
|
|
|
2135
2199
|
logger.error("claimBtc callback not set");
|
|
2136
2200
|
return;
|
|
2137
2201
|
}
|
|
2138
|
-
|
|
2202
|
+
const claimPromise = this.claimBtcCallback(swap);
|
|
2203
|
+
this.rememberChainClaim(swap.id, claimPromise);
|
|
2204
|
+
await claimPromise;
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Store the in-flight claim promise returned by a claim callback so
|
|
2208
|
+
* {@link resolveClaimedTxid} can await it and surface the real on-chain
|
|
2209
|
+
* txid at transaction.claimed — even when that update races the still
|
|
2210
|
+
* in-flight claim. Storing the promise (not the resolved txid) closes the
|
|
2211
|
+
* window where the txid is not yet captured when transaction.claimed
|
|
2212
|
+
* arrives. Defensive against callbacks that don't return a promise (older
|
|
2213
|
+
* integrations, test doubles): those simply fall back to getSwapStatus.
|
|
2214
|
+
*/
|
|
2215
|
+
rememberChainClaim(swapId, claimPromise) {
|
|
2216
|
+
if (claimPromise) {
|
|
2217
|
+
this.chainClaimPromises.set(swapId, claimPromise);
|
|
2218
|
+
}
|
|
2139
2219
|
}
|
|
2140
2220
|
/**
|
|
2141
2221
|
* Execute refund action for chain swap Ark to Btc
|
|
@@ -2922,6 +3002,7 @@ var claimVHTLCwithOffchainTx = async (identity, vhtlcScript, serverXOnlyPublicKe
|
|
|
2922
3002
|
})
|
|
2923
3003
|
);
|
|
2924
3004
|
await arkProvider.finalizeTx(arkTxid, finalCheckpoints);
|
|
3005
|
+
return arkTxid;
|
|
2925
3006
|
};
|
|
2926
3007
|
var refundVHTLCwithOffchainTx = async (swapId, identity, arkProvider, boltzXOnlyPublicKey, ourXOnlyPublicKey, serverXOnlyPublicKey, input, output, arkInfo, refundFunc) => {
|
|
2927
3008
|
const rawCheckpointTapscript = import_base8.hex.decode(arkInfo.checkpointTapscript);
|
|
@@ -3080,12 +3161,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3080
3161
|
refund: async (swap) => {
|
|
3081
3162
|
await this.refundVHTLC(swap);
|
|
3082
3163
|
},
|
|
3083
|
-
claimArk:
|
|
3084
|
-
|
|
3085
|
-
},
|
|
3086
|
-
claimBtc: async (swap) => {
|
|
3087
|
-
await this.claimBtc(swap);
|
|
3088
|
-
},
|
|
3164
|
+
claimArk: (swap) => this.claimArk(swap),
|
|
3165
|
+
claimBtc: (swap) => this.claimBtc(swap),
|
|
3089
3166
|
refundArk: async (swap) => {
|
|
3090
3167
|
return this.refundArk(swap);
|
|
3091
3168
|
},
|
|
@@ -4096,6 +4173,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4096
4173
|
}
|
|
4097
4174
|
return new Promise((resolve, reject) => {
|
|
4098
4175
|
let claimStarted = false;
|
|
4176
|
+
let claimPromise;
|
|
4099
4177
|
const swap = { ...pendingSwap };
|
|
4100
4178
|
const onStatusUpdate = async (status, data) => {
|
|
4101
4179
|
const updateSwapStatus = async () => {
|
|
@@ -4113,16 +4191,24 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4113
4191
|
const updatedSwap = await updateSwapStatus();
|
|
4114
4192
|
if (claimStarted) return;
|
|
4115
4193
|
claimStarted = true;
|
|
4116
|
-
this.claimBtc(updatedSwap)
|
|
4194
|
+
claimPromise = this.claimBtc(updatedSwap);
|
|
4195
|
+
claimPromise.catch(reject);
|
|
4117
4196
|
break;
|
|
4118
4197
|
}
|
|
4119
|
-
case "transaction.claimed":
|
|
4198
|
+
case "transaction.claimed": {
|
|
4120
4199
|
await updateSwapStatus();
|
|
4121
|
-
const
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4200
|
+
const txid = await this.resolveChainClaimTxid(pendingSwap.id, claimPromise);
|
|
4201
|
+
if (!txid) {
|
|
4202
|
+
reject(
|
|
4203
|
+
new SwapError({
|
|
4204
|
+
message: `Transaction ID not available for claimed swap ${pendingSwap.id}.`
|
|
4205
|
+
})
|
|
4206
|
+
);
|
|
4207
|
+
break;
|
|
4208
|
+
}
|
|
4209
|
+
resolve({ txid });
|
|
4125
4210
|
break;
|
|
4211
|
+
}
|
|
4126
4212
|
case "transaction.lockupFailed":
|
|
4127
4213
|
await updateSwapStatus();
|
|
4128
4214
|
await this.quoteSwap(swap.response.id, quoteOptionsForSwap(swap)).catch(
|
|
@@ -4171,6 +4257,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4171
4257
|
/**
|
|
4172
4258
|
* Claim sats on BTC chain by claiming the HTLC.
|
|
4173
4259
|
* @param pendingSwap - The pending chain swap with BTC transaction hex.
|
|
4260
|
+
* @returns The BTC transaction ID of the claim.
|
|
4174
4261
|
*/
|
|
4175
4262
|
async claimBtc(pendingSwap) {
|
|
4176
4263
|
if (!pendingSwap.toAddress)
|
|
@@ -4243,6 +4330,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4243
4330
|
finalScriptWitness: [musigSigned.aggregatePartials()]
|
|
4244
4331
|
});
|
|
4245
4332
|
await this.swapProvider.postBtcTransaction(claimTx.hex);
|
|
4333
|
+
return { txid: claimTx.id };
|
|
4246
4334
|
}
|
|
4247
4335
|
/**
|
|
4248
4336
|
* When an ARK to BTC swap fails, refund every unspent VTXO at the chain
|
|
@@ -4442,6 +4530,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4442
4530
|
}
|
|
4443
4531
|
return new Promise((resolve, reject) => {
|
|
4444
4532
|
let claimStarted = false;
|
|
4533
|
+
let claimPromise;
|
|
4445
4534
|
const swap = { ...pendingSwap };
|
|
4446
4535
|
const onStatusUpdate = async (status, data) => {
|
|
4447
4536
|
const updateSwapStatus = () => {
|
|
@@ -4454,15 +4543,23 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4454
4543
|
await updateSwapStatus();
|
|
4455
4544
|
if (claimStarted) return;
|
|
4456
4545
|
claimStarted = true;
|
|
4457
|
-
this.claimArk(swap)
|
|
4546
|
+
claimPromise = this.claimArk(swap);
|
|
4547
|
+
claimPromise.catch(reject);
|
|
4458
4548
|
break;
|
|
4459
|
-
case "transaction.claimed":
|
|
4549
|
+
case "transaction.claimed": {
|
|
4460
4550
|
await updateSwapStatus();
|
|
4461
|
-
const
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4551
|
+
const txid = await this.resolveChainClaimTxid(pendingSwap.id, claimPromise);
|
|
4552
|
+
if (!txid) {
|
|
4553
|
+
reject(
|
|
4554
|
+
new SwapError({
|
|
4555
|
+
message: `Transaction ID not available for claimed swap ${pendingSwap.id}.`
|
|
4556
|
+
})
|
|
4557
|
+
);
|
|
4558
|
+
break;
|
|
4559
|
+
}
|
|
4560
|
+
resolve({ txid });
|
|
4465
4561
|
break;
|
|
4562
|
+
}
|
|
4466
4563
|
case "transaction.claim.pending":
|
|
4467
4564
|
await updateSwapStatus();
|
|
4468
4565
|
await this.signCooperativeClaimForServer(swap).catch((err) => {
|
|
@@ -4521,6 +4618,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4521
4618
|
* Claim sats on ARK chain by claiming the VHTLC.
|
|
4522
4619
|
* Refactored to use claimVHTLCIdentity + claimVHTLCwithOffchainTx utilities.
|
|
4523
4620
|
* @param pendingSwap - The pending chain swap.
|
|
4621
|
+
* @returns The Ark transaction ID of the claim.
|
|
4524
4622
|
*/
|
|
4525
4623
|
async claimArk(pendingSwap) {
|
|
4526
4624
|
if (!pendingSwap.toAddress)
|
|
@@ -4583,24 +4681,42 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4583
4681
|
script: import_sdk8.ArkAddress.decode(address).pkScript
|
|
4584
4682
|
};
|
|
4585
4683
|
const vhtlcIdentity = claimVHTLCIdentity(this.wallet.identity, preimage);
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
arkInfo,
|
|
4596
|
-
this.arkProvider
|
|
4597
|
-
);
|
|
4598
|
-
}
|
|
4684
|
+
const txid = (0, import_sdk8.isRecoverable)(vtxo) ? await this.joinBatch(vhtlcIdentity, input, output, arkInfo) : await claimVHTLCwithOffchainTx(
|
|
4685
|
+
vhtlcIdentity,
|
|
4686
|
+
vhtlcScript,
|
|
4687
|
+
serverXOnlyPublicKey,
|
|
4688
|
+
input,
|
|
4689
|
+
output,
|
|
4690
|
+
arkInfo,
|
|
4691
|
+
this.arkProvider
|
|
4692
|
+
);
|
|
4599
4693
|
const finalStatus = await this.getSwapStatus(pendingSwap.id);
|
|
4600
4694
|
await this.savePendingChainSwap({
|
|
4601
4695
|
...pendingSwap,
|
|
4602
4696
|
status: finalStatus.status
|
|
4603
4697
|
});
|
|
4698
|
+
return { txid };
|
|
4699
|
+
}
|
|
4700
|
+
/**
|
|
4701
|
+
* Resolve the on-chain txid for a chain swap at completion.
|
|
4702
|
+
*
|
|
4703
|
+
* The claim transaction we broadcast (claimBtc/claimArk) carries the real
|
|
4704
|
+
* on-chain txid; getSwapStatus does not surface it at transaction.claimed.
|
|
4705
|
+
* Prefer the claim's txid and fall back to the provider status only for
|
|
4706
|
+
* resumed swaps where we never ran the claim ourselves (claimPromise is
|
|
4707
|
+
* undefined). Returns undefined when no usable txid is available, so
|
|
4708
|
+
* callers never resolve with the Boltz swap id in place of a real txid.
|
|
4709
|
+
*/
|
|
4710
|
+
async resolveChainClaimTxid(swapId, claimPromise) {
|
|
4711
|
+
if (claimPromise) {
|
|
4712
|
+
const claimTxid = await claimPromise.then(
|
|
4713
|
+
(res) => res.txid,
|
|
4714
|
+
() => void 0
|
|
4715
|
+
);
|
|
4716
|
+
if (claimTxid && claimTxid.trim() !== "") return claimTxid;
|
|
4717
|
+
}
|
|
4718
|
+
const txid = (await this.getSwapStatus(swapId)).transaction?.id;
|
|
4719
|
+
return txid && txid.trim() !== "" ? txid : void 0;
|
|
4604
4720
|
}
|
|
4605
4721
|
/**
|
|
4606
4722
|
* Sign a cooperative claim for the server in BTC => ARK swaps.
|
|
@@ -5044,20 +5160,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5044
5160
|
onchainAmount: amount,
|
|
5045
5161
|
lockupAddress,
|
|
5046
5162
|
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
|
-
}
|
|
5163
|
+
timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5061
5164
|
},
|
|
5062
5165
|
status,
|
|
5063
5166
|
type: "reverse",
|
|
@@ -5090,26 +5193,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5090
5193
|
address: lockupAddress,
|
|
5091
5194
|
expectedAmount: amount,
|
|
5092
5195
|
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
|
-
}
|
|
5196
|
+
timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5107
5197
|
}
|
|
5108
5198
|
});
|
|
5109
5199
|
} else if (isRestoredChainSwap(swap)) {
|
|
5110
5200
|
const refundDetails = swap.refundDetails;
|
|
5111
5201
|
if (!refundDetails) continue;
|
|
5112
|
-
const {
|
|
5202
|
+
const {
|
|
5203
|
+
amount,
|
|
5204
|
+
lockupAddress,
|
|
5205
|
+
serverPublicKey,
|
|
5206
|
+
timeoutBlockHeight,
|
|
5207
|
+
tree,
|
|
5208
|
+
timeoutBlockHeights
|
|
5209
|
+
} = refundDetails;
|
|
5113
5210
|
chainSwaps.push({
|
|
5114
5211
|
id,
|
|
5115
5212
|
type: "chain",
|
|
@@ -5135,7 +5232,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5135
5232
|
amount,
|
|
5136
5233
|
lockupAddress,
|
|
5137
5234
|
serverPublicKey,
|
|
5138
|
-
timeoutBlockHeight
|
|
5235
|
+
timeoutBlockHeight,
|
|
5236
|
+
timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5139
5237
|
}
|
|
5140
5238
|
}
|
|
5141
5239
|
});
|
package/dist/expo/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-
|
|
2
|
-
import { o as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, k as ArkToBtcResponse, m as ChainArkRefundOutcome, l as BtcToArkResponse, d as Chain, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types
|
|
3
|
-
import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-
|
|
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-
|
|
1
|
+
import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-DG9UepoS.cjs';
|
|
2
|
+
import { o as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, k as ArkToBtcResponse, m as ChainArkRefundOutcome, l as BtcToArkResponse, d as Chain, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-D97i1LFu.cjs';
|
|
3
|
+
import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-BlyUrhtO.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-BlyUrhtO.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';
|
|
@@ -115,7 +115,9 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
115
115
|
waitAndClaimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
116
116
|
txid: string;
|
|
117
117
|
}>;
|
|
118
|
-
claimBtc(pendingSwap: BoltzChainSwap): Promise<
|
|
118
|
+
claimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
119
|
+
txid: string;
|
|
120
|
+
}>;
|
|
119
121
|
refundArk(pendingSwap: BoltzChainSwap): Promise<ChainArkRefundOutcome>;
|
|
120
122
|
btcToArk(args: {
|
|
121
123
|
feeSatsPerByte?: number;
|
|
@@ -125,7 +127,9 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
125
127
|
waitAndClaimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
126
128
|
txid: string;
|
|
127
129
|
}>;
|
|
128
|
-
claimArk(pendingSwap: BoltzChainSwap): Promise<
|
|
130
|
+
claimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
131
|
+
txid: string;
|
|
132
|
+
}>;
|
|
129
133
|
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
130
134
|
waitAndClaimChain(pendingSwap: BoltzChainSwap): Promise<{
|
|
131
135
|
txid: string;
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-
|
|
2
|
-
import { o as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, k as ArkToBtcResponse, m as ChainArkRefundOutcome, l as BtcToArkResponse, d as Chain, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types
|
|
3
|
-
import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-
|
|
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-
|
|
1
|
+
import { I as IArkadeSwaps, A as ArkadeSwaps, Q as QuoteSwapOptions, V as VhtlcTimeouts } from '../arkade-swaps-Uet3tgN6.js';
|
|
2
|
+
import { o as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, F as FeesResponse, a as BoltzChainSwap, k as ArkToBtcResponse, m as ChainArkRefundOutcome, l as BtcToArkResponse, d as Chain, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-D97i1LFu.js';
|
|
3
|
+
import { E as ExpoArkadeSwapsConfig } from '../swapsPollProcessor-Bv4Z2R7g.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-Bv4Z2R7g.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';
|
|
@@ -115,7 +115,9 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
115
115
|
waitAndClaimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
116
116
|
txid: string;
|
|
117
117
|
}>;
|
|
118
|
-
claimBtc(pendingSwap: BoltzChainSwap): Promise<
|
|
118
|
+
claimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
119
|
+
txid: string;
|
|
120
|
+
}>;
|
|
119
121
|
refundArk(pendingSwap: BoltzChainSwap): Promise<ChainArkRefundOutcome>;
|
|
120
122
|
btcToArk(args: {
|
|
121
123
|
feeSatsPerByte?: number;
|
|
@@ -125,7 +127,9 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
125
127
|
waitAndClaimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
126
128
|
txid: string;
|
|
127
129
|
}>;
|
|
128
|
-
claimArk(pendingSwap: BoltzChainSwap): Promise<
|
|
130
|
+
claimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
131
|
+
txid: string;
|
|
132
|
+
}>;
|
|
129
133
|
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
130
134
|
waitAndClaimChain(pendingSwap: BoltzChainSwap): Promise<{
|
|
131
135
|
txid: string;
|
package/dist/expo/index.js
CHANGED