@arkade-os/swap 0.0.22 → 0.0.24

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ProvisionedKey, ProvisionedClaimSecret, ArkTxInput, asset, RelativeTimelock, IWallet, EmulatorProvider, arkade, RestIndexerProvider, Transaction, IContractManager, OnchainProvider, PaymentRail, Asset, VHTLC, Identity, ActivityResolver } from '@arkade-os/sdk';
2
- import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry, b as RefundArkProvider, L as LockupContractSource, c as LockupVtxo, d as RfqSwap, e as ArkadeRefundResult, f as LockupSpendIndexer, g as RfqSwapState } from './repository-PNlTFdsj.js';
3
- export { h as AssetSwapStatus, i as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, j as LightningReceiveSwap, k as LightningSendSwap, l as LockupFate, m as LockupNeedsRecoveryError, n as LockupParams, o as LockupSpend, O as OnchainSendAction, p as OnchainSendSwap, P as PersistableRfqSwap, q as PreimageBlockedReason, r as PreimageNotRecoverableError, s as REFUND_MTP_LAG_SECONDS, t as RFQ_RESOLVED_STATES, u as RFQ_SWAP_RETENTION_SECONDS, v as RFQ_SWAP_TERMINAL_STATES, w as RefundOutcome, x as RfqRestoreFailure, y as RfqRestoreOptions, z as RfqRestoreResult, C as RfqSwapActionName, D as RfqSwapLockup, E as RfqSwapManager, F as RfqSwapManagerCallbacks, G as RfqSwapManagerConfig, H as RfqSwapManagerDeps, J as RfqSwapManagerEvents, K as RfqSwapOrigin, N as RfqSwapOriginRequired, Q as RfqSwapOutcome, T as RfqSwapRecordStore, U as SwapContractRegistry, V as addAssetSwap, W as awaitRfqResolution, X as createRfqSwapRecord, Y as findLockupVtxos, Z as getAssetSwaps, _ as getAssetSwapsOrThrow, $ as isRfqSwapTerminal, a0 as isRfqTerminal, a1 as nextOnchainAction, a2 as preimageForSwapRecord, a3 as pushRefundWithoutReceiver, a4 as readLockupFate, a5 as rebuildRfqSwap, a6 as refundIfUnresolved, a7 as rfqSwapOriginOf, a8 as shouldRetainRfqSwap, a9 as swapSecretsToRecord, aa as updateAssetSwap, ab as updateAssetSwapBestEffort, ac as updateRfqSwapRecord } from './repository-PNlTFdsj.js';
2
+ import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, b as RfqSwapState, c as RfqHistoryCursor, M as MarketsCacheEntry, d as RefundArkProvider, L as LockupContractSource, e as LockupVtxo, f as RfqSwap, g as ArkadeRefundResult, h as LockupSpendIndexer } from './repository-BT33JsPT.js';
3
+ export { i as AssetSwapStatus, j as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, k as LightningReceiveSwap, l as LightningSendSwap, m as LockupFate, n as LockupNeedsRecoveryError, o as LockupParams, p as LockupSpend, O as OnchainSendAction, q as OnchainSendSwap, P as PersistableRfqSwap, r as PreimageBlockedReason, s as PreimageNotRecoverableError, t as REFUND_MTP_LAG_SECONDS, u as RFQ_RESOLVED_STATES, v as RFQ_SWAP_ACTIVE_STATES, w as RFQ_SWAP_MAX_PAGE_SIZE, x as RFQ_SWAP_RETENTION_SECONDS, y as RFQ_SWAP_TERMINAL_STATES, z as RefundOutcome, C as RfqRestoreFailure, D as RfqRestoreOptions, E as RfqRestoreResult, F as RfqSwapActionName, G as RfqSwapLockup, H as RfqSwapManager, J as RfqSwapManagerCallbacks, K as RfqSwapManagerConfig, N as RfqSwapManagerDeps, Q as RfqSwapManagerEvents, T as RfqSwapOrigin, U as RfqSwapOriginRequired, V as RfqSwapOutcome, W as RfqSwapRecordStore, X as SwapContractRegistry, Y as addAssetSwap, Z as awaitRfqResolution, _ as createRfqSwapRecord, $ as findLockupVtxos, a0 as getAssetSwaps, a1 as getAssetSwapsOrThrow, a2 as isRfqSwapTerminal, a3 as isRfqTerminal, a4 as nextOnchainAction, a5 as preimageForSwapRecord, a6 as pushRefundWithoutReceiver, a7 as readLockupFate, a8 as rebuildRfqSwap, a9 as refundIfUnresolved, aa as rfqSwapOriginOf, ab as shouldRetainRfqSwap, ac as swapSecretsToRecord, ad as updateAssetSwap, ae as updateAssetSwapBestEffort, af as updateRfqSwapRecord } from './repository-BT33JsPT.js';
4
4
  import { Network, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
5
5
  import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams, C as ChainSource, R as RfqTransport, r as requestOnchainSend, I as InvoiceFacts, c as requestLightningSend } from './rfq-B95nPfaa.js';
