@arkade-os/boltz-swap 0.3.33 → 0.3.34
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-9M7FRuq1.d.cts → arkade-swaps-BXAD1s8j.d.ts} +13 -4
- package/dist/{arkade-swaps-DNsyWeFr.d.ts → arkade-swaps-CfMets16.d.cts} +13 -4
- package/dist/{chunk-HNQDJOLM.js → chunk-5K2FS2FE.js} +1 -1
- package/dist/{chunk-SJ5SYSMK.js → chunk-TDBUZE4N.js} +269 -90
- package/dist/expo/background.cjs +270 -90
- package/dist/expo/background.d.cts +3 -3
- package/dist/expo/background.d.ts +3 -3
- package/dist/expo/background.js +3 -2
- package/dist/expo/index.cjs +269 -90
- package/dist/expo/index.d.cts +5 -5
- package/dist/expo/index.d.ts +5 -5
- package/dist/expo/index.js +2 -2
- package/dist/index.cjs +305 -94
- package/dist/index.d.cts +21 -7
- package/dist/index.d.ts +21 -7
- package/dist/index.js +40 -6
- 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-CuITxZie.d.cts → swapsPollProcessor-BpAqG0V6.d.cts} +1 -1
- package/dist/{swapsPollProcessor-CEgeGlbP.d.ts → swapsPollProcessor-DFVOAy_-.d.ts} +1 -1
- package/dist/{types-CrKkVzBB.d.cts → types--axEWA8c.d.cts} +34 -2
- package/dist/{types-CrKkVzBB.d.ts → types--axEWA8c.d.ts} +34 -2
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-
|
|
2
|
-
export { A as ArkadeSwaps } from './arkade-swaps-
|
|
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, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as
|
|
4
|
-
export {
|
|
1
|
+
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-CfMets16.cjs';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-CfMets16.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, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as ChainArkRefundOutcome, n as SwapRepository, o as SwapManagerClient, p as GetSwapsFilter } from './types--axEWA8c.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 SubmarineRecoveryStatus, x as SwapManager, y as SwapManagerCallbacks, z as SwapManagerConfig, E as SwapManagerEvents, V as Vtxo, H as isChainClaimableStatus, J as isChainFailedStatus, K as isChainFinalStatus, M as isChainPendingStatus, O as isChainRefundableStatus, Q as isChainSignableStatus, R as isChainSuccessStatus, T as isChainSwapClaimable, U as isChainSwapRefundable, W as isPendingChainSwap, X as isPendingReverseSwap, Y as isPendingSubmarineSwap, Z as isReverseClaimableStatus, _ as isReverseFailedStatus, $ as isReverseFinalStatus, a0 as isReversePendingStatus, a1 as isReverseSuccessStatus, a2 as isReverseSwapClaimable, a3 as isSubmarineFailedStatus, a4 as isSubmarineFinalStatus, a5 as isSubmarinePendingStatus, a6 as isSubmarineRefundableStatus, a7 as isSubmarineSuccessStatus, a8 as isSubmarineSwapRefundable } from './types--axEWA8c.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';
|
|
@@ -93,7 +93,7 @@ declare class PreimageFetchError extends SwapError {
|
|
|
93
93
|
constructor(options?: ErrorOptions);
|
|
94
94
|
}
|
|
95
95
|
/** Reason a `quoteSwap` was rejected before being posted to Boltz. */
|
|
96
|
-
type QuoteRejectionReason = "below_floor" | "non_positive" | "no_baseline";
|
|
96
|
+
type QuoteRejectionReason = "below_floor" | "non_positive" | "non_safe_integer" | "no_baseline";
|
|
97
97
|
type QuoteRejectedOptions = ErrorOptions & ({
|
|
98
98
|
reason: "below_floor";
|
|
99
99
|
quotedAmount: number;
|
|
@@ -101,6 +101,9 @@ type QuoteRejectedOptions = ErrorOptions & ({
|
|
|
101
101
|
} | {
|
|
102
102
|
reason: "non_positive";
|
|
103
103
|
quotedAmount: number;
|
|
104
|
+
} | {
|
|
105
|
+
reason: "non_safe_integer";
|
|
106
|
+
quotedAmount: number;
|
|
104
107
|
} | {
|
|
105
108
|
reason: "no_baseline";
|
|
106
109
|
});
|
|
@@ -496,6 +499,7 @@ type RequestRefundArk = RequestEnvelope & {
|
|
|
496
499
|
};
|
|
497
500
|
type ResponseRefundArk = ResponseEnvelope & {
|
|
498
501
|
type: "ARK_REFUND_EXECUTED";
|
|
502
|
+
payload: ChainArkRefundOutcome;
|
|
499
503
|
};
|
|
500
504
|
type RequestSignServerClaim = RequestEnvelope & {
|
|
501
505
|
type: "SIGN_SERVER_CLAIM";
|
|
@@ -749,7 +753,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
749
753
|
}>;
|
|
750
754
|
claimArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
751
755
|
claimBtc(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
752
|
-
refundArk(pendingSwap: BoltzChainSwap): Promise<
|
|
756
|
+
refundArk(pendingSwap: BoltzChainSwap): Promise<ChainArkRefundOutcome>;
|
|
753
757
|
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
754
758
|
verifyChainSwap(args: {
|
|
755
759
|
to: Chain;
|
|
@@ -855,4 +859,14 @@ declare class IndexedDbSwapRepository implements SwapRepository {
|
|
|
855
859
|
[Symbol.asyncDispose](): Promise<void>;
|
|
856
860
|
}
|
|
857
861
|
|
|
858
|
-
|
|
862
|
+
declare class InMemorySwapRepository implements SwapRepository {
|
|
863
|
+
readonly version: 1;
|
|
864
|
+
private readonly swaps;
|
|
865
|
+
saveSwap<T extends BoltzSwap>(swap: T): Promise<void>;
|
|
866
|
+
deleteSwap(id: string): Promise<void>;
|
|
867
|
+
getAllSwaps<T extends BoltzSwap>(filter?: GetSwapsFilter): Promise<T[]>;
|
|
868
|
+
clear(): Promise<void>;
|
|
869
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, InMemorySwapRepository, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, QuoteRejectedError, type QuoteRejectionReason, QuoteSwapOptions, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-
|
|
2
|
-
export { A as ArkadeSwaps } from './arkade-swaps-
|
|
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, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as
|
|
4
|
-
export {
|
|
1
|
+
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-BXAD1s8j.js';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-BXAD1s8j.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, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as ChainArkRefundOutcome, n as SwapRepository, o as SwapManagerClient, p as GetSwapsFilter } from './types--axEWA8c.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 SubmarineRecoveryStatus, x as SwapManager, y as SwapManagerCallbacks, z as SwapManagerConfig, E as SwapManagerEvents, V as Vtxo, H as isChainClaimableStatus, J as isChainFailedStatus, K as isChainFinalStatus, M as isChainPendingStatus, O as isChainRefundableStatus, Q as isChainSignableStatus, R as isChainSuccessStatus, T as isChainSwapClaimable, U as isChainSwapRefundable, W as isPendingChainSwap, X as isPendingReverseSwap, Y as isPendingSubmarineSwap, Z as isReverseClaimableStatus, _ as isReverseFailedStatus, $ as isReverseFinalStatus, a0 as isReversePendingStatus, a1 as isReverseSuccessStatus, a2 as isReverseSwapClaimable, a3 as isSubmarineFailedStatus, a4 as isSubmarineFinalStatus, a5 as isSubmarinePendingStatus, a6 as isSubmarineRefundableStatus, a7 as isSubmarineSuccessStatus, a8 as isSubmarineSwapRefundable } from './types--axEWA8c.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';
|
|
@@ -93,7 +93,7 @@ declare class PreimageFetchError extends SwapError {
|
|
|
93
93
|
constructor(options?: ErrorOptions);
|
|
94
94
|
}
|
|
95
95
|
/** Reason a `quoteSwap` was rejected before being posted to Boltz. */
|
|
96
|
-
type QuoteRejectionReason = "below_floor" | "non_positive" | "no_baseline";
|
|
96
|
+
type QuoteRejectionReason = "below_floor" | "non_positive" | "non_safe_integer" | "no_baseline";
|
|
97
97
|
type QuoteRejectedOptions = ErrorOptions & ({
|
|
98
98
|
reason: "below_floor";
|
|
99
99
|
quotedAmount: number;
|
|
@@ -101,6 +101,9 @@ type QuoteRejectedOptions = ErrorOptions & ({
|
|
|
101
101
|
} | {
|
|
102
102
|
reason: "non_positive";
|
|
103
103
|
quotedAmount: number;
|
|
104
|
+
} | {
|
|
105
|
+
reason: "non_safe_integer";
|
|
106
|
+
quotedAmount: number;
|
|
104
107
|
} | {
|
|
105
108
|
reason: "no_baseline";
|
|
106
109
|
});
|
|
@@ -496,6 +499,7 @@ type RequestRefundArk = RequestEnvelope & {
|
|
|
496
499
|
};
|
|
497
500
|
type ResponseRefundArk = ResponseEnvelope & {
|
|
498
501
|
type: "ARK_REFUND_EXECUTED";
|
|
502
|
+
payload: ChainArkRefundOutcome;
|
|
499
503
|
};
|
|
500
504
|
type RequestSignServerClaim = RequestEnvelope & {
|
|
501
505
|
type: "SIGN_SERVER_CLAIM";
|
|
@@ -749,7 +753,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
749
753
|
}>;
|
|
750
754
|
claimArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
751
755
|
claimBtc(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
752
|
-
refundArk(pendingSwap: BoltzChainSwap): Promise<
|
|
756
|
+
refundArk(pendingSwap: BoltzChainSwap): Promise<ChainArkRefundOutcome>;
|
|
753
757
|
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
754
758
|
verifyChainSwap(args: {
|
|
755
759
|
to: Chain;
|
|
@@ -855,4 +859,14 @@ declare class IndexedDbSwapRepository implements SwapRepository {
|
|
|
855
859
|
[Symbol.asyncDispose](): Promise<void>;
|
|
856
860
|
}
|
|
857
861
|
|
|
858
|
-
|
|
862
|
+
declare class InMemorySwapRepository implements SwapRepository {
|
|
863
|
+
readonly version: 1;
|
|
864
|
+
private readonly swaps;
|
|
865
|
+
saveSwap<T extends BoltzSwap>(swap: T): Promise<void>;
|
|
866
|
+
deleteSwap(id: string): Promise<void>;
|
|
867
|
+
getAllSwaps<T extends BoltzSwap>(filter?: GetSwapsFilter): Promise<T[]>;
|
|
868
|
+
clear(): Promise<void>;
|
|
869
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, InMemorySwapRepository, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, QuoteRejectedError, type QuoteRejectionReason, QuoteSwapOptions, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
|
package/dist/index.js
CHANGED
|
@@ -52,8 +52,11 @@ import {
|
|
|
52
52
|
updateReverseSwapStatus,
|
|
53
53
|
updateSubmarineSwapStatus,
|
|
54
54
|
verifySignatures
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import
|
|
55
|
+
} from "./chunk-TDBUZE4N.js";
|
|
56
|
+
import {
|
|
57
|
+
applyCreatedAtOrder,
|
|
58
|
+
applySwapsFilter
|
|
59
|
+
} from "./chunk-SJQJQO7P.js";
|
|
57
60
|
|
|
58
61
|
// src/serviceWorker/arkade-swaps-message-handler.ts
|
|
59
62
|
import { RestArkProvider, RestIndexerProvider } from "@arkade-os/sdk";
|
|
@@ -403,9 +406,14 @@ var ArkadeSwapsMessageHandler = class _ArkadeSwapsMessageHandler {
|
|
|
403
406
|
case "CLAIM_BTC":
|
|
404
407
|
await this.handler.claimBtc(message.payload);
|
|
405
408
|
return this.tagged({ id, type: "BTC_CLAIM_EXECUTED" });
|
|
406
|
-
case "REFUND_ARK":
|
|
407
|
-
await this.handler.refundArk(message.payload);
|
|
408
|
-
return this.tagged({
|
|
409
|
+
case "REFUND_ARK": {
|
|
410
|
+
const outcome = await this.handler.refundArk(message.payload);
|
|
411
|
+
return this.tagged({
|
|
412
|
+
id,
|
|
413
|
+
type: "ARK_REFUND_EXECUTED",
|
|
414
|
+
payload: outcome
|
|
415
|
+
});
|
|
416
|
+
}
|
|
409
417
|
case "SIGN_SERVER_CLAIM":
|
|
410
418
|
await this.handler.signCooperativeClaimForServer(message.payload);
|
|
411
419
|
return this.tagged({ id, type: "SERVER_CLAIM_SIGNED" });
|
|
@@ -1084,12 +1092,13 @@ var ServiceWorkerArkadeSwaps = class _ServiceWorkerArkadeSwaps {
|
|
|
1084
1092
|
});
|
|
1085
1093
|
}
|
|
1086
1094
|
async refundArk(pendingSwap) {
|
|
1087
|
-
await this.sendMessage({
|
|
1095
|
+
const res = await this.sendMessage({
|
|
1088
1096
|
id: getRandomId(),
|
|
1089
1097
|
tag: this.messageTag,
|
|
1090
1098
|
type: "REFUND_ARK",
|
|
1091
1099
|
payload: pendingSwap
|
|
1092
1100
|
});
|
|
1101
|
+
return res.payload;
|
|
1093
1102
|
}
|
|
1094
1103
|
async signCooperativeClaimForServer(pendingSwap) {
|
|
1095
1104
|
await this.sendMessage({
|
|
@@ -1499,12 +1508,37 @@ async function getContractCollection(storage, contractType) {
|
|
|
1499
1508
|
);
|
|
1500
1509
|
}
|
|
1501
1510
|
}
|
|
1511
|
+
|
|
1512
|
+
// src/repositories/inMemory/swap-repository.ts
|
|
1513
|
+
var InMemorySwapRepository = class {
|
|
1514
|
+
version = 1;
|
|
1515
|
+
swaps = /* @__PURE__ */ new Map();
|
|
1516
|
+
async saveSwap(swap) {
|
|
1517
|
+
this.swaps.set(swap.id, swap);
|
|
1518
|
+
}
|
|
1519
|
+
async deleteSwap(id) {
|
|
1520
|
+
this.swaps.delete(id);
|
|
1521
|
+
}
|
|
1522
|
+
async getAllSwaps(filter) {
|
|
1523
|
+
const swaps = [...this.swaps.values()];
|
|
1524
|
+
if (!filter || Object.keys(filter).length === 0) return swaps;
|
|
1525
|
+
const filtered = applySwapsFilter(swaps, filter);
|
|
1526
|
+
return applyCreatedAtOrder(filtered, filter);
|
|
1527
|
+
}
|
|
1528
|
+
async clear() {
|
|
1529
|
+
this.swaps.clear();
|
|
1530
|
+
}
|
|
1531
|
+
async [Symbol.asyncDispose]() {
|
|
1532
|
+
await this.clear();
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1502
1535
|
export {
|
|
1503
1536
|
ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler,
|
|
1504
1537
|
ArkadeSwaps,
|
|
1505
1538
|
ArkadeSwapsMessageHandler,
|
|
1506
1539
|
BoltzRefundError,
|
|
1507
1540
|
BoltzSwapProvider,
|
|
1541
|
+
InMemorySwapRepository,
|
|
1508
1542
|
IndexedDbSwapRepository,
|
|
1509
1543
|
InsufficientFundsError,
|
|
1510
1544
|
InvoiceExpiredError,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
|
-
import {
|
|
2
|
+
import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types--axEWA8c.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 {
|
|
2
|
+
import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types--axEWA8c.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 {
|
|
2
|
+
import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types--axEWA8c.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 {
|
|
2
|
+
import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types--axEWA8c.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 {
|
|
3
|
+
import { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types--axEWA8c.cjs';
|
|
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 {
|
|
3
|
+
import { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types--axEWA8c.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dependencies injected into every swap processor at runtime.
|
|
@@ -475,7 +475,7 @@ interface SwapManagerCallbacks {
|
|
|
475
475
|
refund: (swap: BoltzSubmarineSwap) => Promise<void>;
|
|
476
476
|
claimArk: (swap: BoltzChainSwap) => Promise<void>;
|
|
477
477
|
claimBtc: (swap: BoltzChainSwap) => Promise<void>;
|
|
478
|
-
refundArk: (swap: BoltzChainSwap) => Promise<
|
|
478
|
+
refundArk: (swap: BoltzChainSwap) => Promise<ChainArkRefundOutcome>;
|
|
479
479
|
signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
|
|
480
480
|
saveSwap: (swap: BoltzSwap) => Promise<void>;
|
|
481
481
|
}
|
|
@@ -498,6 +498,13 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
498
498
|
* enough that a real "swap unknown to this provider" surfaces quickly.
|
|
499
499
|
*/
|
|
500
500
|
private static readonly NOT_FOUND_THRESHOLD;
|
|
501
|
+
/**
|
|
502
|
+
* Delay between re-attempts of a chain refund that left VTXOs deferred
|
|
503
|
+
* (e.g. pre-CLTV recoverable VTXO, or Boltz 3-of-3 rejected before CLTV
|
|
504
|
+
* has elapsed). Boltz won't send another status update once the swap
|
|
505
|
+
* is `swap.expired`, so the manager owns the local retry cadence.
|
|
506
|
+
*/
|
|
507
|
+
private static readonly REFUND_RETRY_DELAY_MS;
|
|
501
508
|
private readonly swapProvider;
|
|
502
509
|
private readonly config;
|
|
503
510
|
private swapUpdateListeners;
|
|
@@ -513,6 +520,7 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
513
520
|
private reconnectTimer;
|
|
514
521
|
private initialPollTimer;
|
|
515
522
|
private pollRetryTimers;
|
|
523
|
+
private refundRetryTimers;
|
|
516
524
|
private notFoundCounts;
|
|
517
525
|
private isRunning;
|
|
518
526
|
private currentReconnectDelay;
|
|
@@ -669,6 +677,19 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
669
677
|
* This is the core logic that determines what actions to take
|
|
670
678
|
*/
|
|
671
679
|
private handleSwapStatusUpdate;
|
|
680
|
+
/**
|
|
681
|
+
* Drop a swap from monitoring and emit the terminal completion event.
|
|
682
|
+
* Shared between the on-status-update finalization path and the
|
|
683
|
+
* refund-retry finalization path (used when a previously-deferred
|
|
684
|
+
* chain refund has finished its remaining work).
|
|
685
|
+
*/
|
|
686
|
+
private finalizeMonitoredSwap;
|
|
687
|
+
/**
|
|
688
|
+
* Schedule another `executeAutonomousAction` run for a chain swap whose
|
|
689
|
+
* refund left VTXOs deferred. After the retry completes, if no further
|
|
690
|
+
* deferral was reported, finalize monitoring cleanup.
|
|
691
|
+
*/
|
|
692
|
+
private scheduleRefundRetry;
|
|
672
693
|
/**
|
|
673
694
|
* Execute autonomous action based on swap status
|
|
674
695
|
* Uses locking to prevent race conditions with manual operations
|
|
@@ -947,6 +968,17 @@ interface SubmarineRefundOutcome {
|
|
|
947
968
|
*/
|
|
948
969
|
skipped: number;
|
|
949
970
|
}
|
|
971
|
+
/** Outcome of a single `refundArk` call: how many VTXOs were swept vs. deferred. */
|
|
972
|
+
interface ChainArkRefundOutcome {
|
|
973
|
+
/** Number of VTXOs successfully refunded. */
|
|
974
|
+
swept: number;
|
|
975
|
+
/**
|
|
976
|
+
* Number of VTXOs that could not be refunded yet (e.g. recoverable VTXO
|
|
977
|
+
* pre-CLTV, or Boltz rejected and CLTV still not satisfied). The caller
|
|
978
|
+
* is expected to retry these later.
|
|
979
|
+
*/
|
|
980
|
+
skipped: number;
|
|
981
|
+
}
|
|
950
982
|
/** Per-swap outcome of a bulk recovery call. */
|
|
951
983
|
interface SubmarineRecoveryResult {
|
|
952
984
|
/** ID of the swap whose VHTLC we attempted to refund. */
|
|
@@ -1105,4 +1137,4 @@ interface ChainFeesResponse {
|
|
|
1105
1137
|
};
|
|
1106
1138
|
}
|
|
1107
1139
|
|
|
1108
|
-
export {
|
|
1140
|
+
export { isReverseFinalStatus as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerEvents as E, type FeesResponse as F, type GetSwapStatusResponse as G, isChainClaimableStatus as H, type IncomingPaymentSubscription as I, isChainFailedStatus as J, isChainFinalStatus as K, type LimitsResponse as L, isChainPendingStatus as M, type Network as N, isChainRefundableStatus as O, type PendingChainSwap as P, isChainSignableStatus as Q, isChainSuccessStatus as R, type SendLightningPaymentRequest as S, isChainSwapClaimable as T, isChainSwapRefundable as U, type Vtxo as V, isPendingChainSwap as W, isPendingReverseSwap as X, isPendingSubmarineSwap as Y, isReverseClaimableStatus as Z, isReverseFailedStatus as _, type BoltzChainSwap as a, isReversePendingStatus as a0, isReverseSuccessStatus as a1, isReverseSwapClaimable as a2, isSubmarineFailedStatus as a3, isSubmarineFinalStatus as a4, isSubmarinePendingStatus as a5, isSubmarineRefundableStatus as a6, isSubmarineSuccessStatus as a7, isSubmarineSwapRefundable as a8, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type SubmarineRefundOutcome as g, type SubmarineRecoveryInfo as h, type SubmarineRecoveryResult as i, type ChainFeesResponse as j, type ArkToBtcResponse as k, type BtcToArkResponse as l, type ChainArkRefundOutcome as m, type SwapRepository as n, type SwapManagerClient as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineRecoveryStatus as w, SwapManager as x, type SwapManagerCallbacks as y, type SwapManagerConfig as z };
|
|
@@ -475,7 +475,7 @@ interface SwapManagerCallbacks {
|
|
|
475
475
|
refund: (swap: BoltzSubmarineSwap) => Promise<void>;
|
|
476
476
|
claimArk: (swap: BoltzChainSwap) => Promise<void>;
|
|
477
477
|
claimBtc: (swap: BoltzChainSwap) => Promise<void>;
|
|
478
|
-
refundArk: (swap: BoltzChainSwap) => Promise<
|
|
478
|
+
refundArk: (swap: BoltzChainSwap) => Promise<ChainArkRefundOutcome>;
|
|
479
479
|
signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
|
|
480
480
|
saveSwap: (swap: BoltzSwap) => Promise<void>;
|
|
481
481
|
}
|
|
@@ -498,6 +498,13 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
498
498
|
* enough that a real "swap unknown to this provider" surfaces quickly.
|
|
499
499
|
*/
|
|
500
500
|
private static readonly NOT_FOUND_THRESHOLD;
|
|
501
|
+
/**
|
|
502
|
+
* Delay between re-attempts of a chain refund that left VTXOs deferred
|
|
503
|
+
* (e.g. pre-CLTV recoverable VTXO, or Boltz 3-of-3 rejected before CLTV
|
|
504
|
+
* has elapsed). Boltz won't send another status update once the swap
|
|
505
|
+
* is `swap.expired`, so the manager owns the local retry cadence.
|
|
506
|
+
*/
|
|
507
|
+
private static readonly REFUND_RETRY_DELAY_MS;
|
|
501
508
|
private readonly swapProvider;
|
|
502
509
|
private readonly config;
|
|
503
510
|
private swapUpdateListeners;
|
|
@@ -513,6 +520,7 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
513
520
|
private reconnectTimer;
|
|
514
521
|
private initialPollTimer;
|
|
515
522
|
private pollRetryTimers;
|
|
523
|
+
private refundRetryTimers;
|
|
516
524
|
private notFoundCounts;
|
|
517
525
|
private isRunning;
|
|
518
526
|
private currentReconnectDelay;
|
|
@@ -669,6 +677,19 @@ declare class SwapManager implements SwapManagerClient {
|
|
|
669
677
|
* This is the core logic that determines what actions to take
|
|
670
678
|
*/
|
|
671
679
|
private handleSwapStatusUpdate;
|
|
680
|
+
/**
|
|
681
|
+
* Drop a swap from monitoring and emit the terminal completion event.
|
|
682
|
+
* Shared between the on-status-update finalization path and the
|
|
683
|
+
* refund-retry finalization path (used when a previously-deferred
|
|
684
|
+
* chain refund has finished its remaining work).
|
|
685
|
+
*/
|
|
686
|
+
private finalizeMonitoredSwap;
|
|
687
|
+
/**
|
|
688
|
+
* Schedule another `executeAutonomousAction` run for a chain swap whose
|
|
689
|
+
* refund left VTXOs deferred. After the retry completes, if no further
|
|
690
|
+
* deferral was reported, finalize monitoring cleanup.
|
|
691
|
+
*/
|
|
692
|
+
private scheduleRefundRetry;
|
|
672
693
|
/**
|
|
673
694
|
* Execute autonomous action based on swap status
|
|
674
695
|
* Uses locking to prevent race conditions with manual operations
|
|
@@ -947,6 +968,17 @@ interface SubmarineRefundOutcome {
|
|
|
947
968
|
*/
|
|
948
969
|
skipped: number;
|
|
949
970
|
}
|
|
971
|
+
/** Outcome of a single `refundArk` call: how many VTXOs were swept vs. deferred. */
|
|
972
|
+
interface ChainArkRefundOutcome {
|
|
973
|
+
/** Number of VTXOs successfully refunded. */
|
|
974
|
+
swept: number;
|
|
975
|
+
/**
|
|
976
|
+
* Number of VTXOs that could not be refunded yet (e.g. recoverable VTXO
|
|
977
|
+
* pre-CLTV, or Boltz rejected and CLTV still not satisfied). The caller
|
|
978
|
+
* is expected to retry these later.
|
|
979
|
+
*/
|
|
980
|
+
skipped: number;
|
|
981
|
+
}
|
|
950
982
|
/** Per-swap outcome of a bulk recovery call. */
|
|
951
983
|
interface SubmarineRecoveryResult {
|
|
952
984
|
/** ID of the swap whose VHTLC we attempted to refund. */
|
|
@@ -1105,4 +1137,4 @@ interface ChainFeesResponse {
|
|
|
1105
1137
|
};
|
|
1106
1138
|
}
|
|
1107
1139
|
|
|
1108
|
-
export {
|
|
1140
|
+
export { isReverseFinalStatus as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerEvents as E, type FeesResponse as F, type GetSwapStatusResponse as G, isChainClaimableStatus as H, type IncomingPaymentSubscription as I, isChainFailedStatus as J, isChainFinalStatus as K, type LimitsResponse as L, isChainPendingStatus as M, type Network as N, isChainRefundableStatus as O, type PendingChainSwap as P, isChainSignableStatus as Q, isChainSuccessStatus as R, type SendLightningPaymentRequest as S, isChainSwapClaimable as T, isChainSwapRefundable as U, type Vtxo as V, isPendingChainSwap as W, isPendingReverseSwap as X, isPendingSubmarineSwap as Y, isReverseClaimableStatus as Z, isReverseFailedStatus as _, type BoltzChainSwap as a, isReversePendingStatus as a0, isReverseSuccessStatus as a1, isReverseSwapClaimable as a2, isSubmarineFailedStatus as a3, isSubmarineFinalStatus as a4, isSubmarinePendingStatus as a5, isSubmarineRefundableStatus as a6, isSubmarineSuccessStatus as a7, isSubmarineSwapRefundable as a8, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type SubmarineRefundOutcome as g, type SubmarineRecoveryInfo as h, type SubmarineRecoveryResult as i, type ChainFeesResponse as j, type ArkToBtcResponse as k, type BtcToArkResponse as l, type ChainArkRefundOutcome as m, type SwapRepository as n, type SwapManagerClient as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineRecoveryStatus as w, SwapManager as x, type SwapManagerCallbacks as y, type SwapManagerConfig as z };
|
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.34",
|
|
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.29"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"expo-task-manager": ">=3.0.0",
|