@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/background.cjs
CHANGED
|
@@ -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;
|
|
@@ -1434,6 +1448,13 @@ var SwapManager = class _SwapManager {
|
|
|
1434
1448
|
swapsInProgress = /* @__PURE__ */ new Set();
|
|
1435
1449
|
// Per-swap subscriptions for UI hooks
|
|
1436
1450
|
swapSubscriptions = /* @__PURE__ */ new Map();
|
|
1451
|
+
// In-flight (or settled) chain-swap claim promises, keyed by swap id. The
|
|
1452
|
+
// manager performs chain claims itself, so the claim tx it broadcasts is
|
|
1453
|
+
// the swap's on-chain completion; getSwapStatus does not surface that txid
|
|
1454
|
+
// at transaction.claimed. resolveClaimedTxid awaits the stored promise so a
|
|
1455
|
+
// transaction.claimed update that races an in-flight claim still resolves
|
|
1456
|
+
// the real txid instead of falling back to the provider and failing.
|
|
1457
|
+
chainClaimPromises = /* @__PURE__ */ new Map();
|
|
1437
1458
|
// Action callbacks (injected via setCallbacks)
|
|
1438
1459
|
claimCallback = null;
|
|
1439
1460
|
refundCallback = null;
|
|
@@ -1575,6 +1596,7 @@ var SwapManager = class _SwapManager {
|
|
|
1575
1596
|
}
|
|
1576
1597
|
this.isRunning = true;
|
|
1577
1598
|
this.initialSwaps.clear();
|
|
1599
|
+
this.chainClaimPromises.clear();
|
|
1578
1600
|
for (const swap of pendingSwaps) {
|
|
1579
1601
|
this.initialSwaps.set(swap.id, swap);
|
|
1580
1602
|
}
|
|
@@ -1668,6 +1690,7 @@ var SwapManager = class _SwapManager {
|
|
|
1668
1690
|
async removeSwap(swapId) {
|
|
1669
1691
|
this.monitoredSwaps.delete(swapId);
|
|
1670
1692
|
this.swapSubscriptions.delete(swapId);
|
|
1693
|
+
this.chainClaimPromises.delete(swapId);
|
|
1671
1694
|
const retryTimer = this.pollRetryTimers.get(swapId);
|
|
1672
1695
|
if (retryTimer) {
|
|
1673
1696
|
clearTimeout(retryTimer);
|
|
@@ -1710,9 +1733,14 @@ var SwapManager = class _SwapManager {
|
|
|
1710
1733
|
* Blocks until the swap reaches a final status or fails.
|
|
1711
1734
|
* Useful when you want blocking behavior even with SwapManager enabled.
|
|
1712
1735
|
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1736
|
+
* If the swap is already in a final status, resolves immediately with the
|
|
1737
|
+
* on-chain txid of the successfully claimed swap (reverse: from
|
|
1738
|
+
* getReverseSwapTxId; submarine/chain: from getSwapStatus) and throws for a
|
|
1739
|
+
* failed final status.
|
|
1740
|
+
*
|
|
1741
|
+
* @throws If the swap is already in a failed final status.
|
|
1715
1742
|
* @throws If the swap is not found in the manager.
|
|
1743
|
+
* @throws If a completed swap has no transaction id available yet.
|
|
1716
1744
|
*/
|
|
1717
1745
|
async waitForSwapCompletion(swapId) {
|
|
1718
1746
|
let swap = this.monitoredSwaps.get(swapId);
|
|
@@ -1727,10 +1755,12 @@ var SwapManager = class _SwapManager {
|
|
|
1727
1755
|
const response = await this.swapProvider.getReverseSwapTxId(swap.id);
|
|
1728
1756
|
return { txid: response.id };
|
|
1729
1757
|
}
|
|
1730
|
-
if (isPendingSubmarineSwap(swap)) {
|
|
1731
|
-
|
|
1758
|
+
if (isPendingSubmarineSwap(swap) || isPendingChainSwap(swap)) {
|
|
1759
|
+
if (swap.status === "transaction.claimed") {
|
|
1760
|
+
return this.resolveClaimedTxid(swap.id);
|
|
1761
|
+
}
|
|
1762
|
+
throw new Error(`Swap ${swap.id} already in final status: ${swap.status}`);
|
|
1732
1763
|
}
|
|
1733
|
-
throw new Error("Chain swap already completed");
|
|
1734
1764
|
}
|
|
1735
1765
|
return new Promise((resolve, reject) => {
|
|
1736
1766
|
let unsubscribe = null;
|
|
@@ -1745,13 +1775,13 @@ var SwapManager = class _SwapManager {
|
|
|
1745
1775
|
}
|
|
1746
1776
|
} else if (isPendingSubmarineSwap(updatedSwap)) {
|
|
1747
1777
|
if (updatedSwap.status === "transaction.claimed") {
|
|
1748
|
-
|
|
1778
|
+
this.resolveClaimedTxid(updatedSwap.id).then(resolve).catch(reject);
|
|
1749
1779
|
} else {
|
|
1750
1780
|
reject(new Error(`Swap failed with status: ${updatedSwap.status}`));
|
|
1751
1781
|
}
|
|
1752
1782
|
} else if (isPendingChainSwap(updatedSwap)) {
|
|
1753
1783
|
if (updatedSwap.status === "transaction.claimed") {
|
|
1754
|
-
|
|
1784
|
+
this.resolveClaimedTxid(updatedSwap.id).then(resolve).catch(reject);
|
|
1755
1785
|
} else {
|
|
1756
1786
|
reject(new Error(`Swap failed with status: ${updatedSwap.status}`));
|
|
1757
1787
|
}
|
|
@@ -1762,6 +1792,37 @@ var SwapManager = class _SwapManager {
|
|
|
1762
1792
|
}).catch(reject);
|
|
1763
1793
|
});
|
|
1764
1794
|
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Resolve the on-chain txid for a claimed submarine/chain swap.
|
|
1797
|
+
*
|
|
1798
|
+
* Chain swaps are claimed by the manager itself, so the claim txid captured
|
|
1799
|
+
* from the claimArk/claimBtc callback is the swap's on-chain completion and
|
|
1800
|
+
* is preferred — Boltz does not surface it via getSwapStatus at
|
|
1801
|
+
* transaction.claimed. Submarine swaps (claimed by Boltz) and chain swaps
|
|
1802
|
+
* we never claimed in this session (e.g. restored already-claimed) fall
|
|
1803
|
+
* back to the provider status. Rejects when no transaction id is available,
|
|
1804
|
+
* so callers never receive the Boltz swap id in place of a real txid.
|
|
1805
|
+
*/
|
|
1806
|
+
async resolveClaimedTxid(swapId) {
|
|
1807
|
+
const claimPromise = this.chainClaimPromises.get(swapId);
|
|
1808
|
+
if (claimPromise) {
|
|
1809
|
+
const claimTxid = await claimPromise.then(
|
|
1810
|
+
(result) => result?.txid,
|
|
1811
|
+
() => void 0
|
|
1812
|
+
);
|
|
1813
|
+
if (claimTxid && claimTxid.trim() !== "") {
|
|
1814
|
+
return { txid: claimTxid };
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
const status = await this.swapProvider.getSwapStatus(swapId);
|
|
1818
|
+
const txid = status.transaction?.id;
|
|
1819
|
+
if (!txid || txid.trim() === "") {
|
|
1820
|
+
throw new SwapError({
|
|
1821
|
+
message: `Transaction ID not available for completed swap ${swapId}`
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
return { txid };
|
|
1825
|
+
}
|
|
1765
1826
|
/**
|
|
1766
1827
|
* Check if a swap is currently being processed
|
|
1767
1828
|
* Useful for preventing race conditions
|
|
@@ -1965,6 +2026,7 @@ var SwapManager = class _SwapManager {
|
|
|
1965
2026
|
if (!this.monitoredSwaps.has(swap.id)) return;
|
|
1966
2027
|
this.monitoredSwaps.delete(swap.id);
|
|
1967
2028
|
this.swapSubscriptions.delete(swap.id);
|
|
2029
|
+
this.chainClaimPromises.delete(swap.id);
|
|
1968
2030
|
const retryTimer = this.pollRetryTimers.get(swap.id);
|
|
1969
2031
|
if (retryTimer) {
|
|
1970
2032
|
clearTimeout(retryTimer);
|
|
@@ -2135,7 +2197,9 @@ var SwapManager = class _SwapManager {
|
|
|
2135
2197
|
logger.error("claimArk callback not set");
|
|
2136
2198
|
return;
|
|
2137
2199
|
}
|
|
2138
|
-
|
|
2200
|
+
const claimPromise = this.claimArkCallback(swap);
|
|
2201
|
+
this.rememberChainClaim(swap.id, claimPromise);
|
|
2202
|
+
await claimPromise;
|
|
2139
2203
|
}
|
|
2140
2204
|
/**
|
|
2141
2205
|
* Execute claim action for chain swap Ark to Btc
|
|
@@ -2145,7 +2209,23 @@ var SwapManager = class _SwapManager {
|
|
|
2145
2209
|
logger.error("claimBtc callback not set");
|
|
2146
2210
|
return;
|
|
2147
2211
|
}
|
|
2148
|
-
|
|
2212
|
+
const claimPromise = this.claimBtcCallback(swap);
|
|
2213
|
+
this.rememberChainClaim(swap.id, claimPromise);
|
|
2214
|
+
await claimPromise;
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Store the in-flight claim promise returned by a claim callback so
|
|
2218
|
+
* {@link resolveClaimedTxid} can await it and surface the real on-chain
|
|
2219
|
+
* txid at transaction.claimed — even when that update races the still
|
|
2220
|
+
* in-flight claim. Storing the promise (not the resolved txid) closes the
|
|
2221
|
+
* window where the txid is not yet captured when transaction.claimed
|
|
2222
|
+
* arrives. Defensive against callbacks that don't return a promise (older
|
|
2223
|
+
* integrations, test doubles): those simply fall back to getSwapStatus.
|
|
2224
|
+
*/
|
|
2225
|
+
rememberChainClaim(swapId, claimPromise) {
|
|
2226
|
+
if (claimPromise) {
|
|
2227
|
+
this.chainClaimPromises.set(swapId, claimPromise);
|
|
2228
|
+
}
|
|
2149
2229
|
}
|
|
2150
2230
|
/**
|
|
2151
2231
|
* Execute refund action for chain swap Ark to Btc
|
|
@@ -2932,6 +3012,7 @@ var claimVHTLCwithOffchainTx = async (identity, vhtlcScript, serverXOnlyPublicKe
|
|
|
2932
3012
|
})
|
|
2933
3013
|
);
|
|
2934
3014
|
await arkProvider.finalizeTx(arkTxid, finalCheckpoints);
|
|
3015
|
+
return arkTxid;
|
|
2935
3016
|
};
|
|
2936
3017
|
var refundVHTLCwithOffchainTx = async (swapId, identity, arkProvider, boltzXOnlyPublicKey, ourXOnlyPublicKey, serverXOnlyPublicKey, input, output, arkInfo, refundFunc) => {
|
|
2937
3018
|
const rawCheckpointTapscript = import_base8.hex.decode(arkInfo.checkpointTapscript);
|
|
@@ -3090,12 +3171,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3090
3171
|
refund: async (swap) => {
|
|
3091
3172
|
await this.refundVHTLC(swap);
|
|
3092
3173
|
},
|
|
3093
|
-
claimArk:
|
|
3094
|
-
|
|
3095
|
-
},
|
|
3096
|
-
claimBtc: async (swap) => {
|
|
3097
|
-
await this.claimBtc(swap);
|
|
3098
|
-
},
|
|
3174
|
+
claimArk: (swap) => this.claimArk(swap),
|
|
3175
|
+
claimBtc: (swap) => this.claimBtc(swap),
|
|
3099
3176
|
refundArk: async (swap) => {
|
|
3100
3177
|
return this.refundArk(swap);
|
|
3101
3178
|
},
|
|
@@ -4106,6 +4183,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4106
4183
|
}
|
|
4107
4184
|
return new Promise((resolve, reject) => {
|
|
4108
4185
|
let claimStarted = false;
|
|
4186
|
+
let claimPromise;
|
|
4109
4187
|
const swap = { ...pendingSwap };
|
|
4110
4188
|
const onStatusUpdate = async (status, data) => {
|
|
4111
4189
|
const updateSwapStatus = async () => {
|
|
@@ -4123,16 +4201,24 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4123
4201
|
const updatedSwap = await updateSwapStatus();
|
|
4124
4202
|
if (claimStarted) return;
|
|
4125
4203
|
claimStarted = true;
|
|
4126
|
-
this.claimBtc(updatedSwap)
|
|
4204
|
+
claimPromise = this.claimBtc(updatedSwap);
|
|
4205
|
+
claimPromise.catch(reject);
|
|
4127
4206
|
break;
|
|
4128
4207
|
}
|
|
4129
|
-
case "transaction.claimed":
|
|
4208
|
+
case "transaction.claimed": {
|
|
4130
4209
|
await updateSwapStatus();
|
|
4131
|
-
const
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4210
|
+
const txid = await this.resolveChainClaimTxid(pendingSwap.id, claimPromise);
|
|
4211
|
+
if (!txid) {
|
|
4212
|
+
reject(
|
|
4213
|
+
new SwapError({
|
|
4214
|
+
message: `Transaction ID not available for claimed swap ${pendingSwap.id}.`
|
|
4215
|
+
})
|
|
4216
|
+
);
|
|
4217
|
+
break;
|
|
4218
|
+
}
|
|
4219
|
+
resolve({ txid });
|
|
4135
4220
|
break;
|
|
4221
|
+
}
|
|
4136
4222
|
case "transaction.lockupFailed":
|
|
4137
4223
|
await updateSwapStatus();
|
|
4138
4224
|
await this.quoteSwap(swap.response.id, quoteOptionsForSwap(swap)).catch(
|
|
@@ -4181,6 +4267,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4181
4267
|
/**
|
|
4182
4268
|
* Claim sats on BTC chain by claiming the HTLC.
|
|
4183
4269
|
* @param pendingSwap - The pending chain swap with BTC transaction hex.
|
|
4270
|
+
* @returns The BTC transaction ID of the claim.
|
|
4184
4271
|
*/
|
|
4185
4272
|
async claimBtc(pendingSwap) {
|
|
4186
4273
|
if (!pendingSwap.toAddress)
|
|
@@ -4253,6 +4340,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4253
4340
|
finalScriptWitness: [musigSigned.aggregatePartials()]
|
|
4254
4341
|
});
|
|
4255
4342
|
await this.swapProvider.postBtcTransaction(claimTx.hex);
|
|
4343
|
+
return { txid: claimTx.id };
|
|
4256
4344
|
}
|
|
4257
4345
|
/**
|
|
4258
4346
|
* When an ARK to BTC swap fails, refund every unspent VTXO at the chain
|
|
@@ -4452,6 +4540,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4452
4540
|
}
|
|
4453
4541
|
return new Promise((resolve, reject) => {
|
|
4454
4542
|
let claimStarted = false;
|
|
4543
|
+
let claimPromise;
|
|
4455
4544
|
const swap = { ...pendingSwap };
|
|
4456
4545
|
const onStatusUpdate = async (status, data) => {
|
|
4457
4546
|
const updateSwapStatus = () => {
|
|
@@ -4464,15 +4553,23 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4464
4553
|
await updateSwapStatus();
|
|
4465
4554
|
if (claimStarted) return;
|
|
4466
4555
|
claimStarted = true;
|
|
4467
|
-
this.claimArk(swap)
|
|
4556
|
+
claimPromise = this.claimArk(swap);
|
|
4557
|
+
claimPromise.catch(reject);
|
|
4468
4558
|
break;
|
|
4469
|
-
case "transaction.claimed":
|
|
4559
|
+
case "transaction.claimed": {
|
|
4470
4560
|
await updateSwapStatus();
|
|
4471
|
-
const
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4561
|
+
const txid = await this.resolveChainClaimTxid(pendingSwap.id, claimPromise);
|
|
4562
|
+
if (!txid) {
|
|
4563
|
+
reject(
|
|
4564
|
+
new SwapError({
|
|
4565
|
+
message: `Transaction ID not available for claimed swap ${pendingSwap.id}.`
|
|
4566
|
+
})
|
|
4567
|
+
);
|
|
4568
|
+
break;
|
|
4569
|
+
}
|
|
4570
|
+
resolve({ txid });
|
|
4475
4571
|
break;
|
|
4572
|
+
}
|
|
4476
4573
|
case "transaction.claim.pending":
|
|
4477
4574
|
await updateSwapStatus();
|
|
4478
4575
|
await this.signCooperativeClaimForServer(swap).catch((err) => {
|
|
@@ -4531,6 +4628,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4531
4628
|
* Claim sats on ARK chain by claiming the VHTLC.
|
|
4532
4629
|
* Refactored to use claimVHTLCIdentity + claimVHTLCwithOffchainTx utilities.
|
|
4533
4630
|
* @param pendingSwap - The pending chain swap.
|
|
4631
|
+
* @returns The Ark transaction ID of the claim.
|
|
4534
4632
|
*/
|
|
4535
4633
|
async claimArk(pendingSwap) {
|
|
4536
4634
|
if (!pendingSwap.toAddress)
|
|
@@ -4593,24 +4691,42 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4593
4691
|
script: import_sdk8.ArkAddress.decode(address).pkScript
|
|
4594
4692
|
};
|
|
4595
4693
|
const vhtlcIdentity = claimVHTLCIdentity(this.wallet.identity, preimage);
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
arkInfo,
|
|
4606
|
-
this.arkProvider
|
|
4607
|
-
);
|
|
4608
|
-
}
|
|
4694
|
+
const txid = (0, import_sdk8.isRecoverable)(vtxo) ? await this.joinBatch(vhtlcIdentity, input, output, arkInfo) : await claimVHTLCwithOffchainTx(
|
|
4695
|
+
vhtlcIdentity,
|
|
4696
|
+
vhtlcScript,
|
|
4697
|
+
serverXOnlyPublicKey,
|
|
4698
|
+
input,
|
|
4699
|
+
output,
|
|
4700
|
+
arkInfo,
|
|
4701
|
+
this.arkProvider
|
|
4702
|
+
);
|
|
4609
4703
|
const finalStatus = await this.getSwapStatus(pendingSwap.id);
|
|
4610
4704
|
await this.savePendingChainSwap({
|
|
4611
4705
|
...pendingSwap,
|
|
4612
4706
|
status: finalStatus.status
|
|
4613
4707
|
});
|
|
4708
|
+
return { txid };
|
|
4709
|
+
}
|
|
4710
|
+
/**
|
|
4711
|
+
* Resolve the on-chain txid for a chain swap at completion.
|
|
4712
|
+
*
|
|
4713
|
+
* The claim transaction we broadcast (claimBtc/claimArk) carries the real
|
|
4714
|
+
* on-chain txid; getSwapStatus does not surface it at transaction.claimed.
|
|
4715
|
+
* Prefer the claim's txid and fall back to the provider status only for
|
|
4716
|
+
* resumed swaps where we never ran the claim ourselves (claimPromise is
|
|
4717
|
+
* undefined). Returns undefined when no usable txid is available, so
|
|
4718
|
+
* callers never resolve with the Boltz swap id in place of a real txid.
|
|
4719
|
+
*/
|
|
4720
|
+
async resolveChainClaimTxid(swapId, claimPromise) {
|
|
4721
|
+
if (claimPromise) {
|
|
4722
|
+
const claimTxid = await claimPromise.then(
|
|
4723
|
+
(res) => res.txid,
|
|
4724
|
+
() => void 0
|
|
4725
|
+
);
|
|
4726
|
+
if (claimTxid && claimTxid.trim() !== "") return claimTxid;
|
|
4727
|
+
}
|
|
4728
|
+
const txid = (await this.getSwapStatus(swapId)).transaction?.id;
|
|
4729
|
+
return txid && txid.trim() !== "" ? txid : void 0;
|
|
4614
4730
|
}
|
|
4615
4731
|
/**
|
|
4616
4732
|
* Sign a cooperative claim for the server in BTC => ARK swaps.
|
|
@@ -5054,20 +5170,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5054
5170
|
onchainAmount: amount,
|
|
5055
5171
|
lockupAddress,
|
|
5056
5172
|
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
|
-
}
|
|
5173
|
+
timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5071
5174
|
},
|
|
5072
5175
|
status,
|
|
5073
5176
|
type: "reverse",
|
|
@@ -5100,26 +5203,20 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5100
5203
|
address: lockupAddress,
|
|
5101
5204
|
expectedAmount: amount,
|
|
5102
5205
|
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
|
-
}
|
|
5206
|
+
timeoutBlockHeights: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5117
5207
|
}
|
|
5118
5208
|
});
|
|
5119
5209
|
} else if (isRestoredChainSwap(swap)) {
|
|
5120
5210
|
const refundDetails = swap.refundDetails;
|
|
5121
5211
|
if (!refundDetails) continue;
|
|
5122
|
-
const {
|
|
5212
|
+
const {
|
|
5213
|
+
amount,
|
|
5214
|
+
lockupAddress,
|
|
5215
|
+
serverPublicKey,
|
|
5216
|
+
timeoutBlockHeight,
|
|
5217
|
+
tree,
|
|
5218
|
+
timeoutBlockHeights
|
|
5219
|
+
} = refundDetails;
|
|
5123
5220
|
chainSwaps.push({
|
|
5124
5221
|
id,
|
|
5125
5222
|
type: "chain",
|
|
@@ -5145,7 +5242,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5145
5242
|
amount,
|
|
5146
5243
|
lockupAddress,
|
|
5147
5244
|
serverPublicKey,
|
|
5148
|
-
timeoutBlockHeight
|
|
5245
|
+
timeoutBlockHeight,
|
|
5246
|
+
timeouts: resolveVhtlcTimeouts(tree, timeoutBlockHeights)
|
|
5149
5247
|
}
|
|
5150
5248
|
}
|
|
5151
5249
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-
|
|
2
|
-
export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-
|
|
1
|
+
import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-BlyUrhtO.cjs';
|
|
2
|
+
export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-BlyUrhtO.cjs';
|
|
3
3
|
import '@arkade-os/sdk/worker/expo';
|
|
4
4
|
import '@arkade-os/sdk';
|
|
5
|
-
import '../types
|
|
5
|
+
import '../types-D97i1LFu.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-
|
|
2
|
-
export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-
|
|
1
|
+
import { D as DefineSwapBackgroundTaskOptions } from '../swapsPollProcessor-Bv4Z2R7g.js';
|
|
2
|
+
export { P as PersistedSwapBackgroundConfig, S as SWAP_POLL_TASK_TYPE, a as SwapTaskDependencies, s as swapsPollProcessor } from '../swapsPollProcessor-Bv4Z2R7g.js';
|
|
3
3
|
import '@arkade-os/sdk/worker/expo';
|
|
4
4
|
import '@arkade-os/sdk';
|
|
5
|
-
import '../types
|
|
5
|
+
import '../types-D97i1LFu.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Define the Expo background task handler for swap polling.
|
package/dist/expo/background.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SWAP_POLL_TASK_TYPE,
|
|
3
3
|
swapsPollProcessor
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-DNCIVDU5.js";
|
|
5
5
|
import {
|
|
6
6
|
BoltzSwapProvider
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-CFB2NNGT.js";
|
|
8
8
|
import "../chunk-SJQJQO7P.js";
|
|
9
9
|
|
|
10
10
|
// src/expo/background.ts
|