6
6
  export { A as ARKADE_ASSET, d as ARKADE_BTC, e as AddressMismatch, f as ChainUtxo, H as HtlcUtxo, L as LIGHTNING_BTC, g as LIGHTNING_RECEIVE_PAIR, h as LIGHTNING_SEND_PAIR, i as LOCKTIME_THRESHOLD, j as LightningReceiveTreeParams, k as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, l as MIN_CLAIM_WINDOW_SECONDS, m as MIN_HEADROOM_SECONDS, n as ONCHAIN_BTC, o as ONCHAIN_CLAIM_MARGIN_SECONDS, p as ONCHAIN_DUST_SATS, q as ONCHAIN_ORDER_MARGIN_SECONDS, s as ONCHAIN_RECEIVE_PAIR, t as ONCHAIN_SECONDS_PER_BLOCK, u as ONCHAIN_SEND_PAIR, v as OnchainHtlcPhase, w as RFQ_REFUSAL_ERROR_CODES, x as RFQ_TERMINAL_STATES, y as RelaySocket, z as RfqQuote, B as RfqRefusalDetail, D as RfqRefusalErrorCode, E as RfqRefusalReason, F as RfqRefusalUnit, G as RfqStatus, S as SOLO_REFUND_HEADROOM_SECONDS, J as SwapRefusal, K as arkadeAssetLeg, N as arkadeSwapRequest, P as assertArkadeFundable, Q as assertFundable, T as assertReceivable, U as awaitOnchainFill, V as buildHtlcClaim, W as buildHtlcRefund, X as canonicalAssetAmount, Y as claimOnchainFill, Z as classifyOnchainHtlc, _ as deriveLightningReceive, $ as deriveOnchainReceive, a0 as deriveOnchainSend, a1 as extractPreimage, a2 as httpTransport, a3 as isRfqRefusalErrorCode, a4 as l1ScriptForAddress, a5 as lightningReceiveRequest, a6 as lightningSendRequest, a7 as lightningSendVtxoScript, a8 as newPreimage, a9 as newRfqId, aa as normalizeMakerPkScript, ab as normalizeMakerPublicKey, ac as offerTermsFromQuote, ad as onchainHtlcScript, ae as onchainReceiveRequest, af as onchainSendRequest, ag as paymentHashOf, ah as receiveVtxoScript, ai as relayTransport, aj as requestArkadeSwap, ak as requestLightningReceive, al as requestOnchainReceive, am as rfqPair, an as unilateralClaimDelay, ao as unilateralRefundDelay, ap as unilateralRefundWithoutReceiverDelay, aq as verifyLockupAddress, ar as verifyOfferAddress, as as verifyReceiveInvoice } from './rfq-B95nPfaa.js';
@@ -577,6 +577,8 @@ declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
577
577
  saveRfqSwap(record: RfqSwapRecord): Promise<void>;
578
578
  getRfqSwap(rfqId: string): Promise<RfqSwapRecord | undefined>;
579
579
  getAllRfqSwaps(): Promise<RfqSwapRecord[]>;
580
+ getRfqSwapsPage(state: RfqSwapState, afterId: string | undefined, limit: number): Promise<RfqSwapRecord[]>;
581
+ getRfqSwapsUpdatedPage(state: RfqSwapState, since: number, after: RfqHistoryCursor | undefined, limit: number): Promise<RfqSwapRecord[]>;
580
582
  removeRfqSwap(rfqId: string): Promise<void>;
581
583
  getScannedTxids(): Promise<Set<string>>;
582
584
  markTxidsScanned(txids: Iterable<string>): Promise<void>;
@@ -1479,7 +1481,7 @@ declare function swapActivityResolver(deps: {
1479
1481
  listSwaps(): Promise<readonly SwapActivityInput[]>;
1480
1482
  }): ActivityResolver;
