@arkade-os/boltz-swap 0.3.40 → 0.3.41
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/README.md +29 -0
- package/dist/{arkade-swaps-DnRiRcdW.d.ts → arkade-swaps-C3sUFr5f.d.cts} +59 -5
- package/dist/{arkade-swaps-CObmwpZQ.d.cts → arkade-swaps-LvsGHtre.d.ts} +59 -5
- package/dist/{chunk-WGLBFONB.js → chunk-CWY37W4B.js} +1 -1
- package/dist/{chunk-GYWMQOCP.js → chunk-UXYHW7KV.js} +138 -35
- package/dist/expo/background.cjs +137 -35
- 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 +140 -35
- package/dist/expo/index.d.cts +9 -5
- package/dist/expo/index.d.ts +9 -5
- package/dist/expo/index.js +5 -2
- package/dist/index.cjs +156 -35
- package/dist/index.d.cts +21 -9
- package/dist/index.d.ts +21 -9
- package/dist/index.js +20 -1
- 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-BlyUrhtO.d.cts → swapsPollProcessor-CGMXUKPe.d.cts} +1 -1
- package/dist/{swapsPollProcessor-Bv4Z2R7g.d.ts → swapsPollProcessor-CuDM6sxV.d.ts} +1 -1
- package/dist/{types-D97i1LFu.d.cts → types-8NrCdOpS.d.cts} +51 -1
- package/dist/{types-D97i1LFu.d.ts → types-8NrCdOpS.d.ts} +51 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
enrichSubmarineSwapInvoice: () => enrichSubmarineSwapInvoice,
|
|
57
57
|
getInvoicePaymentHash: () => getInvoicePaymentHash,
|
|
58
58
|
getInvoiceSatoshis: () => getInvoiceSatoshis,
|
|
59
|
+
hasSubmarineStatusReached: () => hasSubmarineStatusReached,
|
|
59
60
|
isChainClaimableStatus: () => isChainClaimableStatus,
|
|
60
61
|
isChainFailedStatus: () => isChainFailedStatus,
|
|
61
62
|
isChainFinalStatus: () => isChainFinalStatus,
|
|
@@ -324,6 +325,22 @@ var isSubmarinePendingStatus = (status) => {
|
|
|
324
325
|
var isSubmarineRefundableStatus = (status) => {
|
|
325
326
|
return ["invoice.failedToPay", "transaction.lockupFailed", "swap.expired"].includes(status);
|
|
326
327
|
};
|
|
328
|
+
var SUBMARINE_STATUS_PROGRESSION = [
|
|
329
|
+
"swap.created",
|
|
330
|
+
"invoice.set",
|
|
331
|
+
"transaction.mempool",
|
|
332
|
+
"transaction.confirmed",
|
|
333
|
+
"invoice.pending",
|
|
334
|
+
"invoice.paid",
|
|
335
|
+
"transaction.claim.pending",
|
|
336
|
+
"transaction.claimed"
|
|
337
|
+
];
|
|
338
|
+
var hasSubmarineStatusReached = (status, target) => {
|
|
339
|
+
const progression = SUBMARINE_STATUS_PROGRESSION;
|
|
340
|
+
const statusIndex = progression.indexOf(status);
|
|
341
|
+
const targetIndex = progression.indexOf(target);
|
|
342
|
+
return statusIndex >= 0 && targetIndex >= 0 && statusIndex >= targetIndex;
|
|
343
|
+
};
|
|
327
344
|
var isSubmarineSuccessStatus = (status) => {
|
|
328
345
|
return status === "transaction.claimed";
|
|
329
346
|
};
|
|
@@ -3680,16 +3697,6 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3680
3697
|
this.swapProvider.monitorSwap(pendingSwap.id, onStatusUpdate).catch(reject);
|
|
3681
3698
|
});
|
|
3682
3699
|
}
|
|
3683
|
-
// =========================================================================
|
|
3684
|
-
// Lightning: Submarine swaps (send Arkade -> Lightning)
|
|
3685
|
-
// =========================================================================
|
|
3686
|
-
/**
|
|
3687
|
-
* Sends a Lightning payment via a submarine swap (Arkade → Lightning).
|
|
3688
|
-
* Creates the swap, sends funds, and waits for settlement. Auto-refunds on failure.
|
|
3689
|
-
* @param args.invoice - BOLT11 Lightning invoice to pay.
|
|
3690
|
-
* @returns The amount paid, preimage (proof of payment), and transaction ID.
|
|
3691
|
-
* @throws {TransactionFailedError} If the payment fails (auto-refunds if possible).
|
|
3692
|
-
*/
|
|
3693
3700
|
async sendLightningPayment(args) {
|
|
3694
3701
|
const pendingSwap = await this.createSubmarineSwap(args);
|
|
3695
3702
|
if (!pendingSwap.response.address)
|
|
@@ -3700,6 +3707,18 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3700
3707
|
amount: pendingSwap.response.expectedAmount
|
|
3701
3708
|
});
|
|
3702
3709
|
try {
|
|
3710
|
+
if (args.waitFor === "funded") {
|
|
3711
|
+
if (!this.swapManager) {
|
|
3712
|
+
logger.warn(
|
|
3713
|
+
`Swap ${pendingSwap.id}: sendLightningPayment with waitFor "funded" but SwapManager is disabled \u2014 a failure after this promise resolves is only persisted as refundable, not auto-refunded; recover via restoreSwaps/recoverSubmarineFunds`
|
|
3714
|
+
);
|
|
3715
|
+
}
|
|
3716
|
+
await this.waitForSwapFunded(pendingSwap);
|
|
3717
|
+
return {
|
|
3718
|
+
amount: pendingSwap.response.expectedAmount,
|
|
3719
|
+
txid
|
|
3720
|
+
};
|
|
3721
|
+
}
|
|
3703
3722
|
const { preimage } = await this.waitForSwapSettlement(pendingSwap);
|
|
3704
3723
|
return {
|
|
3705
3724
|
amount: pendingSwap.response.expectedAmount,
|
|
@@ -4201,6 +4220,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4201
4220
|
}
|
|
4202
4221
|
/**
|
|
4203
4222
|
* Waits for a submarine swap's Lightning payment to settle.
|
|
4223
|
+
* Resolves only at the terminal "transaction.claimed" status, once Boltz
|
|
4224
|
+
* has swept the HTLC. To resolve as soon as the payment is in flight, use
|
|
4225
|
+
* {@link waitForSwapFunded} instead.
|
|
4204
4226
|
* @param pendingSwap - The submarine swap to monitor.
|
|
4205
4227
|
* @returns The preimage from the settled Lightning payment (proof of payment).
|
|
4206
4228
|
* @throws {SwapExpiredError} If the swap expires.
|
|
@@ -4208,19 +4230,59 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4208
4230
|
* @throws {TransactionLockupFailedError} If the lockup transaction fails.
|
|
4209
4231
|
*/
|
|
4210
4232
|
async waitForSwapSettlement(pendingSwap) {
|
|
4233
|
+
return this.waitForSubmarineSwap(pendingSwap);
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* Waits until a submarine swap is funded: resolves as soon as the lockup
|
|
4237
|
+
* transaction is observed ("transaction.mempool" or any later status in
|
|
4238
|
+
* the lifecycle — statuses can be skipped since subscriptions report only
|
|
4239
|
+
* the current one). The sender's funds are committed and the swap is
|
|
4240
|
+
* refundable from this point, which is when most Lightning wallets show
|
|
4241
|
+
* a payment as "sent".
|
|
4242
|
+
*
|
|
4243
|
+
* Monitoring continues in the background until the swap reaches a
|
|
4244
|
+
* terminal status, persisting updates to the repository (the preimage on
|
|
4245
|
+
* claim, the refundable flag on failure), but this promise no longer
|
|
4246
|
+
* rejects once resolved — acting on a late failure is the caller's
|
|
4247
|
+
* responsibility (the SwapManager handles it automatically when enabled).
|
|
4248
|
+
* @param pendingSwap - The submarine swap to monitor.
|
|
4249
|
+
* @throws {SwapExpiredError} If the swap expires before funding.
|
|
4250
|
+
* @throws {InvoiceFailedToPayError} If Boltz fails to route the payment.
|
|
4251
|
+
* @throws {TransactionLockupFailedError} If the lockup transaction fails.
|
|
4252
|
+
*/
|
|
4253
|
+
async waitForSwapFunded(pendingSwap) {
|
|
4254
|
+
await this.waitForSubmarineSwap(pendingSwap, "transaction.mempool");
|
|
4255
|
+
}
|
|
4256
|
+
/**
|
|
4257
|
+
* Shared wait machinery: monitors the swap and resolves at the terminal
|
|
4258
|
+
* "transaction.claimed" status (with the preimage) or, when `resolveAt`
|
|
4259
|
+
* is given, as soon as that status — or any later one in the successful
|
|
4260
|
+
* progression — is observed (without a preimage).
|
|
4261
|
+
*/
|
|
4262
|
+
async waitForSubmarineSwap(pendingSwap, resolveAt) {
|
|
4211
4263
|
return new Promise((resolve, reject) => {
|
|
4212
|
-
let
|
|
4264
|
+
let isFinal = false;
|
|
4265
|
+
let isSettled = false;
|
|
4213
4266
|
const onStatusUpdate = async (status) => {
|
|
4214
|
-
if (
|
|
4215
|
-
const saveStatus = (additionalFields) =>
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4267
|
+
if (isFinal) return;
|
|
4268
|
+
const saveStatus = async (additionalFields) => {
|
|
4269
|
+
try {
|
|
4270
|
+
await updateSubmarineSwapStatus(
|
|
4271
|
+
pendingSwap,
|
|
4272
|
+
status,
|
|
4273
|
+
this.savePendingSubmarineSwap.bind(this),
|
|
4274
|
+
additionalFields
|
|
4275
|
+
);
|
|
4276
|
+
} catch (error) {
|
|
4277
|
+
logger.error(
|
|
4278
|
+
`Swap ${pendingSwap.id}: failed to persist status "${status}": ${error}`
|
|
4279
|
+
);
|
|
4280
|
+
}
|
|
4281
|
+
};
|
|
4221
4282
|
switch (status) {
|
|
4222
4283
|
case "swap.expired":
|
|
4223
|
-
|
|
4284
|
+
isFinal = true;
|
|
4285
|
+
isSettled = true;
|
|
4224
4286
|
await saveStatus({ refundable: true });
|
|
4225
4287
|
reject(
|
|
4226
4288
|
new SwapExpiredError({
|
|
@@ -4230,7 +4292,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4230
4292
|
);
|
|
4231
4293
|
break;
|
|
4232
4294
|
case "invoice.failedToPay":
|
|
4233
|
-
|
|
4295
|
+
isFinal = true;
|
|
4296
|
+
isSettled = true;
|
|
4234
4297
|
await saveStatus({ refundable: true });
|
|
4235
4298
|
reject(
|
|
4236
4299
|
new InvoiceFailedToPayError({
|
|
@@ -4240,7 +4303,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4240
4303
|
);
|
|
4241
4304
|
break;
|
|
4242
4305
|
case "transaction.lockupFailed":
|
|
4243
|
-
|
|
4306
|
+
isFinal = true;
|
|
4307
|
+
isSettled = true;
|
|
4244
4308
|
await saveStatus({ refundable: true });
|
|
4245
4309
|
reject(
|
|
4246
4310
|
new TransactionLockupFailedError({
|
|
@@ -4250,23 +4314,47 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4250
4314
|
);
|
|
4251
4315
|
break;
|
|
4252
4316
|
case "transaction.claimed": {
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4317
|
+
isFinal = true;
|
|
4318
|
+
isSettled = true;
|
|
4319
|
+
try {
|
|
4320
|
+
const { preimage } = await this.swapProvider.getSwapPreimage(
|
|
4321
|
+
pendingSwap.id
|
|
4322
|
+
);
|
|
4323
|
+
await saveStatus({ preimage });
|
|
4324
|
+
resolve({ preimage });
|
|
4325
|
+
} catch (error) {
|
|
4326
|
+
logger.error(
|
|
4327
|
+
`Swap ${pendingSwap.id}: failed to fetch preimage on claim: ${error}`
|
|
4328
|
+
);
|
|
4329
|
+
reject(error);
|
|
4330
|
+
}
|
|
4259
4331
|
break;
|
|
4260
4332
|
}
|
|
4261
4333
|
default:
|
|
4262
4334
|
await saveStatus();
|
|
4335
|
+
if (resolveAt && hasSubmarineStatusReached(status, resolveAt)) {
|
|
4336
|
+
isSettled = true;
|
|
4337
|
+
resolve({ preimage: void 0 });
|
|
4338
|
+
}
|
|
4263
4339
|
break;
|
|
4264
4340
|
}
|
|
4265
4341
|
};
|
|
4266
|
-
this.swapProvider.monitorSwap(pendingSwap.id,
|
|
4267
|
-
|
|
4268
|
-
|
|
4342
|
+
this.swapProvider.monitorSwap(pendingSwap.id, (status) => {
|
|
4343
|
+
onStatusUpdate(status).catch(
|
|
4344
|
+
(error) => logger.error(
|
|
4345
|
+
`Swap ${pendingSwap.id}: error handling status "${status}": ${error}`
|
|
4346
|
+
)
|
|
4347
|
+
);
|
|
4348
|
+
}).catch((error) => {
|
|
4349
|
+
if (!isSettled) {
|
|
4350
|
+
isFinal = true;
|
|
4351
|
+
isSettled = true;
|
|
4269
4352
|
reject(error);
|
|
4353
|
+
} else {
|
|
4354
|
+
isFinal = true;
|
|
4355
|
+
logger.warn(
|
|
4356
|
+
`Swap ${pendingSwap.id}: monitor failed after settlement: ${error}`
|
|
4357
|
+
);
|
|
4270
4358
|
}
|
|
4271
4359
|
});
|
|
4272
4360
|
});
|
|
@@ -5290,13 +5378,28 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
5290
5378
|
for (const swap of await this.getPendingSubmarineSwapsFromStorage()) {
|
|
5291
5379
|
if (isSubmarineFinalStatus(swap.status)) continue;
|
|
5292
5380
|
promises.push(
|
|
5293
|
-
this.getSwapStatus(swap.id).then(
|
|
5294
|
-
|
|
5381
|
+
this.getSwapStatus(swap.id).then(async ({ status }) => {
|
|
5382
|
+
let additionalFields;
|
|
5383
|
+
if (isSubmarineSuccessStatus(status) && !swap.preimage) {
|
|
5384
|
+
try {
|
|
5385
|
+
const { preimage } = await this.swapProvider.getSwapPreimage(
|
|
5386
|
+
swap.id
|
|
5387
|
+
);
|
|
5388
|
+
additionalFields = { preimage };
|
|
5389
|
+
} catch (error) {
|
|
5390
|
+
logger.warn(
|
|
5391
|
+
`Failed to fetch preimage for settled swap ${swap.id}:`,
|
|
5392
|
+
error
|
|
5393
|
+
);
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
await updateSubmarineSwapStatus(
|
|
5295
5397
|
swap,
|
|
5296
5398
|
status,
|
|
5297
|
-
this.savePendingSubmarineSwap.bind(this)
|
|
5298
|
-
|
|
5299
|
-
|
|
5399
|
+
this.savePendingSubmarineSwap.bind(this),
|
|
5400
|
+
additionalFields
|
|
5401
|
+
);
|
|
5402
|
+
}).catch((error) => {
|
|
5300
5403
|
logger.error(`Failed to refresh swap status for ${swap.id}:`, error);
|
|
5301
5404
|
})
|
|
5302
5405
|
);
|
|
@@ -5475,6 +5578,7 @@ var LONG_RUNNING_ARKADE_SWAPS_REQUEST_TYPES = /* @__PURE__ */ new Set([
|
|
|
5475
5578
|
"RECOVER_ALL_SUBMARINE_FUNDS",
|
|
5476
5579
|
"WAIT_AND_CLAIM",
|
|
5477
5580
|
"WAIT_FOR_SWAP_SETTLEMENT",
|
|
5581
|
+
"WAIT_FOR_SWAP_FUNDED",
|
|
5478
5582
|
"RESTORE_SWAPS",
|
|
5479
5583
|
"WAIT_AND_CLAIM_CHAIN",
|
|
5480
5584
|
"WAIT_AND_CLAIM_ARK",
|
|
@@ -5662,6 +5766,10 @@ var ArkadeSwapsMessageHandler = class _ArkadeSwapsMessageHandler {
|
|
|
5662
5766
|
payload: res
|
|
5663
5767
|
});
|
|
5664
5768
|
}
|
|
5769
|
+
case "WAIT_FOR_SWAP_FUNDED": {
|
|
5770
|
+
await this.handler.waitForSwapFunded(message.payload);
|
|
5771
|
+
return this.tagged({ id, type: "SWAP_FUNDED" });
|
|
5772
|
+
}
|
|
5665
5773
|
case "RESTORE_SWAPS": {
|
|
5666
5774
|
const res = await this.handler.restoreSwaps(message.payload);
|
|
5667
5775
|
return this.tagged({
|
|
@@ -6363,6 +6471,18 @@ var ServiceWorkerArkadeSwaps = class _ServiceWorkerArkadeSwaps {
|
|
|
6363
6471
|
throw new Error("Cannot wait for swap settlement", { cause: e });
|
|
6364
6472
|
}
|
|
6365
6473
|
}
|
|
6474
|
+
async waitForSwapFunded(pendingSwap) {
|
|
6475
|
+
try {
|
|
6476
|
+
await this.sendMessage({
|
|
6477
|
+
id: (0, import_sdk10.getRandomId)(),
|
|
6478
|
+
tag: this.messageTag,
|
|
6479
|
+
type: "WAIT_FOR_SWAP_FUNDED",
|
|
6480
|
+
payload: pendingSwap
|
|
6481
|
+
});
|
|
6482
|
+
} catch (e) {
|
|
6483
|
+
throw new Error("Cannot wait for swap funding", { cause: e });
|
|
6484
|
+
}
|
|
6485
|
+
}
|
|
6366
6486
|
async restoreSwaps(boltzFees) {
|
|
6367
6487
|
try {
|
|
6368
6488
|
const res = await this.sendMessage({
|
|
@@ -6951,6 +7071,7 @@ var InMemorySwapRepository = class {
|
|
|
6951
7071
|
enrichSubmarineSwapInvoice,
|
|
6952
7072
|
getInvoicePaymentHash,
|
|
6953
7073
|
getInvoiceSatoshis,
|
|
7074
|
+
hasSubmarineStatusReached,
|
|
6954
7075
|
isChainClaimableStatus,
|
|
6955
7076
|
isChainFailedStatus,
|
|
6956
7077
|
isChainFinalStatus,
|
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,
|
|
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
|
|
1
|
+
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-C3sUFr5f.cjs';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-C3sUFr5f.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, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-8NrCdOpS.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 SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-8NrCdOpS.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';
|
|
@@ -225,7 +225,8 @@ type RequestSendLightningPayment = RequestEnvelope & {
|
|
|
225
225
|
};
|
|
226
226
|
type ResponseSendLightningPayment = ResponseEnvelope & {
|
|
227
227
|
type: "LIGHTNING_PAYMENT_SENT";
|
|
228
|
-
|
|
228
|
+
/** Strict SendLightningPaymentResponse unless the request used waitFor: "funded". */
|
|
229
|
+
payload: OptimisticSendLightningPaymentResponse;
|
|
229
230
|
};
|
|
230
231
|
type RequestCreateSubmarineSwap = RequestEnvelope & {
|
|
231
232
|
type: "CREATE_SUBMARINE_SWAP";
|
|
@@ -309,6 +310,13 @@ type ResponseWaitForSwapSettlement = ResponseEnvelope & {
|
|
|
309
310
|
preimage: string;
|
|
310
311
|
};
|
|
311
312
|
};
|
|
313
|
+
type RequestWaitForSwapFunded = RequestEnvelope & {
|
|
314
|
+
type: "WAIT_FOR_SWAP_FUNDED";
|
|
315
|
+
payload: BoltzSubmarineSwap;
|
|
316
|
+
};
|
|
317
|
+
type ResponseWaitForSwapFunded = ResponseEnvelope & {
|
|
318
|
+
type: "SWAP_FUNDED";
|
|
319
|
+
};
|
|
312
320
|
type RequestRestoreSwaps = RequestEnvelope & {
|
|
313
321
|
type: "RESTORE_SWAPS";
|
|
314
322
|
payload?: FeesResponse;
|
|
@@ -653,8 +661,8 @@ type ResponseSwapManagerWaitForCompletion = ResponseEnvelope & {
|
|
|
653
661
|
txid: string;
|
|
654
662
|
};
|
|
655
663
|
};
|
|
656
|
-
type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
|
|
657
|
-
type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
|
|
664
|
+
type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestWaitForSwapFunded | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
|
|
665
|
+
type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseWaitForSwapFunded | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
|
|
658
666
|
declare class ArkadeSwapsMessageHandler implements MessageHandler<ArkadeSwapsUpdaterRequest, ArkadeSwapsUpdaterResponse> {
|
|
659
667
|
private readonly swapRepository;
|
|
660
668
|
static messageTag: string;
|
|
@@ -709,7 +717,10 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
709
717
|
stopSwapManager(): Promise<void>;
|
|
710
718
|
getSwapManager(): SwapManagerClient | null;
|
|
711
719
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
712
|
-
sendLightningPayment(args: SendLightningPaymentRequest
|
|
720
|
+
sendLightningPayment(args: SendLightningPaymentRequest & {
|
|
721
|
+
waitFor?: "settled";
|
|
722
|
+
}): Promise<SendLightningPaymentResponse>;
|
|
723
|
+
sendLightningPayment(args: SendLightningPaymentRequest): Promise<OptimisticSendLightningPaymentResponse>;
|
|
713
724
|
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
|
|
714
725
|
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
|
|
715
726
|
claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
|
|
@@ -724,6 +735,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
724
735
|
waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
|
|
725
736
|
preimage: string;
|
|
726
737
|
}>;
|
|
738
|
+
waitForSwapFunded(pendingSwap: BoltzSubmarineSwap): Promise<void>;
|
|
727
739
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
728
740
|
chainSwaps: BoltzChainSwap[];
|
|
729
741
|
reverseSwaps: BoltzReverseSwap[];
|
|
@@ -879,4 +891,4 @@ declare class InMemorySwapRepository implements SwapRepository {
|
|
|
879
891
|
[Symbol.asyncDispose](): Promise<void>;
|
|
880
892
|
}
|
|
881
893
|
|
|
882
|
-
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 };
|
|
894
|
+
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, OptimisticSendLightningPaymentResponse, 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,
|
|
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
|
|
1
|
+
import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-LvsGHtre.js';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-LvsGHtre.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, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-8NrCdOpS.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 SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-8NrCdOpS.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';
|
|
@@ -225,7 +225,8 @@ type RequestSendLightningPayment = RequestEnvelope & {
|
|
|
225
225
|
};
|
|
226
226
|
type ResponseSendLightningPayment = ResponseEnvelope & {
|
|
227
227
|
type: "LIGHTNING_PAYMENT_SENT";
|
|
228
|
-
|
|
228
|
+
/** Strict SendLightningPaymentResponse unless the request used waitFor: "funded". */
|
|
229
|
+
payload: OptimisticSendLightningPaymentResponse;
|
|
229
230
|
};
|
|
230
231
|
type RequestCreateSubmarineSwap = RequestEnvelope & {
|
|
231
232
|
type: "CREATE_SUBMARINE_SWAP";
|
|
@@ -309,6 +310,13 @@ type ResponseWaitForSwapSettlement = ResponseEnvelope & {
|
|
|
309
310
|
preimage: string;
|
|
310
311
|
};
|
|
311
312
|
};
|
|
313
|
+
type RequestWaitForSwapFunded = RequestEnvelope & {
|
|
314
|
+
type: "WAIT_FOR_SWAP_FUNDED";
|
|
315
|
+
payload: BoltzSubmarineSwap;
|
|
316
|
+
};
|
|
317
|
+
type ResponseWaitForSwapFunded = ResponseEnvelope & {
|
|
318
|
+
type: "SWAP_FUNDED";
|
|
319
|
+
};
|
|
312
320
|
type RequestRestoreSwaps = RequestEnvelope & {
|
|
313
321
|
type: "RESTORE_SWAPS";
|
|
314
322
|
payload?: FeesResponse;
|
|
@@ -653,8 +661,8 @@ type ResponseSwapManagerWaitForCompletion = ResponseEnvelope & {
|
|
|
653
661
|
txid: string;
|
|
654
662
|
};
|
|
655
663
|
};
|
|
656
|
-
type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
|
|
657
|
-
type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
|
|
664
|
+
type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestWaitForSwapFunded | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
|
|
665
|
+
type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseWaitForSwapFunded | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
|
|
658
666
|
declare class ArkadeSwapsMessageHandler implements MessageHandler<ArkadeSwapsUpdaterRequest, ArkadeSwapsUpdaterResponse> {
|
|
659
667
|
private readonly swapRepository;
|
|
660
668
|
static messageTag: string;
|
|
@@ -709,7 +717,10 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
709
717
|
stopSwapManager(): Promise<void>;
|
|
710
718
|
getSwapManager(): SwapManagerClient | null;
|
|
711
719
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
712
|
-
sendLightningPayment(args: SendLightningPaymentRequest
|
|
720
|
+
sendLightningPayment(args: SendLightningPaymentRequest & {
|
|
721
|
+
waitFor?: "settled";
|
|
722
|
+
}): Promise<SendLightningPaymentResponse>;
|
|
723
|
+
sendLightningPayment(args: SendLightningPaymentRequest): Promise<OptimisticSendLightningPaymentResponse>;
|
|
713
724
|
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
|
|
714
725
|
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
|
|
715
726
|
claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
|
|
@@ -724,6 +735,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
724
735
|
waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
|
|
725
736
|
preimage: string;
|
|
726
737
|
}>;
|
|
738
|
+
waitForSwapFunded(pendingSwap: BoltzSubmarineSwap): Promise<void>;
|
|
727
739
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
728
740
|
chainSwaps: BoltzChainSwap[];
|
|
729
741
|
reverseSwaps: BoltzReverseSwap[];
|
|
@@ -879,4 +891,4 @@ declare class InMemorySwapRepository implements SwapRepository {
|
|
|
879
891
|
[Symbol.asyncDispose](): Promise<void>;
|
|
880
892
|
}
|
|
881
893
|
|
|
882
|
-
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 };
|
|
894
|
+
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, OptimisticSendLightningPaymentResponse, 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
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
enrichSubmarineSwapInvoice,
|
|
21
21
|
getInvoicePaymentHash,
|
|
22
22
|
getInvoiceSatoshis,
|
|
23
|
+
hasSubmarineStatusReached,
|
|
23
24
|
isChainClaimableStatus,
|
|
24
25
|
isChainFailedStatus,
|
|
25
26
|
isChainFinalStatus,
|
|
@@ -52,7 +53,7 @@ import {
|
|
|
52
53
|
updateReverseSwapStatus,
|
|
53
54
|
updateSubmarineSwapStatus,
|
|
54
55
|
verifySignatures
|
|
55
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-UXYHW7KV.js";
|
|
56
57
|
import {
|
|
57
58
|
applyCreatedAtOrder,
|
|
58
59
|
applySwapsFilter
|
|
@@ -84,6 +85,7 @@ var LONG_RUNNING_ARKADE_SWAPS_REQUEST_TYPES = /* @__PURE__ */ new Set([
|
|
|
84
85
|
"RECOVER_ALL_SUBMARINE_FUNDS",
|
|
85
86
|
"WAIT_AND_CLAIM",
|
|
86
87
|
"WAIT_FOR_SWAP_SETTLEMENT",
|
|
88
|
+
"WAIT_FOR_SWAP_FUNDED",
|
|
87
89
|
"RESTORE_SWAPS",
|
|
88
90
|
"WAIT_AND_CLAIM_CHAIN",
|
|
89
91
|
"WAIT_AND_CLAIM_ARK",
|
|
@@ -271,6 +273,10 @@ var ArkadeSwapsMessageHandler = class _ArkadeSwapsMessageHandler {
|
|
|
271
273
|
payload: res
|
|
272
274
|
});
|
|
273
275
|
}
|
|
276
|
+
case "WAIT_FOR_SWAP_FUNDED": {
|
|
277
|
+
await this.handler.waitForSwapFunded(message.payload);
|
|
278
|
+
return this.tagged({ id, type: "SWAP_FUNDED" });
|
|
279
|
+
}
|
|
274
280
|
case "RESTORE_SWAPS": {
|
|
275
281
|
const res = await this.handler.restoreSwaps(message.payload);
|
|
276
282
|
return this.tagged({
|
|
@@ -976,6 +982,18 @@ var ServiceWorkerArkadeSwaps = class _ServiceWorkerArkadeSwaps {
|
|
|
976
982
|
throw new Error("Cannot wait for swap settlement", { cause: e });
|
|
977
983
|
}
|
|
978
984
|
}
|
|
985
|
+
async waitForSwapFunded(pendingSwap) {
|
|
986
|
+
try {
|
|
987
|
+
await this.sendMessage({
|
|
988
|
+
id: getRandomId(),
|
|
989
|
+
tag: this.messageTag,
|
|
990
|
+
type: "WAIT_FOR_SWAP_FUNDED",
|
|
991
|
+
payload: pendingSwap
|
|
992
|
+
});
|
|
993
|
+
} catch (e) {
|
|
994
|
+
throw new Error("Cannot wait for swap funding", { cause: e });
|
|
995
|
+
}
|
|
996
|
+
}
|
|
979
997
|
async restoreSwaps(boltzFees) {
|
|
980
998
|
try {
|
|
981
999
|
const res = await this.sendMessage({
|
|
@@ -1563,6 +1581,7 @@ export {
|
|
|
1563
1581
|
enrichSubmarineSwapInvoice,
|
|
1564
1582
|
getInvoicePaymentHash,
|
|
1565
1583
|
getInvoiceSatoshis,
|
|
1584
|
+
hasSubmarineStatusReached,
|
|
1566
1585
|
isChainClaimableStatus,
|
|
1567
1586
|
isChainFailedStatus,
|
|
1568
1587
|
isChainFinalStatus,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
|
-
import {
|
|
2
|
+
import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.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 { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.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 { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.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 { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.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 { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-8NrCdOpS.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 { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-8NrCdOpS.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dependencies injected into every swap processor at runtime.
|