@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
|
@@ -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 { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types
|
|
3
|
+
import { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-D97i1LFu.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dependencies injected into every swap processor at runtime.
|
|
@@ -473,8 +473,23 @@ interface SwapManagerClient {
|
|
|
473
473
|
interface SwapManagerCallbacks {
|
|
474
474
|
claim: (swap: BoltzReverseSwap) => Promise<void>;
|
|
475
475
|
refund: (swap: BoltzSubmarineSwap) => Promise<void>;
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Claim the ARK side of a BTC→ARK chain swap.
|
|
478
|
+
*
|
|
479
|
+
* Returns the on-chain claim txid — the manager surfaces it from
|
|
480
|
+
* {@link SwapManager.waitForSwapCompletion}, since Boltz does not report a
|
|
481
|
+
* usable transaction id for chain swaps at `transaction.claimed`.
|
|
482
|
+
*/
|
|
483
|
+
claimArk: (swap: BoltzChainSwap) => Promise<{
|
|
484
|
+
txid: string;
|
|
485
|
+
}>;
|
|
486
|
+
/**
|
|
487
|
+
* Claim the BTC side of an ARK→BTC chain swap. Returns the on-chain claim
|
|
488
|
+
* txid; see {@link SwapManagerCallbacks.claimArk}.
|
|
489
|
+
*/
|
|
490
|
+
claimBtc: (swap: BoltzChainSwap) => Promise<{
|
|
491
|
+
txid: string;
|
|
492
|
+
}>;
|
|
478
493
|
refundArk: (swap: BoltzChainSwap) => Promise<ChainArkRefundOutcome>;
|
|
479
494
|
signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
|
|
480
495
|
saveSwap: (swap: BoltzSwap) => Promise<void>;
|
|
@@ -530,6 +545,7 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
530
545
|
private webSocketUnavailable;
|
|
531
546
|
private swapsInProgress;
|
|
532
547
|
private swapSubscriptions;
|
|
548
|
+
private chainClaimPromises;
|
|
533
549
|
private claimCallback;
|
|
534
550
|
private refundCallback;
|
|
535
551
|
private claimArkCallback;
|
|
@@ -629,13 +645,30 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
629
645
|
* Blocks until the swap reaches a final status or fails.
|
|
630
646
|
* Useful when you want blocking behavior even with SwapManager enabled.
|
|
631
647
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
648
|
+
* If the swap is already in a final status, resolves immediately with the
|
|
649
|
+
* on-chain txid of the successfully claimed swap (reverse: from
|
|
650
|
+
* getReverseSwapTxId; submarine/chain: from getSwapStatus) and throws for a
|
|
651
|
+
* failed final status.
|
|
652
|
+
*
|
|
653
|
+
* @throws If the swap is already in a failed final status.
|
|
634
654
|
* @throws If the swap is not found in the manager.
|
|
655
|
+
* @throws If a completed swap has no transaction id available yet.
|
|
635
656
|
*/
|
|
636
657
|
waitForSwapCompletion(swapId: string): Promise<{
|
|
637
658
|
txid: string;
|
|
638
659
|
}>;
|
|
660
|
+
/**
|
|
661
|
+
* Resolve the on-chain txid for a claimed submarine/chain swap.
|
|
662
|
+
*
|
|
663
|
+
* Chain swaps are claimed by the manager itself, so the claim txid captured
|
|
664
|
+
* from the claimArk/claimBtc callback is the swap's on-chain completion and
|
|
665
|
+
* is preferred — Boltz does not surface it via getSwapStatus at
|
|
666
|
+
* transaction.claimed. Submarine swaps (claimed by Boltz) and chain swaps
|
|
667
|
+
* we never claimed in this session (e.g. restored already-claimed) fall
|
|
668
|
+
* back to the provider status. Rejects when no transaction id is available,
|
|
669
|
+
* so callers never receive the Boltz swap id in place of a real txid.
|
|
670
|
+
*/
|
|
671
|
+
private resolveClaimedTxid;
|
|
639
672
|
/**
|
|
640
673
|
* Check if a swap is currently being processed
|
|
641
674
|
* Useful for preventing race conditions
|
|
@@ -711,6 +744,16 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
711
744
|
* Execute claim action for chain swap Ark to Btc
|
|
712
745
|
*/
|
|
713
746
|
private executeClaimBtcAction;
|
|
747
|
+
/**
|
|
748
|
+
* Store the in-flight claim promise returned by a claim callback so
|
|
749
|
+
* {@link resolveClaimedTxid} can await it and surface the real on-chain
|
|
750
|
+
* txid at transaction.claimed — even when that update races the still
|
|
751
|
+
* in-flight claim. Storing the promise (not the resolved txid) closes the
|
|
752
|
+
* window where the txid is not yet captured when transaction.claimed
|
|
753
|
+
* arrives. Defensive against callbacks that don't return a promise (older
|
|
754
|
+
* integrations, test doubles): those simply fall back to getSwapStatus.
|
|
755
|
+
*/
|
|
756
|
+
private rememberChainClaim;
|
|
714
757
|
/**
|
|
715
758
|
* Execute refund action for chain swap Ark to Btc
|
|
716
759
|
*/
|
|
@@ -473,8 +473,23 @@ interface SwapManagerClient {
|
|
|
473
473
|
interface SwapManagerCallbacks {
|
|
474
474
|
claim: (swap: BoltzReverseSwap) => Promise<void>;
|
|
475
475
|
refund: (swap: BoltzSubmarineSwap) => Promise<void>;
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Claim the ARK side of a BTC→ARK chain swap.
|
|
478
|
+
*
|
|
479
|
+
* Returns the on-chain claim txid — the manager surfaces it from
|
|
480
|
+
* {@link SwapManager.waitForSwapCompletion}, since Boltz does not report a
|
|
481
|
+
* usable transaction id for chain swaps at `transaction.claimed`.
|
|
482
|
+
*/
|
|
483
|
+
claimArk: (swap: BoltzChainSwap) => Promise<{
|
|
484
|
+
txid: string;
|
|
485
|
+
}>;
|
|
486
|
+
/**
|
|
487
|
+
* Claim the BTC side of an ARK→BTC chain swap. Returns the on-chain claim
|
|
488
|
+
* txid; see {@link SwapManagerCallbacks.claimArk}.
|
|
489
|
+
*/
|
|
490
|
+
claimBtc: (swap: BoltzChainSwap) => Promise<{
|
|
491
|
+
txid: string;
|
|
492
|
+
}>;
|
|
478
493
|
refundArk: (swap: BoltzChainSwap) => Promise<ChainArkRefundOutcome>;
|
|
479
494
|
signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
|
|
480
495
|
saveSwap: (swap: BoltzSwap) => Promise<void>;
|
|
@@ -530,6 +545,7 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
530
545
|
private webSocketUnavailable;
|
|
531
546
|
private swapsInProgress;
|
|
532
547
|
private swapSubscriptions;
|
|
548
|
+
private chainClaimPromises;
|
|
533
549
|
private claimCallback;
|
|
534
550
|
private refundCallback;
|
|
535
551
|
private claimArkCallback;
|
|
@@ -629,13 +645,30 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
629
645
|
* Blocks until the swap reaches a final status or fails.
|
|
630
646
|
* Useful when you want blocking behavior even with SwapManager enabled.
|
|
631
647
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
648
|
+
* If the swap is already in a final status, resolves immediately with the
|
|
649
|
+
* on-chain txid of the successfully claimed swap (reverse: from
|
|
650
|
+
* getReverseSwapTxId; submarine/chain: from getSwapStatus) and throws for a
|
|
651
|
+
* failed final status.
|
|
652
|
+
*
|
|
653
|
+
* @throws If the swap is already in a failed final status.
|
|
634
654
|
* @throws If the swap is not found in the manager.
|
|
655
|
+
* @throws If a completed swap has no transaction id available yet.
|
|
635
656
|
*/
|
|
636
657
|
waitForSwapCompletion(swapId: string): Promise<{
|
|
637
658
|
txid: string;
|
|
638
659
|
}>;
|
|
660
|
+
/**
|
|
661
|
+
* Resolve the on-chain txid for a claimed submarine/chain swap.
|
|
662
|
+
*
|
|
663
|
+
* Chain swaps are claimed by the manager itself, so the claim txid captured
|
|
664
|
+
* from the claimArk/claimBtc callback is the swap's on-chain completion and
|
|
665
|
+
* is preferred — Boltz does not surface it via getSwapStatus at
|
|
666
|
+
* transaction.claimed. Submarine swaps (claimed by Boltz) and chain swaps
|
|
667
|
+
* we never claimed in this session (e.g. restored already-claimed) fall
|
|
668
|
+
* back to the provider status. Rejects when no transaction id is available,
|
|
669
|
+
* so callers never receive the Boltz swap id in place of a real txid.
|
|
670
|
+
*/
|
|
671
|
+
private resolveClaimedTxid;
|
|
639
672
|
/**
|
|
640
673
|
* Check if a swap is currently being processed
|
|
641
674
|
* Useful for preventing race conditions
|
|
@@ -711,6 +744,16 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
711
744
|
* Execute claim action for chain swap Ark to Btc
|
|
712
745
|
*/
|
|
713
746
|
private executeClaimBtcAction;
|
|
747
|
+
/**
|
|
748
|
+
* Store the in-flight claim promise returned by a claim callback so
|
|
749
|
+
* {@link resolveClaimedTxid} can await it and surface the real on-chain
|
|
750
|
+
* txid at transaction.claimed — even when that update races the still
|
|
751
|
+
* in-flight claim. Storing the promise (not the resolved txid) closes the
|
|
752
|
+
* window where the txid is not yet captured when transaction.claimed
|
|
753
|
+
* arrives. Defensive against callbacks that don't return a promise (older
|
|
754
|
+
* integrations, test doubles): those simply fall back to getSwapStatus.
|
|
755
|
+
*/
|
|
756
|
+
private rememberChainClaim;
|
|
714
757
|
/**
|
|
715
758
|
* Execute refund action for chain swap Ark to Btc
|
|
716
759
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/boltz-swap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
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.
|
|
79
|
+
"@arkade-os/sdk": "0.4.31"
|
|
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.
|
|
95
|
+
"vite": "^7.3.2"
|
|
96
96
|
},
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public",
|