1481
1483
  interface RfqSwapActivityDeps {
1482
- repository: Pick<AssetSwapRepository, "getAllRfqSwaps">;
1484
+ repository: Pick<AssetSwapRepository, "getAllRfqSwaps" | "getRfqSwapsPage" | "getRfqSwapsUpdatedPage">;
1483
1485
  /**
1484
1486
  * Consulted only for what a record cannot answer: a record written before
1485
1487
  * `fundingArkTxid` existed, and the counterparty's spend on a swap that
@@ -1505,5 +1507,15 @@ interface RfqSwapActivityDeps {
1505
1507
  * what they already are.
1506
1508
  */
1507
1509
  declare function rfqSwapActivityInputs(deps: RfqSwapActivityDeps): Promise<SwapActivityInput[]>;
1510
+ interface RfqSwapActivityPage {
1511
+ inputs: SwapActivityInput[];
1512
+ nextCursor?: string;
1513
+ }
1514
+ declare function rfqSwapActivityInputsPage(deps: RfqSwapActivityDeps, state: RfqSwapState, afterId: string | undefined, limit: number): Promise<RfqSwapActivityPage>;
1515
+ interface RfqSwapDatedActivityPage {
1516
+ inputs: SwapActivityInput[];
1517
+ nextCursor?: RfqHistoryCursor;
1518
+ }
1519
+ declare function rfqSwapActivityInputsSincePage(deps: RfqSwapActivityDeps, state: RfqSwapState, since: number, after: RfqHistoryCursor | undefined, limit: number): Promise<RfqSwapDatedActivityPage>;
1508
1520
 
1509
- export { ASSET_CARRIER_SATS, ArkadeRefundResult, type ArkadeRefunderDeps, AssetSwap, AssetSwapRepository, type AssetSwapRestoreChange, CLAIM_PACKET_TYPE, CROSS_ASSET_RAIL, ChainSource, type ClaimArkProvider, type ClaimPacketInput, type ClaimPacketShape, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type FillFunding, IndexedDbAssetSwapRepository, InvoiceFacts, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractMissing, type LockupContractReader, LockupContractSource, type LockupContractWriter, LockupRegistrationFailed, LockupSpendIndexer, LockupVtxo, MARKET_CORRIDORS, type MarketCorridor, type MarketLike, MarketsCacheEntry, OFFER_PACKET_TYPE, type Offer, type OfferContractRetirer, type OfferSwapWatcher, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, RefundArkProvider, type RefundBlockedReason, RefundNotLocallyPossibleError, type RegisterAssetSwapRestoreOptions, type RestoreAssetSwapRepositoryOptions, type RestoreAssetSwapRepositoryResult, type RestoreIndexer, type RevealParams, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqSwapState, RfqTransport, SEALED_CIPHERTEXT_LENGTH, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, SWAP_LOCKUP_CONTRACT_KIND, SWAP_LOCKUP_CONTRACT_LABEL, SWAP_LOCKUP_CONTRACT_TYPE, type SealedClaimPacket, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, type WatchOfferSwapsParams, appendArkadeScript, arkadeRefunder, awaitLockupFunding, cancelOffer, chainSourceFrom, claimPacketShape, claimReceiveLockup, classifyDepositSpend, classifySpend, covclaimdClient, createOffer, crossAssetRail, decodeOffer, discoverMarkets, encodeOffer, fillOffer, findMarket, isRfqMarket, lockupContractParams, makeCachedFeedFetch, marketAssetId, marketCorridor, marketPairLabel, offerVtxoScript, onchainSendProfile, pushClaim, registerAssetSwapRestore, registerLockupContract, requestLightningSend, requestOnchainSend, restoreAssetSwapRepository, restoreAssetSwaps, restoreOfferCoverage, retireSettledOfferContracts, revealClaimPacket, revealFieldsFromScript, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, sealClaimPacket, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, spendUpdate, swapActivityResolver, swapPrograms, validatePlan, watchOfferSwaps };
1521
+ export { ASSET_CARRIER_SATS, ArkadeRefundResult, type ArkadeRefunderDeps, AssetSwap, AssetSwapRepository, type AssetSwapRestoreChange, CLAIM_PACKET_TYPE, CROSS_ASSET_RAIL, ChainSource, type ClaimArkProvider, type ClaimPacketInput, type ClaimPacketShape, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type FillFunding, IndexedDbAssetSwapRepository, InvoiceFacts, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractMissing, type LockupContractReader, LockupContractSource, type LockupContractWriter, LockupRegistrationFailed, LockupSpendIndexer, LockupVtxo, MARKET_CORRIDORS, type MarketCorridor, type MarketLike, MarketsCacheEntry, OFFER_PACKET_TYPE, type Offer, type OfferContractRetirer, type OfferSwapWatcher, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, RefundArkProvider, type RefundBlockedReason, RefundNotLocallyPossibleError, type RegisterAssetSwapRestoreOptions, type RestoreAssetSwapRepositoryOptions, type RestoreAssetSwapRepositoryResult, type RestoreIndexer, type RevealParams, type RfqClaimSecretProjection, type RfqHashlockProjection, RfqHistoryCursor, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, type RfqSwapActivityPage, type RfqSwapDatedActivityPage, RfqSwapRecord, RfqSwapState, RfqTransport, SEALED_CIPHERTEXT_LENGTH, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, SWAP_LOCKUP_CONTRACT_KIND, SWAP_LOCKUP_CONTRACT_LABEL, SWAP_LOCKUP_CONTRACT_TYPE, type SealedClaimPacket, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, type WatchOfferSwapsParams, appendArkadeScript, arkadeRefunder, awaitLockupFunding, cancelOffer, chainSourceFrom, claimPacketShape, claimReceiveLockup, classifyDepositSpend, classifySpend, covclaimdClient, createOffer, crossAssetRail, decodeOffer, discoverMarkets, encodeOffer, fillOffer, findMarket, isRfqMarket, lockupContractParams, makeCachedFeedFetch, marketAssetId, marketCorridor, marketPairLabel, offerVtxoScript, onchainSendProfile, pushClaim, registerAssetSwapRestore, registerLockupContract, requestLightningSend, requestOnchainSend, restoreAssetSwapRepository, restoreAssetSwaps, restoreOfferCoverage, retireSettledOfferContracts, revealClaimPacket, revealFieldsFromScript, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, rfqSwapActivityInputsPage, rfqSwapActivityInputsSincePage, sealClaimPacket, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, spendUpdate, swapActivityResolver, swapPrograms, validatePlan, watchOfferSwaps };
package/dist/index.js CHANGED
@@ -103,8 +103,11 @@ import {
103
103
  } from "./chunk-QJKMTPRQ.js";
104
104
  import {
105
105
  InMemoryAssetSwapRepository,
106
+ RFQ_SWAP_MAX_PAGE_SIZE,
107
+ assertRfqSwapPageLimit,
108
+ assertRfqSwapSince,
106
109
  marketsCacheKey
107
- } from "./chunk-6ZUS47GA.js";
110
+ } from "./chunk-PJF4DWD7.js";
108
111
 
109
112
  // src/markets.ts
