@arkade-os/swap 0.1.0-rc.16 → 0.1.0-rc.17

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/advanced.cjs CHANGED
@@ -507,6 +507,46 @@ function offerContractParams(client, binding, operatorPubkey, expectedPkScript)
507
507
  metadata: { genericallySpendable: false, kind: OFFER_CONTRACT_KIND }
508
508
  };
509
509
  }
510
+ async function restoreOfferCoverage(wallet, swaps) {
511
+ const live = swaps.filter((swap) => !RETIRABLE.includes(swap.status));
512
+ if (live.length === 0) return;
513
+ const [info, contractManager] = await Promise.all([
514
+ wallet.getArkadeInfo({ requireLive: true }),
515
+ wallet.getContractManager()
516
+ ]);
517
+ const operatorPubkey = import_base2.hex.decode((0, import_sdk3.toXOnlySignerHex)(info.signerPubkey));
518
+ const client = await derivingClient(wallet, info, contractManager);
519
+ const seen = /* @__PURE__ */ new Set();
520
+ const covenants = [];
521
+ for (const swap of live) {
522
+ if (seen.has(swap.swapPkScript)) continue;
523
+ seen.add(swap.swapPkScript);
524
+ try {
525
+ const { swapPkScript: _, ...binding } = decodeOffer(import_base2.hex.decode(swap.offerHex));
526
+ covenants.push({
527
+ script: swap.swapPkScript,
528
+ issued: swap.createdAt,
529
+ params: offerContractParams(
530
+ client,
531
+ binding,
532
+ operatorPubkey,
533
+ import_base2.hex.decode(swap.swapPkScript)
534
+ )
535
+ });
536
+ } catch (error) {
537
+ console.warn(`[swap] could not restore coverage for ${swap.swapPkScript}`, error);
538
+ }
539
+ }
540
+ const params = covenants.map((covenant) => covenant.params);
541
+ if (contractManager.createContracts) {
542
+ await contractManager.createContracts(params);
543
+ } else {
544
+ for (const contract of params) await contractManager.createContract(contract);
545
+ }
546
+ for (const covenant of covenants) {
547
+ await promoteOfferContract(contractManager, covenant.script, covenant.issued);
548
+ }
549
+ }
510
550
  function serverExitDelay(delay) {
511
551
  if (typeof delay !== "bigint" || delay <= BigInt(0)) {
512
552
  throw new Error(
@@ -4102,7 +4142,13 @@ function classifyDepositSpend(offer, operatorPubkey, spendTxs, deposit) {
4102
4142
  return "indeterminate";
4103
4143
  }
4104
4144
  async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
4105
- const { operatorPubkey, scanned = /* @__PURE__ */ new Set(), reopen = [], hrp } = opts;
4145
+ const {
4146
+ operatorPubkey,
4147
+ scanned = /* @__PURE__ */ new Set(),
4148
+ reopen = [],
4149
+ hrp,
4150
+ recoveredIn = /* @__PURE__ */ new Set()
4151
+ } = opts;
4106
4152
  const reopened = [];
4107
4153
  for (const swap of reopen) {
4108
4154
  try {
@@ -4182,9 +4228,17 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
4182
4228
  continue;
4183
4229
  }
4184
4230
  const fromAmount = depositAmount.toString();
4185
- const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy : void 0;
4231
+ const recovered = vtxo.isSpent && vtxo.isSwept && !!vtxo.settledBy && spendTxidsOf(vtxo).length === 0;
4232
+ const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy || (recovered ? vtxo.settledBy : void 0) : void 0;
4186
4233
  let status = "pending";
4187
- if (vtxo.isSwept) status = "recoverable";
4234
+ if (recovered) {
4235
+ const ours = recoveredIn.has(vtxo.settledBy) || txByAnyId.has(vtxo.settledBy);
4236
+ if (!ours) {
4237
+ unresolved.add(fundingTx.redeemTxid);
4238
+ continue;
4239
+ }
4240
+ status = "cancelled";
4241
+ } else if (vtxo.isSwept && !vtxo.isSpent) status = "recoverable";
4188
4242
  else if (vtxo.isSpent) {
4189
4243
  const spendTxs = spendTxidsOf(vtxo).map((id) => spendTxByTxid.get(id)).filter((tx) => tx !== void 0);
4190
4244
  const kind = classifyDepositSpend(offer, operatorPubkey, spendTxs, {
@@ -4612,6 +4666,7 @@ async function pushClaim(operator, input) {
4612
4666
  // src/client/drive.ts
4613
4667
  init_onchainHtlc();
4614
4668
  init_coverage();
4669
+ init_offer();
4615
4670
  init_lockupContract();
4616
4671
 
4617
4672
  // src/refundBlocked.ts
@@ -6004,6 +6059,7 @@ var createSwapDrive = (config) => {
6004
6059
  const live = /* @__PURE__ */ new Map();
6005
6060
  const refunding = /* @__PURE__ */ new Set();
6006
6061
  const swept = /* @__PURE__ */ new Map();
6062
+ const recoveredIn = /* @__PURE__ */ new Set();
6007
6063
  const passed = /* @__PURE__ */ new Set();
6008
6064
  const delivered = /* @__PURE__ */ new Map();
6009
6065
  const listeners = /* @__PURE__ */ new Set();
@@ -6273,7 +6329,7 @@ var createSwapDrive = (config) => {
6273
6329
  };
6274
6330
  let offerSource;
6275
6331
  const offers = () => offerSource ??= offerRecordSource(storage(), remember, now);
6276
- const restoreOfferDeposits = async (reopen) => {
6332
+ const restoreOfferDeposits = async (reopen = []) => {
6277
6333
  const store = storage();
6278
6334
  const [history, scanned, address, network] = await Promise.all([
6279
6335
  wallet.getTransactionHistory(),
@@ -6284,12 +6340,13 @@ var createSwapDrive = (config) => {
6284
6340
  const txs = history.map(toRestoreTx);
6285
6341
  const { hrp, serverPubKey: operatorPubkey } = import_sdk28.ArkAddress.decode(address);
6286
6342
  const reopened = await legacyOfferDepositsToReopen(store);
6287
- if (reopen !== void 0) reopened.add(reopen);
6343
+ for (const txid of reopen) reopened.add(txid);
6288
6344
  const cursor = reopened.size === 0 ? scanned : new Set([...scanned].filter((txid) => !reopened.has(txid)));
6289
6345
  const { restored, scannedTxids } = await restoreAssetSwaps(indexer, txs, /* @__PURE__ */ new Set(), {
6290
6346
  operatorPubkey,
6291
6347
  scanned: cursor,
6292
- hrp
6348
+ hrp,
6349
+ recoveredIn
6293
6350
  });
6294
6351
  const { offer } = splitRecords(await collectSwapRecords(store));
6295
6352
  const current = new Map(offer.map((record) => [record.id, record]));
@@ -6415,7 +6472,11 @@ var createSwapDrive = (config) => {
6415
6472
  }
6416
6473
  let offers2 = offer;
6417
6474
  try {
6418
- offers2 = await restoreOfferDeposits();
6475
+ offers2 = await restoreOfferDeposits(
6476
+ offer.flatMap(
6477
+ (record) => record.status === "recoverable" && record.fundingTxid !== void 0 ? [record.fundingTxid] : []
6478
+ )
6479
+ );
6419
6480
  } catch (error) {
6420
6481
  console.warn("[swap] the offer deposit restore did not complete", error);
6421
6482
  }
@@ -6482,8 +6543,8 @@ var createSwapDrive = (config) => {
6482
6543
  );
6483
6544
  }
6484
6545
  const txid2 = await track((await recoverer()).recoverVtxos());
6485
- const after2 = await recoverableAt(script);
6486
- const still = new Set(after2.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
6546
+ const after = await recoverableAt(script);
6547
+ const still = new Set(after.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
6487
6548
  const recovered2 = before.every((vtxo) => !still.has(`${vtxo.txid}:${vtxo.vout}`));
6488
6549
  if (recovered2) swept.delete(id);
6489
6550
  await manager.poll();
@@ -6497,10 +6558,31 @@ var createSwapDrive = (config) => {
6497
6558
  id
6498
6559
  );
6499
6560
  }
6500
- const txid = await track((await recoverer()).recoverVtxos());
6501
- await restoreOfferDeposits(record.fundingTxid);
6502
- const after = records.get(id);
6503
- const recovered = after?.family === "offer" && after.status !== "recoverable";
6561
+ const wentHome = async () => {
6562
+ await restoreOfferDeposits(
6563
+ record.fundingTxid === void 0 ? [] : [record.fundingTxid]
6564
+ );
6565
+ const after = records.get(id);
6566
+ return after?.family === "offer" && after.status !== "recoverable";
6567
+ };
6568
+ try {
6569
+ if (await wentHome()) return { recovered: true, swap: swapView(id) };
6570
+ } catch (error) {
6571
+ console.warn(`[swap] could not re-read offer ${id} before recovering it`, error);
6572
+ }
6573
+ const vtxoManager = await recoverer();
6574
+ await restoreOfferCoverage(wallet, [offerFactsOf(record)]);
6575
+ const txid = await track(vtxoManager.recoverVtxos());
6576
+ recoveredIn.add(txid);
6577
+ let recovered = false;
6578
+ try {
6579
+ recovered = await wentHome();
6580
+ } catch (error) {
6581
+ console.warn(
6582
+ `[swap] recovered offer ${id} in ${txid}, but could not re-read it`,
6583
+ error
6584
+ );
6585
+ }
6504
6586
  return { recovered, txid, swap: swapView(id) };
6505
6587
  };
6506
6588
  const swapView = (id) => {
@@ -1,5 +1,5 @@
1
- import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-O-27mWDX.cjs';
2
- export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-O-27mWDX.cjs';
1
+ import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-DQ-J_lgV.cjs';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-DQ-J_lgV.cjs';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
4
4
  import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-S2OS6Yl-.cjs';
5
5
  export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-S2OS6Yl-.cjs';
@@ -1,5 +1,5 @@
1
- import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-DYGuDb4G.js';
2
- export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-DYGuDb4G.js';
1
+ import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-CUKl1fFo.js';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-CUKl1fFo.js';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
4
4
  import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-V98jQmTD.js';
5
5
  export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-V98jQmTD.js';
package/dist/advanced.js CHANGED
@@ -143,7 +143,7 @@ import {
143
143
  withCanonicalAmount,
144
144
  withDepositFate,
145
145
  withRfqState
146
- } from "./chunk-3RSH73P4.js";
146
+ } from "./chunk-QJ2MUUDO.js";
147
147
  import {
148
148
  ACTIVITY_TOKEN,
149
149
  CORRIDOR_PASS,
@@ -158,7 +158,7 @@ import {
158
158
  onchainCorridor,
159
159
  readsChain,
160
160
  recordOutcome
161
- } from "./chunk-RX3WPV5D.js";
161
+ } from "./chunk-CIIJT5O4.js";
162
162
  import {
163
163
  SwapRefusal,
164
164
  assertPreimageMatches,
@@ -963,7 +963,13 @@ function classifyDepositSpend(offer, operatorPubkey, spendTxs, deposit) {
963
963
  return "indeterminate";
964
964
  }
965
965
  async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
966
- const { operatorPubkey, scanned = /* @__PURE__ */ new Set(), reopen = [], hrp } = opts;
966
+ const {
967
+ operatorPubkey,
968
+ scanned = /* @__PURE__ */ new Set(),
969
+ reopen = [],
970
+ hrp,
971
+ recoveredIn = /* @__PURE__ */ new Set()
972
+ } = opts;
967
973
  const reopened = [];
968
974
  for (const swap of reopen) {
969
975
  try {
@@ -1043,9 +1049,17 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
1043
1049
  continue;
1044
1050
  }
1045
1051
  const fromAmount = depositAmount.toString();
1046
- const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy : void 0;
1052
+ const recovered = vtxo.isSpent && vtxo.isSwept && !!vtxo.settledBy && spendTxidsOf(vtxo).length === 0;
1053
+ const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy || (recovered ? vtxo.settledBy : void 0) : void 0;
1047
1054
  let status = "pending";
1048
- if (vtxo.isSwept) status = "recoverable";
1055
+ if (recovered) {
1056
+ const ours = recoveredIn.has(vtxo.settledBy) || txByAnyId.has(vtxo.settledBy);
1057
+ if (!ours) {
1058
+ unresolved.add(fundingTx.redeemTxid);
1059
+ continue;
1060
+ }
1061
+ status = "cancelled";
1062
+ } else if (vtxo.isSwept && !vtxo.isSpent) status = "recoverable";
1049
1063
  else if (vtxo.isSpent) {
1050
1064
  const spendTxs = spendTxidsOf(vtxo).map((id) => spendTxByTxid.get(id)).filter((tx) => tx !== void 0);
1051
1065
  const kind = classifyDepositSpend(offer, operatorPubkey, spendTxs, {
@@ -34,7 +34,7 @@ import {
34
34
  spendTxidsOf,
35
35
  walletOperator,
36
36
  watchOfferSwaps
37
- } from "./chunk-RX3WPV5D.js";
37
+ } from "./chunk-CIIJT5O4.js";
38
38
  import {
39
39
  ARKADE_BTC,
40
40
  ASSET_CARRIER_SATS,
@@ -2012,6 +2012,7 @@ var createSwapDrive = (config) => {
2012
2012
  const live = /* @__PURE__ */ new Map();
2013
2013
  const refunding = /* @__PURE__ */ new Set();
2014
2014
  const swept = /* @__PURE__ */ new Map();
2015
+ const recoveredIn = /* @__PURE__ */ new Set();
2015
2016
  const passed = /* @__PURE__ */ new Set();
2016
2017
  const delivered = /* @__PURE__ */ new Map();
2017
2018
  const listeners = /* @__PURE__ */ new Set();
@@ -2281,7 +2282,7 @@ var createSwapDrive = (config) => {
2281
2282
  };
2282
2283
  let offerSource;
2283
2284
  const offers = () => offerSource ??= offerRecordSource(storage(), remember, now);
2284
- const restoreOfferDeposits = async (reopen) => {
2285
+ const restoreOfferDeposits = async (reopen = []) => {
2285
2286
  const store = storage();
2286
2287
  const [history, scanned, address, network] = await Promise.all([
2287
2288
  wallet.getTransactionHistory(),
@@ -2292,12 +2293,13 @@ var createSwapDrive = (config) => {
2292
2293
  const txs = history.map(toRestoreTx);
2293
2294
  const { hrp, serverPubKey: operatorPubkey } = ArkAddress4.decode(address);
2294
2295
  const reopened = await legacyOfferDepositsToReopen(store);
2295
- if (reopen !== void 0) reopened.add(reopen);
2296
+ for (const txid of reopen) reopened.add(txid);
2296
2297
  const cursor = reopened.size === 0 ? scanned : new Set([...scanned].filter((txid) => !reopened.has(txid)));
2297
2298
  const { restored, scannedTxids } = await restoreAssetSwaps(indexer, txs, /* @__PURE__ */ new Set(), {
2298
2299
  operatorPubkey,
2299
2300
  scanned: cursor,
2300
- hrp
2301
+ hrp,
2302
+ recoveredIn
2301
2303
  });
2302
2304
  const { offer } = splitRecords(await collectSwapRecords(store));
2303
2305
  const current = new Map(offer.map((record) => [record.id, record]));
@@ -2423,7 +2425,11 @@ var createSwapDrive = (config) => {
2423
2425
  }
2424
2426
  let offers2 = offer;
2425
2427
  try {
2426
- offers2 = await restoreOfferDeposits();
2428
+ offers2 = await restoreOfferDeposits(
2429
+ offer.flatMap(
2430
+ (record) => record.status === "recoverable" && record.fundingTxid !== void 0 ? [record.fundingTxid] : []
2431
+ )
2432
+ );
2427
2433
  } catch (error) {
2428
2434
  console.warn("[swap] the offer deposit restore did not complete", error);
2429
2435
  }
@@ -2490,8 +2496,8 @@ var createSwapDrive = (config) => {
2490
2496
  );
2491
2497
  }
2492
2498
  const txid2 = await track((await recoverer()).recoverVtxos());
2493
- const after2 = await recoverableAt(script);
2494
- const still = new Set(after2.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
2499
+ const after = await recoverableAt(script);
2500
+ const still = new Set(after.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
2495
2501
  const recovered2 = before.every((vtxo) => !still.has(`${vtxo.txid}:${vtxo.vout}`));
2496
2502
  if (recovered2) swept.delete(id);
2497
2503
  await manager.poll();
@@ -2505,10 +2511,31 @@ var createSwapDrive = (config) => {
2505
2511
  id
2506
2512
  );
2507
2513
  }
2508
- const txid = await track((await recoverer()).recoverVtxos());
2509
- await restoreOfferDeposits(record.fundingTxid);
2510
- const after = records.get(id);
2511
- const recovered = after?.family === "offer" && after.status !== "recoverable";
2514
+ const wentHome = async () => {
2515
+ await restoreOfferDeposits(
2516
+ record.fundingTxid === void 0 ? [] : [record.fundingTxid]
2517
+ );
2518
+ const after = records.get(id);
2519
+ return after?.family === "offer" && after.status !== "recoverable";
2520
+ };
2521
+ try {
2522
+ if (await wentHome()) return { recovered: true, swap: swapView(id) };
2523
+ } catch (error) {
2524
+ console.warn(`[swap] could not re-read offer ${id} before recovering it`, error);
2525
+ }
2526
+ const vtxoManager = await recoverer();
2527
+ await restoreOfferCoverage(wallet, [offerFactsOf(record)]);
2528
+ const txid = await track(vtxoManager.recoverVtxos());
2529
+ recoveredIn.add(txid);
2530
+ let recovered = false;
2531
+ try {
2532
+ recovered = await wentHome();
2533
+ } catch (error) {
2534
+ console.warn(
2535
+ `[swap] recovered offer ${id} in ${txid}, but could not re-read it`,
2536
+ error
2537
+ );
2538
+ }
2512
2539
  return { recovered, txid, swap: swapView(id) };
2513
2540
  };
2514
2541
  const swapView = (id) => {
@@ -757,7 +757,8 @@ interface RecoveryResult {
757
757
  /**
758
758
  * Whether THIS swap's outpoints were included in the round, per a re-read afterwards. A
759
759
  * settlement txid is not success: `recoverVtxos` takes the whole wallet and caps the round,
760
- * deferring overflow to the next cycle.
760
+ * deferring overflow to the next cycle. An offer re-read the indexer has not caught up on
761
+ * reports `false`; the next client start re-reads it.
761
762
  */
762
763
  readonly recovered: boolean;
763
764
  /** The settlement the round produced, when one ran. */
@@ -757,7 +757,8 @@ interface RecoveryResult {
757
757
  /**
758
758
  * Whether THIS swap's outpoints were included in the round, per a re-read afterwards. A
759
759
  * settlement txid is not success: `recoverVtxos` takes the whole wallet and caps the round,
760
- * deferring overflow to the next cycle.
760
+ * deferring overflow to the next cycle. An offer re-read the indexer has not caught up on
761
+ * reports `false`; the next client start re-reads it.
761
762
  */
762
763
  readonly recovered: boolean;
763
764
  /** The settlement the round produced, when one ran. */
package/dist/index.cjs CHANGED
@@ -4137,7 +4137,13 @@ function classifyDepositSpend(offer, operatorPubkey, spendTxs, deposit) {
4137
4137
  return "indeterminate";
4138
4138
  }
4139
4139
  async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
4140
- const { operatorPubkey, scanned = /* @__PURE__ */ new Set(), reopen = [], hrp } = opts;
4140
+ const {
4141
+ operatorPubkey,
4142
+ scanned = /* @__PURE__ */ new Set(),
4143
+ reopen = [],
4144
+ hrp,
4145
+ recoveredIn = /* @__PURE__ */ new Set()
4146
+ } = opts;
4141
4147
  const reopened = [];
4142
4148
  for (const swap of reopen) {
4143
4149
  try {
@@ -4217,9 +4223,17 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
4217
4223
  continue;
4218
4224
  }
4219
4225
  const fromAmount = depositAmount.toString();
4220
- const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy : void 0;
4226
+ const recovered = vtxo.isSpent && vtxo.isSwept && !!vtxo.settledBy && spendTxidsOf(vtxo).length === 0;
4227
+ const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy || (recovered ? vtxo.settledBy : void 0) : void 0;
4221
4228
  let status = "pending";
4222
- if (vtxo.isSwept) status = "recoverable";
4229
+ if (recovered) {
4230
+ const ours = recoveredIn.has(vtxo.settledBy) || txByAnyId.has(vtxo.settledBy);
4231
+ if (!ours) {
4232
+ unresolved.add(fundingTx.redeemTxid);
4233
+ continue;
4234
+ }
4235
+ status = "cancelled";
4236
+ } else if (vtxo.isSwept && !vtxo.isSpent) status = "recoverable";
4223
4237
  else if (vtxo.isSpent) {
4224
4238
  const spendTxs = spendTxidsOf(vtxo).map((id) => spendTxByTxid.get(id)).filter((tx) => tx !== void 0);
4225
4239
  const kind = classifyDepositSpend(offer, operatorPubkey, spendTxs, {
@@ -4647,6 +4661,7 @@ async function pushClaim(operator, input) {
4647
4661
  // src/client/drive.ts
4648
4662
  init_onchainHtlc();
4649
4663
  init_coverage();
4664
+ init_offer();
4650
4665
  init_lockupContract();
4651
4666
 
4652
4667
  // src/refundBlocked.ts
@@ -6142,6 +6157,7 @@ var createSwapDrive = (config) => {
6142
6157
  const live = /* @__PURE__ */ new Map();
6143
6158
  const refunding = /* @__PURE__ */ new Set();
6144
6159
  const swept = /* @__PURE__ */ new Map();
6160
+ const recoveredIn = /* @__PURE__ */ new Set();
6145
6161
  const passed = /* @__PURE__ */ new Set();
6146
6162
  const delivered = /* @__PURE__ */ new Map();
6147
6163
  const listeners = /* @__PURE__ */ new Set();
@@ -6411,7 +6427,7 @@ var createSwapDrive = (config) => {
6411
6427
  };
6412
6428
  let offerSource;
6413
6429
  const offers = () => offerSource ??= offerRecordSource(storage(), remember, now);
6414
- const restoreOfferDeposits = async (reopen) => {
6430
+ const restoreOfferDeposits = async (reopen = []) => {
6415
6431
  const store = storage();
6416
6432
  const [history, scanned, address, network] = await Promise.all([
6417
6433
  wallet.getTransactionHistory(),
@@ -6422,12 +6438,13 @@ var createSwapDrive = (config) => {
6422
6438
  const txs = history.map(toRestoreTx);
6423
6439
  const { hrp, serverPubKey: operatorPubkey } = import_sdk28.ArkAddress.decode(address);
6424
6440
  const reopened = await legacyOfferDepositsToReopen(store);
6425
- if (reopen !== void 0) reopened.add(reopen);
6441
+ for (const txid of reopen) reopened.add(txid);
6426
6442
  const cursor = reopened.size === 0 ? scanned : new Set([...scanned].filter((txid) => !reopened.has(txid)));
6427
6443
  const { restored, scannedTxids } = await restoreAssetSwaps(indexer, txs, /* @__PURE__ */ new Set(), {
6428
6444
  operatorPubkey,
6429
6445
  scanned: cursor,
6430
- hrp
6446
+ hrp,
6447
+ recoveredIn
6431
6448
  });
6432
6449
  const { offer } = splitRecords(await collectSwapRecords(store));
6433
6450
  const current = new Map(offer.map((record) => [record.id, record]));
@@ -6553,7 +6570,11 @@ var createSwapDrive = (config) => {
6553
6570
  }
6554
6571
  let offers2 = offer;
6555
6572
  try {
6556
- offers2 = await restoreOfferDeposits();
6573
+ offers2 = await restoreOfferDeposits(
6574
+ offer.flatMap(
6575
+ (record) => record.status === "recoverable" && record.fundingTxid !== void 0 ? [record.fundingTxid] : []
6576
+ )
6577
+ );
6557
6578
  } catch (error) {
6558
6579
  console.warn("[swap] the offer deposit restore did not complete", error);
6559
6580
  }
@@ -6620,8 +6641,8 @@ var createSwapDrive = (config) => {
6620
6641
  );
6621
6642
  }
6622
6643
  const txid2 = await track((await recoverer()).recoverVtxos());
6623
- const after2 = await recoverableAt(script);
6624
- const still = new Set(after2.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
6644
+ const after = await recoverableAt(script);
6645
+ const still = new Set(after.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
6625
6646
  const recovered2 = before.every((vtxo) => !still.has(`${vtxo.txid}:${vtxo.vout}`));
6626
6647
  if (recovered2) swept.delete(id);
6627
6648
  await manager.poll();
@@ -6635,10 +6656,31 @@ var createSwapDrive = (config) => {
6635
6656
  id
6636
6657
  );
6637
6658
  }
6638
- const txid = await track((await recoverer()).recoverVtxos());
6639
- await restoreOfferDeposits(record.fundingTxid);
6640
- const after = records.get(id);
6641
- const recovered = after?.family === "offer" && after.status !== "recoverable";
6659
+ const wentHome = async () => {
6660
+ await restoreOfferDeposits(
6661
+ record.fundingTxid === void 0 ? [] : [record.fundingTxid]
6662
+ );
6663
+ const after = records.get(id);
6664
+ return after?.family === "offer" && after.status !== "recoverable";
6665
+ };
6666
+ try {
6667
+ if (await wentHome()) return { recovered: true, swap: swapView(id) };
6668
+ } catch (error) {
6669
+ console.warn(`[swap] could not re-read offer ${id} before recovering it`, error);
6670
+ }
6671
+ const vtxoManager = await recoverer();
6672
+ await restoreOfferCoverage(wallet, [offerFactsOf(record)]);
6673
+ const txid = await track(vtxoManager.recoverVtxos());
6674
+ recoveredIn.add(txid);
6675
+ let recovered = false;
6676
+ try {
6677
+ recovered = await wentHome();
6678
+ } catch (error) {
6679
+ console.warn(
6680
+ `[swap] recovered offer ${id} in ${txid}, but could not re-read it`,
6681
+ error
6682
+ );
6683
+ }
6642
6684
  return { recovered, txid, swap: swapView(id) };
6643
6685
  };
6644
6686
  const swapView = (id) => {
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-O-27mWDX.cjs';
1
+ export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-DQ-J_lgV.cjs';
2
2
  import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-S2OS6Yl-.cjs';
3
3
  export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-S2OS6Yl-.cjs';
4
4
  export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-60PGpQ_x.cjs';
5
5
  import { PageRequest, PageResult, IWallet, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
- import { R as RestoreIndexer, T as Tx } from './lockupContract-C-4zimb4.cjs';
7
- export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-C-4zimb4.cjs';
6
+ import { R as RestoreIndexer, T as Tx } from './lockupContract-CWR83JvL.cjs';
7
+ export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-CWR83JvL.cjs';
8
8
  import '@arkade-os/solver-discovery';
9
9
  import './offer-DCaE0YNp.cjs';
10
10
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-DYGuDb4G.js';
1
+ export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-CUKl1fFo.js';
2
2
  import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-V98jQmTD.js';
3
3
  export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-V98jQmTD.js';
4
4
  export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-60PGpQ_x.js';
5
5
  import { PageRequest, PageResult, IWallet, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
- import { R as RestoreIndexer, T as Tx } from './lockupContract-Bz8T0pYL.js';
7
- export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-Bz8T0pYL.js';
6
+ import { R as RestoreIndexer, T as Tx } from './lockupContract-iI7QGIEr.js';
7
+ export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-iI7QGIEr.js';
8
8
  import '@arkade-os/solver-discovery';
9
9
  import './offer-CJzNPS5H.js';
10
10
 
package/dist/index.js CHANGED
@@ -63,10 +63,10 @@ import {
63
63
  sameAsset,
64
64
  swapHandle,
65
65
  toAtomicDecimal
66
- } from "./chunk-3RSH73P4.js";
66
+ } from "./chunk-QJ2MUUDO.js";
67
67
  import {
68
68
  isRfqSwapTerminal
69
- } from "./chunk-RX3WPV5D.js";
69
+ } from "./chunk-CIIJT5O4.js";
70
70
  import {
71
71
  CLAIM_PACKET_TYPE,
72
72
  LockupRegistrationFailed,
@@ -73,6 +73,8 @@ declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingI
73
73
  reopen?: AssetSwap[];
74
74
  /** Address prefix; given, a rebuilt record names the covenant's address (#680). */
75
75
  hrp?: string;
76
+ /** Commitment txids of recovery rounds this wallet ran (`recoverVtxos()`'s return). */
77
+ recoveredIn?: ReadonlySet<string>;
76
78
  }): Promise<{
77
79
  restored: AssetSwap[];
78
80
  scannedTxids: string[];
@@ -73,6 +73,8 @@ declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingI
73
73
  reopen?: AssetSwap[];
74
74
  /** Address prefix; given, a rebuilt record names the covenant's address (#680). */
75
75
  hrp?: string;
76
+ /** Commitment txids of recovery rounds this wallet ran (`recoverVtxos()`'s return). */
77
+ recoveredIn?: ReadonlySet<string>;
76
78
  }): Promise<{
77
79
  restored: AssetSwap[];
78
80
  scannedTxids: string[];
package/dist/protocol.cjs CHANGED
@@ -5053,7 +5053,13 @@ function classifyDepositSpend(offer, operatorPubkey, spendTxs, deposit) {
5053
5053
  return "indeterminate";
5054
5054
  }
5055
5055
  async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
5056
- const { operatorPubkey, scanned = /* @__PURE__ */ new Set(), reopen = [], hrp } = opts;
5056
+ const {
5057
+ operatorPubkey,
5058
+ scanned = /* @__PURE__ */ new Set(),
5059
+ reopen = [],
5060
+ hrp,
5061
+ recoveredIn = /* @__PURE__ */ new Set()
5062
+ } = opts;
5057
5063
  const reopened = [];
5058
5064
  for (const swap of reopen) {
5059
5065
  try {
@@ -5133,9 +5139,17 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
5133
5139
  continue;
5134
5140
  }
5135
5141
  const fromAmount = depositAmount.toString();
5136
- const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy : void 0;
5142
+ const recovered = vtxo.isSpent && vtxo.isSwept && !!vtxo.settledBy && spendTxidsOf(vtxo).length === 0;
5143
+ const spentTxid = vtxo.isSpent ? vtxo.arkTxId || vtxo.spentBy || (recovered ? vtxo.settledBy : void 0) : void 0;
5137
5144
  let status = "pending";
5138
- if (vtxo.isSwept) status = "recoverable";
5145
+ if (recovered) {
5146
+ const ours = recoveredIn.has(vtxo.settledBy) || txByAnyId.has(vtxo.settledBy);
5147
+ if (!ours) {
5148
+ unresolved.add(fundingTx.redeemTxid);
5149
+ continue;
5150
+ }
5151
+ status = "cancelled";
5152
+ } else if (vtxo.isSwept && !vtxo.isSpent) status = "recoverable";
5139
5153
  else if (vtxo.isSpent) {
5140
5154
  const spendTxs = spendTxidsOf(vtxo).map((id) => spendTxByTxid.get(id)).filter((tx) => tx !== void 0);
5141
5155
  const kind = classifyDepositSpend(offer, operatorPubkey, spendTxs, {
@@ -3,7 +3,7 @@ import { b9 as SwapSecretsProjection, e as RfqSwapRecord, d as AssetSwapReposito
3
3
  export { c as AssetSwapStatus, be as AvailableRfqSwapManagerCallbacks, bf as BTC_ASSET_ID, bg as LightningReceiveSwap, bh as LightningSendSwap, bi as LockupFate, bj as LockupNeedsRecoveryError, bk as LockupParams, bl as LockupSpend, bm as OnchainSendAction, bn as OnchainSendSwap, bo as PersistableRfqSwap, bp as PreimageBlockedReason, bq as PreimageNotRecoverableError, br as RFQ_SWAP_RETENTION_SECONDS, bs as RefundOutcome, bt as RfqRestoreFailure, bu as RfqRestoreOptions, bv as RfqRestoreResult, b8 as RfqSwapActionName, bw as RfqSwapLockup, bx as RfqSwapManager, b7 as RfqSwapManagerCallbacks, by as RfqSwapManagerConfig, bz as RfqSwapManagerDeps, bA as RfqSwapManagerEvents, bB as RfqSwapOrigin, bC as RfqSwapOriginRequired, bD as RfqSwapOutcome, a as RfqSwapRecordStore, bE as addAssetSwap, bF as awaitRfqResolution, bG as createRfqSwapRecord, bH as findLockupVtxos, bI as getAssetSwaps, bJ as isRfqTerminal, bK as nextOnchainAction, bL as normalizeRfqSwapRecord, bM as preimageForSwapRecord, bN as pushRefundWithoutReceiver, bO as readLockupFate, bP as rebuildRfqSwap, bQ as refundIfUnresolved, bR as rfqSwapOriginOf, bS as shouldRetainRfqSwap, bT as swapSecretsToRecord, bU as updateAssetSwap, bV as updateRfqSwapRecord } from './repository-S2OS6Yl-.cjs';
4
4
  import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-60PGpQ_x.cjs';
5
5
  export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as ONCHAIN_BTC, s as ONCHAIN_CLAIM_MARGIN_SECONDS, t as ONCHAIN_DUST_SATS, u as ONCHAIN_ORDER_MARGIN_SECONDS, v as ONCHAIN_RECEIVE_PAIR, w as ONCHAIN_SECONDS_PER_BLOCK, x as ONCHAIN_SEND_PAIR, y as OnchainHtlcPhase, z as RelaySocket, R as RfqQuote, B as RfqRefusalReason, D as RfqStatus, E as arkadeAssetLeg, F as arkadeSwapRequest, G as assertArkadeFundable, J as awaitOnchainFill, K as buildHtlcClaim, N as buildHtlcRefund, P as canonicalAssetAmount, Q as claimOnchainFill, T as classifyOnchainHtlc, U as deriveLightningReceive, V as deriveOnchainReceive, W as deriveOnchainSend, X as extractPreimage, Y as httpTransport, Z as l1ScriptForAddress, _ as lightningReceiveContract, $ as lightningReceiveRequest, a0 as lightningSendContract, a1 as lightningSendRequest, a2 as newPreimage, a3 as normalizeMakerPkScript, a4 as normalizeMakerPublicKey, a5 as onchainHtlcScript, a6 as onchainReceiveRequest, a7 as onchainSendRequest, a8 as paymentHashOf, a9 as relayTransport, aa as requestArkadeSwap, ab as requestLightningReceive, ac as requestOnchainReceive, ad as unilateralClaimDelay, ae as unilateralRefundDelay, af as unilateralRefundWithoutReceiverDelay, ag as verifyLockupAddress, ah as verifyOfferAddress, ai as verifyReceiveInvoice } from './rfq-60PGpQ_x.cjs';
6
- export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, R as RestoreIndexer, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as SpendKind, T as Tx, m as classifyDepositSpend, n as classifySpend, o as lockupContractParams, r as registerLockupContract, p as restoreAssetSwaps, s as sealClaimPacket, q as spendTxidsOf } from './lockupContract-C-4zimb4.cjs';
6
+ export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, R as RestoreIndexer, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as SpendKind, T as Tx, m as classifyDepositSpend, n as classifySpend, o as lockupContractParams, r as registerLockupContract, p as restoreAssetSwaps, s as sealClaimPacket, q as spendTxidsOf } from './lockupContract-CWR83JvL.cjs';
7
7
  import { Network as Network$1, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
8
8
  export { A as ASSET_CARRIER_SATS, F as FillFunding, N as NoSpendableDepositError, O as OFFER_PACKET_TYPE, a as Offer, b as OfferCovenantMismatchError, c as cancelOffer, d as createOffer, e as decodeOffer, f as encodeOffer, g as fillOffer, o as offerContract, s as swapPrograms } from './offer-DCaE0YNp.cjs';
9
9
  export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-BFMXLQV-.cjs';
@@ -3,7 +3,7 @@ import { b9 as SwapSecretsProjection, e as RfqSwapRecord, d as AssetSwapReposito
3
3
  export { c as AssetSwapStatus, be as AvailableRfqSwapManagerCallbacks, bf as BTC_ASSET_ID, bg as LightningReceiveSwap, bh as LightningSendSwap, bi as LockupFate, bj as LockupNeedsRecoveryError, bk as LockupParams, bl as LockupSpend, bm as OnchainSendAction, bn as OnchainSendSwap, bo as PersistableRfqSwap, bp as PreimageBlockedReason, bq as PreimageNotRecoverableError, br as RFQ_SWAP_RETENTION_SECONDS, bs as RefundOutcome, bt as RfqRestoreFailure, bu as RfqRestoreOptions, bv as RfqRestoreResult, b8 as RfqSwapActionName, bw as RfqSwapLockup, bx as RfqSwapManager, b7 as RfqSwapManagerCallbacks, by as RfqSwapManagerConfig, bz as RfqSwapManagerDeps, bA as RfqSwapManagerEvents, bB as RfqSwapOrigin, bC as RfqSwapOriginRequired, bD as RfqSwapOutcome, a as RfqSwapRecordStore, bE as addAssetSwap, bF as awaitRfqResolution, bG as createRfqSwapRecord, bH as findLockupVtxos, bI as getAssetSwaps, bJ as isRfqTerminal, bK as nextOnchainAction, bL as normalizeRfqSwapRecord, bM as preimageForSwapRecord, bN as pushRefundWithoutReceiver, bO as readLockupFate, bP as rebuildRfqSwap, bQ as refundIfUnresolved, bR as rfqSwapOriginOf, bS as shouldRetainRfqSwap, bT as swapSecretsToRecord, bU as updateAssetSwap, bV as updateRfqSwapRecord } from './repository-V98jQmTD.js';
4
4
  import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-60PGpQ_x.js';
5
5
  export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as ONCHAIN_BTC, s as ONCHAIN_CLAIM_MARGIN_SECONDS, t as ONCHAIN_DUST_SATS, u as ONCHAIN_ORDER_MARGIN_SECONDS, v as ONCHAIN_RECEIVE_PAIR, w as ONCHAIN_SECONDS_PER_BLOCK, x as ONCHAIN_SEND_PAIR, y as OnchainHtlcPhase, z as RelaySocket, R as RfqQuote, B as RfqRefusalReason, D as RfqStatus, E as arkadeAssetLeg, F as arkadeSwapRequest, G as assertArkadeFundable, J as awaitOnchainFill, K as buildHtlcClaim, N as buildHtlcRefund, P as canonicalAssetAmount, Q as claimOnchainFill, T as classifyOnchainHtlc, U as deriveLightningReceive, V as deriveOnchainReceive, W as deriveOnchainSend, X as extractPreimage, Y as httpTransport, Z as l1ScriptForAddress, _ as lightningReceiveContract, $ as lightningReceiveRequest, a0 as lightningSendContract, a1 as lightningSendRequest, a2 as newPreimage, a3 as normalizeMakerPkScript, a4 as normalizeMakerPublicKey, a5 as onchainHtlcScript, a6 as onchainReceiveRequest, a7 as onchainSendRequest, a8 as paymentHashOf, a9 as relayTransport, aa as requestArkadeSwap, ab as requestLightningReceive, ac as requestOnchainReceive, ad as unilateralClaimDelay, ae as unilateralRefundDelay, af as unilateralRefundWithoutReceiverDelay, ag as verifyLockupAddress, ah as verifyOfferAddress, ai as verifyReceiveInvoice } from './rfq-60PGpQ_x.js';
6
- export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, R as RestoreIndexer, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as SpendKind, T as Tx, m as classifyDepositSpend, n as classifySpend, o as lockupContractParams, r as registerLockupContract, p as restoreAssetSwaps, s as sealClaimPacket, q as spendTxidsOf } from './lockupContract-Bz8T0pYL.js';
6
+ export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, R as RestoreIndexer, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as SpendKind, T as Tx, m as classifyDepositSpend, n as classifySpend, o as lockupContractParams, r as registerLockupContract, p as restoreAssetSwaps, s as sealClaimPacket, q as spendTxidsOf } from './lockupContract-iI7QGIEr.js';
7
7
  import { Network as Network$1, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
8
8
  export { A as ASSET_CARRIER_SATS, F as FillFunding, N as NoSpendableDepositError, O as OFFER_PACKET_TYPE, a as Offer, b as OfferCovenantMismatchError, c as cancelOffer, d as createOffer, e as decodeOffer, f as encodeOffer, g as fillOffer, o as offerContract, s as swapPrograms } from './offer-CJzNPS5H.js';
9
9
  export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-3pNJbc4T.js';
package/dist/protocol.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  updateRfqSwapRecord,
44
44
  validatePlan,
45
45
  watchOfferSwaps
46
- } from "./chunk-RX3WPV5D.js";
46
+ } from "./chunk-CIIJT5O4.js";
47
47
  import {
48
48
  ARKADE_BTC,
49
49
  ASSET_CARRIER_SATS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/swap",
3
- "version": "0.1.0-rc.16",
3
+ "version": "0.1.0-rc.17",
4
4
  "type": "module",
5
5
  "description": "Client-side Arkade Intents asset swaps: state a route, get an outcome. Pay a bolt11 invoice, receive over Lightning, exchange assets, or withdraw onchain.",
6
6
  "repository": {
@@ -104,7 +104,7 @@
104
104
  "@scure/base": "2.0.0",
105
105
  "@scure/btc-signer": "2.0.1",
106
106
  "light-bolt11-decoder": "3.2.0",
107
- "@arkade-os/sdk": "0.5.0-rc.13"
107
+ "@arkade-os/sdk": "0.5.0-rc.14"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "nostr-tools": "^2.12.0"