110
113
  import {
@@ -311,11 +314,13 @@ import {
311
314
  promisifyRequest
312
315
  } from "@arkade-os/sdk";
313
316
  var DEFAULT_DB_NAME = "arkade-intents";
314
- var DB_VERSION = 2;
317
+ var DB_VERSION = 3;
315
318
  var STORE_SWAPS = "swaps";
316
319
  var STORE_RFQ_SWAPS = "rfqSwaps";
317
320
  var STORE_SCANNED = "scannedTxids";
318
321
  var STORE_MARKETS = "markets";
322
+ var HISTORY_INDEX = "byStateUpdatedAtAndRfqId";
323
+ var PAGE_INDEX = "byStateAndRfqId";
319
324
  var STORES = [
320
325
  [STORE_SWAPS, { keyPath: "id" }],
321
326
  // v2. Separate from `swaps` rather than sharing it: the two record types
@@ -326,10 +331,16 @@ var STORES = [
326
331
  ];
327
332
  function initDatabase(db, oldVersion, transaction) {
328
333
  void oldVersion;
329
- void transaction;
330
334
  for (const [name, options] of STORES) {
331
335
  if (!db.objectStoreNames.contains(name)) db.createObjectStore(name, options);
332
336
  }
337
+ const rfq = transaction?.objectStore(STORE_RFQ_SWAPS);
338
+ if (rfq && !rfq.indexNames.contains(HISTORY_INDEX)) {
339
+ rfq.createIndex(HISTORY_INDEX, ["state", "updatedAt", "rfqId"]);
340
+ }
341
+ if (rfq && !rfq.indexNames.contains(PAGE_INDEX)) {
342
+ rfq.createIndex(PAGE_INDEX, ["state", "rfqId"]);
343
+ }
333
344
  }
334
345
  var IndexedDbAssetSwapRepository = class {
335
346
  version = 4;
@@ -371,6 +382,28 @@ var IndexedDbAssetSwapRepository = class {
371
382
  async getAllRfqSwaps() {
372
383
  return promisifyRequest((await this.readStore(STORE_RFQ_SWAPS)).getAll());
373
384
  }
385
+ async getRfqSwapsPage(state, afterId, limit) {
386
+ assertRfqSwapPageLimit(limit);
387
+ const range = IDBKeyRange.bound(
388
+ [state, afterId ?? ""],
389
+ [state, "\uFFFF"],
390
+ afterId !== void 0
391
+ );
392
+ const index = (await this.readStore(STORE_RFQ_SWAPS)).index(PAGE_INDEX);
393
+ return promisifyRequest(index.getAll(range, limit));
394
+ }
395
+ async getRfqSwapsUpdatedPage(state, since, after, limit) {
396
+ assertRfqSwapPageLimit(limit);
397
+ assertRfqSwapSince(since);
398
+ const useCursor = after !== void 0 && after.updatedAt >= since;
399
+ const range = IDBKeyRange.bound(
400
+ useCursor ? [state, after.updatedAt, after.rfqId] : [state, since, ""],
401
+ [state, Number.MAX_SAFE_INTEGER, "\uFFFF"],
402
+ useCursor
403
+ );
404
+ const index = (await this.readStore(STORE_RFQ_SWAPS)).index(HISTORY_INDEX);
405
+ return promisifyRequest(index.getAll(range, limit));
406
+ }
374
407
  async removeRfqSwap(rfqId) {
375
408
  await this.write(STORE_RFQ_SWAPS, (store) => {
376
409
  store.delete(rfqId);
@@ -966,6 +999,12 @@ import { hex as hex3 } from "@scure/base";
966
999
 
967
1000
  // src/rfqSwapState.ts
968
1001
  var RFQ_SWAP_TERMINAL_STATES = ["settled", "refunded", "failed"];
1002
+ var RFQ_SWAP_ACTIVE_STATES = [
1003
+ "pending",
1004
+ "claimable",
1005
+ "claimed",
1006
+ "needs_counterparty"
1007
+ ];
969
1008
  var isRfqSwapTerminal = (state) => RFQ_SWAP_TERMINAL_STATES.includes(state);
970
1009
 
971
1010
  // src/rfqRecord.ts
@@ -1744,7 +1783,7 @@ import {
1744
1783
  assertSubmittedArkTxid,
1745
1784
  buildOffchainTx,
1746
1785
  getArkPsbtFields,
1747
- hasTerminalSpend,
1786
+ isVtxoSpent,
1748
1787
  matchServerCheckpoints
1749
1788
  } from "@arkade-os/sdk";
1750
1789
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -1800,7 +1839,7 @@ async function findLockupVtxos(contracts, swapPkScript) {
1800
1839
  const out = [];
1801
1840
  for (const vtxo of row?.vtxos ?? []) {
1802
1841
  if (vtxo.isUnrolled) continue;
1803
- if (hasTerminalSpend(vtxo)) continue;
1842
+ if (isVtxoSpent(vtxo)) continue;
1804
1843
  const key = `${vtxo.txid}:${vtxo.vout}`;
1805
1844
  if (seen.has(key)) continue;
1806
1845
  seen.add(key);
@@ -1824,7 +1863,7 @@ async function readLockupFate(indexer, input) {
1824
1863
  const { vtxos } = await indexer.getVtxos({ scripts: [hex8.encode(input.swapPkScript)] });
1825
1864
  const all = vtxos ?? [];
1826
1865
  if (all.length === 0) return { fate: "unknown" };
1827
- const exited = all.filter((vtxo) => vtxo.isUnrolled && !hasTerminalSpend(vtxo));
1866
+ const exited = all.filter((vtxo) => vtxo.isUnrolled && !isVtxoSpent(vtxo));
1828
1867
  if (exited.length > 0) {
1829
1868
  return {
1830
1869
  fate: "exited",
@@ -1834,7 +1873,7 @@ async function readLockupFate(indexer, input) {
1834
1873
  const spentBy = /* @__PURE__ */ new Map();
1835
1874
  let everySpendNamed = true;
1836
1875
  for (const vtxo of all) {
1837
- if (!hasTerminalSpend(vtxo)) return { fate: "open" };
1876
+ if (!isVtxoSpent(vtxo)) return { fate: "open" };
1838
1877
  if (vtxo.spentBy)
1839
1878
  spentBy.set(vtxo.spentBy, {
1840
1879
  checkpointTxid: vtxo.spentBy,
@@ -2177,7 +2216,8 @@ var notify = (listeners, call) => {
2177
2216
  }
2178
2217
  }
2179
2218
  };
2180
- var RfqSwapManager = class {
2219
+ var RfqSwapManager = class _RfqSwapManager {
2220
+ static POLL_CONCURRENCY = 16;
2181
2221
  deps;
2182
2222
  config;
2183
2223
  callbacks = null;
@@ -2242,9 +2282,12 @@ var RfqSwapManager = class {
2242
2282
  claimedOutpoints = /* @__PURE__ */ new Map();
2243
2283
  /** Live `onContractEvent` subscription, held so `stop()` can drop it. */
2244
2284
  unsubscribeContracts = null;
2245
- /** Terminal records, kept so a late {@link waitForSwapCompletion} still
2246
- * answers instead of throwing "not found". Cleared by {@link removeSwap}. */
2285
+ /** Recent terminal swaps; older durable outcomes are read from the record store on demand. */
2247
2286
  finished = /* @__PURE__ */ new Map();
2287
+ /** Explicit removals stay suppressed for this manager lifetime; normal completions never enter this set.
2288
+ * Each maps to its removal sequence, so restore can tell a removal made during its rebuild. */
2289
+ removed = /* @__PURE__ */ new Map();
2290
+ removalSeq = 0;
2248
2291
  waiters = /* @__PURE__ */ new Map();
2249
2292
  /**
2250
2293
  * The request-time origin of each swap the manager may have to CREATE a
@@ -2263,6 +2306,8 @@ var RfqSwapManager = class {
2263
2306
  dirty = /* @__PURE__ */ new Set();
2264
2307
  /** Race guard: one action at a time per swap. */
2265
2308
  inProgress = /* @__PURE__ */ new Set();
2309
+ activePolls = 0;
2310
+ pollWaiters = /* @__PURE__ */ new Set();
2266
2311
  timer = null;
2267
2312
  running = false;
2268
2313
  constructor(deps, config = {}) {
@@ -2307,8 +2352,7 @@ var RfqSwapManager = class {
2307
2352
  * Rebuild every stored swap and take over monitoring them.
2308
2353
  *
2309
2354
  * The composition a consumer otherwise writes by hand, and the one place
2310
- * all four pieces meet: retention decides what to keep
2311
- * (`shouldRetainRfqSwap`), the lockup's contract row supplies the covenant
2355
+ * three pieces meet: the lockup's contract row supplies the covenant
2312
2356
  * (`lockupContractParams`), `rebuildRfqSwap` turns a record back into a
2313
2357
  * live swap, and each rebuilt swap arrives with its own origin, so nothing
2314
2358
  * is asked of the caller.
@@ -2318,9 +2362,10 @@ var RfqSwapManager = class {
2318
2362
  * forced to start driving money to do it. Call this first and `start()`
2319
2363
  * after; a manager already running polls the restored swaps at once.
2320
2364
  *
2321
- * Retention runs BEFORE the rebuild, so a record past
2322
- * `RFQ_SWAP_RETENTION_SECONDS` costs no contract lookup on its way to being
2323
- * dropped.
2365
+ * The default loads only active states through bounded pages when the
2366
+ * repository supports them. Terminal history stays durable and a late
2367
+ * completion lookup reads one record by key. `includeTerminal` opts into
2368
+ * the previous all-record result when a caller needs it.
2324
2369
  *
2325
2370
  * **A record that cannot be rebuilt is reported, never swallowed and never
2326
2371
  * fatal.** `rebuildRfqSwap` throws by design when the covenant params do
@@ -2332,13 +2377,12 @@ var RfqSwapManager = class {
2332
2377
  async restoreFromRepository(options = {}) {
2333
2378
  const repository = this.requireRepository("restoreFromRepository");
2334
2379
  const params = options.params ?? this.paramsFromContracts();
2335
- const records = await repository.getAllRfqSwaps();
2336
- const pruned = await this.dropRetired(repository, records);
2337
- const retired = new Set(pruned);
2338
2380
  const restored = [];
2339
2381
  const failed = [];
2340
- for (const record of records) {
2341
- if (retired.has(record.rfqId)) continue;
2382
+ const restore = async (record) => {
2383
+ if (!options.includeTerminal && isRfqSwapTerminal(record.state)) return;
2384
+ if (this.monitored.has(record.rfqId)) return;
2385
+ const removedAt = this.removed.get(record.rfqId);
2342
2386
  let swap;
2343
2387
  try {
2344
2388
  swap = rebuildRfqSwap(record, await params(record));
@@ -2347,19 +2391,50 @@ var RfqSwapManager = class {
2347
2391
  rfqId: record.rfqId,
2348
2392
  error: error instanceof Error ? error : new Error(errorMessage(error))
2349
2393
  });
2350
- continue;
2394
+ return;
2395
+ }
2396
+ if (this.monitored.has(record.rfqId)) return;
2397
+ if (this.removed.get(record.rfqId) !== removedAt) return;
2398
+ this.removed.delete(record.rfqId);
2399
+ if (isRfqSwapTerminal(swap.state)) this.rememberFinished(swap, true);
2400
+ else {
2401
+ this.origins.set(record.rfqId, rfqSwapOriginOf(record));
2402
+ this.track(swap);
2351
2403
  }
2352
- this.origins.set(record.rfqId, rfqSwapOriginOf(record));
2353
- if (isRfqSwapTerminal(swap.state)) this.finished.set(swap.rfqId, swap);
2354
- else this.track(swap);
2355
2404
  restored.push(swap);
2405
+ };
2406
+ if (repository.getRfqSwapsPage && !options.includeTerminal) {
2407
+ for (const state of RFQ_SWAP_ACTIVE_STATES) {
2408
+ let afterId;
2409
+ for (; ; ) {
2410
+ const page = await repository.getRfqSwapsPage(state, afterId, 256);
2411
+ if (page.length === 0) break;
2412
+ if (page.length > 256)
2413
+ throw new Error("getRfqSwapsPage exceeded its requested limit");
2414
+ let cursor = afterId ?? "";
2415
+ for (const record of page) {
2416
+ if (record.state !== state || record.rfqId <= cursor) {
2417
+ throw new Error(
2418
+ "getRfqSwapsPage returned an unordered or mismatched page"
2419
+ );
2420
+ }
2421
+ cursor = record.rfqId;
2422
+ await restore(record);
2423
+ }
2424
+ afterId = cursor;
2425
+ if (page.length < 256) break;
2426
+ }
2427
+ }
2428
+ } else {
2429
+ const records = await repository.getAllRfqSwaps();
2430
+ for (const record of records) {
2431
+ await restore(record);
2432
+ }
2356
2433
  }
2357
2434
  if (this.running) {
2358
- await Promise.allSettled(
2359
- restored.filter((swap) => this.monitored.has(swap.rfqId)).map((swap) => this.pollSwap(swap))
2360
- );
2435
+ await this.pollMany(restored.filter((swap) => this.monitored.has(swap.rfqId)));
2361
2436
  }
2362
- return { restored, failed, pruned };
2437
+ return { restored, failed, pruned: [] };
2363
2438
  }
2364
2439
  /**
2365
2440
  * Drop stored records that are terminal and past
@@ -2370,10 +2445,8 @@ var RfqSwapManager = class {
2370
2445
  * lives in `shouldRetainRfqSwap`, which this defers to rather than
2371
2446
  * restating.
2372
2447
  *
2373
- * Public because retention is a caller's cadence, not the manager's: a
2374
- * long-lived process wants it on a timer of its own, a mobile app wants it
2375
- * at boot. {@link restoreFromRepository} runs it first, so the boot path
2376
- * needs no separate call.
2448
+ * This legacy deletion API is explicit; normal restore preserves history.
2449
+ * It loads every stored record: no backend offers indexed deletion for it.
2377
2450
  */
2378
2451
  async pruneRetiredSwaps() {
2379
2452
  const repository = this.deps.repository;
@@ -2386,12 +2459,15 @@ var RfqSwapManager = class {
2386
2459
  for (const record of records) {
2387
2460
  if (shouldRetainRfqSwap(record, now)) continue;
2388
2461
  await repository.removeRfqSwap(record.rfqId);
2389
- this.finished.delete(record.rfqId);
2390
- if (!this.monitored.has(record.rfqId)) this.origins.delete(record.rfqId);
2462
+ this.forgetRetired(record.rfqId);
2391
2463
  dropped.push(record.rfqId);
2392
2464
  }
2393
2465
  return dropped;
2394
2466
  }
2467
+ forgetRetired(rfqId) {
2468
+ this.finished.delete(rfqId);
2469
+ if (!this.monitored.has(rfqId)) this.origins.delete(rfqId);
2470
+ }
2395
2471
  requireRepository(method) {
2396
2472
  const repository = this.deps.repository;
2397
2473
  if (!repository) {
@@ -2416,8 +2492,7 @@ var RfqSwapManager = class {
2416
2492
  /**
2417
2493
  * Load records and begin monitoring. Runs one pass immediately — a caller
2418
2494
  * resuming after a restart may be well past a deadline already — then
2419
- * every `pollIntervalMs`. Records that are already terminal are kept only
2420
- * so {@link waitForSwapCompletion} can answer for them.
2495
+ * every `pollIntervalMs`. Terminal outcomes in a repository are read on demand.
2421
2496
  *
2422
2497
  * Calling it again while running loads the records and returns rather than
2423
2498
  * re-arming — dropping them silently would strand a funded swap on a
@@ -2434,8 +2509,11 @@ var RfqSwapManager = class {
2434
2509
  async start(swaps = []) {
2435
2510
  for (const swap of swaps) await this.admit(swap);
2436
2511
  for (const swap of swaps) {
2437
- if (isRfqSwapTerminal(swap.state)) this.finished.set(swap.rfqId, swap);
2438
- else this.track(swap);
2512
+ this.removed.delete(swap.rfqId);
2513
+ if (isRfqSwapTerminal(swap.state)) {
2514
+ this.rememberFinished(swap);
2515
+ this.origins.delete(swap.rfqId);
2516
+ } else this.track(swap);
2439
2517
  }
2440
2518
  if (this.running) return;
2441
2519
  this.running = true;
@@ -2480,8 +2558,10 @@ var RfqSwapManager = class {
2480
2558
  */
2481
2559
  async addSwap(swap, origin) {
2482
2560
  await this.admit(swap, origin);
2561
+ this.removed.delete(swap.rfqId);
2483
2562
  if (isRfqSwapTerminal(swap.state)) {
2484
- this.finished.set(swap.rfqId, swap);
2563
+ this.rememberFinished(swap);
2564
+ this.origins.delete(swap.rfqId);
2485
2565
  return;
2486
2566
  }
2487
2567
  this.track(swap);
@@ -2517,6 +2597,7 @@ var RfqSwapManager = class {
2517
2597
  * manager stops driving the swap. Retiring the row is reserved for a swap
2518
2598
  * that reached a terminal state, where the lockup is provably done. */
2519
2599
  async removeSwap(rfqId) {
2600
+ this.removed.set(rfqId, ++this.removalSeq);
2520
2601
  this.untrack(rfqId);
2521
2602
  this.finished.delete(rfqId);
2522
2603
  this.registered.delete(rfqId);
@@ -2540,6 +2621,7 @@ var RfqSwapManager = class {
2540
2621
  async isProcessing(rfqId) {
2541
2622
  return this.inProgress.has(rfqId);
2542
2623
  }
2624
+ /** `finishedSwaps` counts terminal swaps cached in memory, not those only in the repository. */
2543
2625
  async getStats() {
2544
2626
  return {
2545
2627
  isRunning: this.running,
@@ -2559,7 +2641,30 @@ var RfqSwapManager = class {
2559
2641
  * no-op for any swap already being worked on.
2560
2642
  */
2561
2643
  async poll() {
2562
- await Promise.allSettled([...this.monitored.values()].map((swap) => this.pollSwap(swap)));
2644
+ await this.pollMany([...this.monitored.values()]);
2645
+ }
2646
+ async pollMany(swaps) {
2647
+ for (let i = 0; i < swaps.length; i += _RfqSwapManager.POLL_CONCURRENCY) {
2648
+ await Promise.allSettled(
2649
+ swaps.slice(i, i + _RfqSwapManager.POLL_CONCURRENCY).map((swap) => this.pollSwap(swap))
2650
+ );
2651
+ }
2652
+ }
2653
+ async acquirePollSlot() {
2654
+ if (this.activePolls < _RfqSwapManager.POLL_CONCURRENCY) {
2655
+ this.activePolls++;
2656
+ } else {
2657
+ await new Promise((resolve) => this.pollWaiters.add(resolve));
2658
+ }
2659
+ return () => {
2660
+ const next = this.pollWaiters.values().next().value;
2661
+ if (next) {
2662
+ this.pollWaiters.delete(next);
2663
+ next();
2664
+ } else {
2665
+ this.activePolls--;
2666
+ }
2667
+ };
2563
2668
  }
2564
2669
  /**
2565
2670
  * Resolve once this swap's PAYOUT is decided — which for onchain-send is
@@ -2578,6 +2683,15 @@ var RfqSwapManager = class {
2578
2683
  */
2579
2684
  async waitForSwapCompletion(rfqId) {
2580
2685
  const swap = this.monitored.get(rfqId) ?? this.finished.get(rfqId);
2686
+ if (!swap && !this.removed.has(rfqId) && this.deps.repository) {
2687
+ const record = await this.deps.repository.getRfqSwap(rfqId);
2688
+ if (record && !this.removed.has(rfqId) && isRfqSwapTerminal(record.state)) {
2689
+ if (record.state === "failed") {
2690
+ throw new Error(record.failure ?? `swap ${rfqId} failed`);
2691
+ }
2692
+ return outcomeOfRecord(record);
2693
+ }
2694
+ }
2581
2695
  if (!swap) throw new Error(`swap ${rfqId} is not monitored`);
2582
2696
  if (swap.state === "failed") throw new Error(swap.failure ?? `swap ${rfqId} failed`);
2583
2697
  if (isPayoutDecided(swap)) return outcomeOf(swap);
@@ -2720,16 +2834,21 @@ var RfqSwapManager = class {
2720
2834
  if (this.inProgress.has(swap.rfqId)) return;
2721
2835
  if (!this.monitored.has(swap.rfqId)) return;
2722
2836
  this.inProgress.add(swap.rfqId);
2837
+ const release = await this.acquirePollSlot();
2723
2838
  try {
2724
- await this.runPass(swap);
2839
+ if (this.monitored.has(swap.rfqId)) await this.runPass(swap);
2725
2840
  } finally {
2726
- const persisted = this.dirty.has(swap.rfqId) ? await this.save(swap) : true;
2727
- if (persisted) {
2728
- this.dirty.delete(swap.rfqId);
2729
- this.settleWaiters(swap);
2730
- if (isRfqSwapTerminal(swap.state)) this.finalize(swap);
2841
+ try {
2842
+ const persisted = this.dirty.has(swap.rfqId) ? await this.save(swap) : true;
2843
+ if (persisted) {
2844
+ this.dirty.delete(swap.rfqId);
2845
+ this.settleWaiters(swap);
2846
+ if (isRfqSwapTerminal(swap.state)) this.finalize(swap);
2847
+ }
2848
+ } finally {
2849
+ this.inProgress.delete(swap.rfqId);
2850
+ release();
2731
2851
  }
2732
- this.inProgress.delete(swap.rfqId);
2733
2852
  }
2734
2853
  }
2735
2854
  async runPass(swap) {
@@ -3156,8 +3275,10 @@ var RfqSwapManager = class {
3156
3275
  finalize(swap) {
3157
3276
  if (!this.monitored.has(swap.rfqId)) return;
3158
3277
  this.untrack(swap.rfqId);
3159
- this.finished.set(swap.rfqId, swap);
3278
+ this.rememberFinished(swap, true);
3160
3279
  this.retireContract(swap);
3280
+ this.registered.delete(swap.rfqId);
3281
+ this.origins.delete(swap.rfqId);
3161
3282
  if (swap.state === "failed") {
3162
3283
  notify(
3163
3284
  this.swapFailedListeners,
@@ -3167,6 +3288,10 @@ var RfqSwapManager = class {
3167
3288
  }
3168
3289
  notify(this.swapCompletedListeners, (listener) => listener(swap));
3169
3290
  }
3291
+ rememberFinished(swap, durable = false) {
3292
+ if (durable && this.deps.repository) this.finished.delete(swap.rfqId);
3293
+ else this.finished.set(swap.rfqId, swap);
3294
+ }
3170
3295
  settleWaiters(swap) {
3171
3296
  const waiting = this.waiters.get(swap.rfqId);
3172
3297
  if (!waiting) return;
@@ -3200,6 +3325,14 @@ var outcomeOf = (swap) => {
3200
3325
  txid: lostReceive ? swap.refundArkTxid : traderClaimTxid(swap) ?? swap.refundArkTxid
3201
3326
  };
3202
3327
  };
3328
+ var outcomeOfRecord = (record) => {
3329
+ const profileClaim = record.kind === "onchain_send" ? record.profile.claimTxid : record.kind === "lightning_receive" ? record.profile.claimArkTxid : void 0;
3330
+ const claimTxid = typeof profileClaim === "string" ? profileClaim : void 0;
3331
+ return {
3332
+ state: record.state,
3333
+ txid: record.kind === "lightning_receive" && record.state === "refunded" ? record.refundArkTxid : claimTxid ?? record.refundArkTxid
3334
+ };
3335
+ };
3203
3336
  var errorMessage = (error) => error instanceof Error ? error.message : String(error);
3204
3337
  var outpointKey = (vtxo) => `${vtxo.txid}:${vtxo.vout}`;
3205
3338
 
@@ -3264,6 +3397,56 @@ async function rfqSwapActivityInputs(deps) {
3264
3397
  const records = await deps.repository.getAllRfqSwaps();
3265
3398
  return Promise.all(records.map((record) => activityInputOf(record, deps.indexer)));
3266
3399
  }
3400
+ async function rfqSwapActivityInputsPage(deps, state, afterId, limit) {
3401
+ assertRfqSwapPageLimit(limit);
3402
+ const page = deps.repository.getRfqSwapsPage;
3403
+ if (!page) throw new Error("repository does not support paged RFQ activity reads");
3404
+ const records = await page.call(deps.repository, state, afterId, limit);
3405
+ if (records.length > limit) throw new Error("getRfqSwapsPage exceeded its requested limit");
3406
+ let cursor = afterId ?? "";
3407
+ for (const record of records) {
3408
+ if (record.state !== state || record.rfqId <= cursor) {
3409
+ throw new Error("getRfqSwapsPage returned an unordered or mismatched page");
3410
+ }
3411
+ cursor = record.rfqId;
3412
+ }
3413
+ const inputs = await projectActivityInputs(records, deps.indexer);
3414
+ return {
3415
+ inputs,
3416
+ ...records.length === limit && records.length > 0 ? { nextCursor: cursor } : {}
3417
+ };
3418
+ }
3419
+ async function rfqSwapActivityInputsSincePage(deps, state, since, after, limit) {
3420
+ assertRfqSwapPageLimit(limit);
3421
+ assertRfqSwapSince(since);
3422
+ const page = deps.repository.getRfqSwapsUpdatedPage;
3423
+ if (!page) throw new Error("repository does not support date-filtered RFQ history pages");
3424
+ const records = await page.call(deps.repository, state, since, after, limit);
3425
+ if (records.length > limit)
3426
+ throw new Error("getRfqSwapsUpdatedPage exceeded its requested limit");
3427
+ let cursor = after;
3428
+ for (const record of records) {
3429
+ if (record.state !== state || record.updatedAt < since || cursor && (record.updatedAt < cursor.updatedAt || record.updatedAt === cursor.updatedAt && record.rfqId <= cursor.rfqId)) {
3430
+ throw new Error("getRfqSwapsUpdatedPage returned an unordered or mismatched page");
3431
+ }
3432
+ cursor = { updatedAt: record.updatedAt, rfqId: record.rfqId };
3433
+ }
3434
+ return {
3435
+ inputs: await projectActivityInputs(records, deps.indexer),
3436
+ ...records.length === limit && cursor ? { nextCursor: cursor } : {}
3437
+ };
3438
+ }
3439
+ async function projectActivityInputs(records, indexer) {
3440
+ const inputs = [];
3441
+ for (let i = 0; i < records.length; i += 16) {
3442
+ inputs.push(
3443
+ ...await Promise.all(
3444
+ records.slice(i, i + 16).map((record) => activityInputOf(record, indexer))
3445
+ )
3446
+ );
3447
+ }
3448
+ return inputs;
3449
+ }
3267
3450
  async function activityInputOf(record, indexer) {
3268
3451
  const txids = /* @__PURE__ */ new Set();
3269
3452
  if (record.fundingArkTxid) txids.add(record.fundingArkTxid);
@@ -3334,6 +3517,8 @@ export {
3334
3517
  REFUND_MTP_LAG_SECONDS,
3335
3518
  RFQ_REFUSAL_ERROR_CODES,
3336
3519
  RFQ_RESOLVED_STATES,
3520
+ RFQ_SWAP_ACTIVE_STATES,
3521
+ RFQ_SWAP_MAX_PAGE_SIZE,
3337
3522
  RFQ_SWAP_RETENTION_SECONDS,
3338
3523
  RFQ_SWAP_TERMINAL_STATES,
3339
3524
  RFQ_TERMINAL_STATES,
@@ -3438,6 +3623,8 @@ export {
3438
3623
  rfqSecretsProfile,
3439
3624
  rfqSignerOf,
3440
3625
  rfqSwapActivityInputs,
3626
+ rfqSwapActivityInputsPage,
3627
+ rfqSwapActivityInputsSincePage,
3441
3628
  rfqSwapOriginOf,
3442
3629
  sealClaimPacket,
3443
3630
  senderIdentityForSwapRecord,
@@ -29,6 +29,19 @@ __export(realm_exports, {
29
29
  module.exports = __toCommonJS(realm_exports);
30
30
 
31
31
  // src/repository.ts
32
+ var RFQ_SWAP_MAX_PAGE_SIZE = 500;
33
+ function assertRfqSwapPageLimit(limit) {
34
+ if (!Number.isInteger(limit) || limit < 1 || limit > RFQ_SWAP_MAX_PAGE_SIZE) {
35
+ throw new RangeError(
36
+ `RFQ swap page limit must be an integer from 1 to ${RFQ_SWAP_MAX_PAGE_SIZE}`
37
+ );
38
+ }
39
+ }
40
+ function assertRfqSwapSince(since) {
41
+ if (!Number.isSafeInteger(since) || since < 0) {
42
+ throw new RangeError("RFQ history since must be a non-negative Unix timestamp in seconds");
43
+ }
44
+ }
32
45
  var marketsCacheKey = (network, registry) => `arkade-intents-markets-${network}-${registry}`;
33
46
 
34
47
  // src/repositories/realm/repository.ts
@@ -86,6 +99,36 @@ var RealmAssetSwapRepository = class {
86
99
  (o) => JSON.parse(o.data)
87
100
  );
88
101
  }
102
+ async getRfqSwapsPage(state, afterId, limit) {
103
+ assertRfqSwapPageLimit(limit);
104
+ const rows = this.realm.objects(RFQ_SWAPS).filtered("state == $0 AND rfqId > $1", state, afterId ?? "").sorted("rfqId");
105
+ const page = [];
106
+ for (const row of rows) {
107
+ page.push(JSON.parse(row.data));
108
+ if (page.length === limit) break;
109
+ }
110
+ return page;
111
+ }
112
+ async getRfqSwapsUpdatedPage(state, since, after, limit) {
113
+ assertRfqSwapPageLimit(limit);
114
+ assertRfqSwapSince(since);
115
+ const rows = after ? this.realm.objects(RFQ_SWAPS).filtered(
116
+ "state == $0 AND updatedAt >= $1 AND (updatedAt > $2 OR (updatedAt == $2 AND rfqId > $3))",
117
+ state,
118
+ since,
119
+ after.updatedAt,
120
+ after.rfqId
121
+ ) : this.realm.objects(RFQ_SWAPS).filtered("state == $0 AND updatedAt >= $1", state, since);
122
+ const page = [];
123
+ for (const row of rows.sorted([
124
+ ["updatedAt", false],
125
+ ["rfqId", false]
126
+ ])) {
127
+ page.push(JSON.parse(row.data));
128
+ if (page.length === limit) break;
129
+ }
130
+ return page;
131
+ }
89
132
  async removeRfqSwap(rfqId) {
90
133
  this.realm.write(() => {
91
134
  this.realm.delete(
@@ -1,5 +1,5 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-CZYc8Y38.cjs';
2
+ import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, b as RfqSwapState, c as RfqHistoryCursor, M as MarketsCacheEntry } from '../../repository-CSBh-0NH.cjs';
3
3
  import '@arkade-os/solver-discovery';
4
4
  import '@arkade-os/sdk';
5
5
  import '../../rfq-B95nPfaa.cjs';
@@ -33,6 +33,8 @@ declare class RealmAssetSwapRepository implements AssetSwapRepository {
33
33
  saveRfqSwap(record: RfqSwapRecord): Promise<void>;
34
34
  getRfqSwap(rfqId: string): Promise<RfqSwapRecord | undefined>;
35
35
  getAllRfqSwaps(): Promise<RfqSwapRecord[]>;
36
+ getRfqSwapsPage(state: RfqSwapState, afterId: string | undefined, limit: number): Promise<RfqSwapRecord[]>;
37
+ getRfqSwapsUpdatedPage(state: RfqSwapState, since: number, after: RfqHistoryCursor | undefined, limit: number): Promise<RfqSwapRecord[]>;
36
38
  removeRfqSwap(rfqId: string): Promise<void>;
37
39
  getScannedTxids(): Promise<Set<string>>;
38
40
  markTxidsScanned(txids: Iterable<string>): Promise<void>;