@arkade-os/swap 0.1.2 → 0.1.4

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/advanced.cjs +31 -38
  3. package/dist/advanced.d.cts +8 -8
  4. package/dist/advanced.d.ts +8 -8
  5. package/dist/advanced.js +5 -3
  6. package/dist/{chunk-ICSREL7N.js → chunk-7BBQ74BG.js} +15 -14
  7. package/dist/{chunk-BLECLU5Q.js → chunk-GJKGPE3S.js} +19 -33
  8. package/dist/{chunk-J2PMAQP2.js → chunk-HDCC3JZR.js} +14 -11
  9. package/dist/index.cjs +28 -38
  10. package/dist/index.d.cts +6 -6
  11. package/dist/index.d.ts +6 -6
  12. package/dist/index.js +3 -3
  13. package/dist/{lockupContract-CIXkJPxV.d.ts → lockupContract-CdXh9yIr.d.ts} +1 -1
  14. package/dist/{lockupContract-CkhWMKCo.d.cts → lockupContract-QfbsjyXG.d.cts} +1 -1
  15. package/dist/node/index.cjs +37 -37
  16. package/dist/node/index.js +37 -37
  17. package/dist/nostr.d.cts +1 -1
  18. package/dist/nostr.d.ts +1 -1
  19. package/dist/nostr.js +1 -1
  20. package/dist/{offer-Diff5Flc.d.cts → offer-BxzPQ6zh.d.cts} +11 -11
  21. package/dist/{offer-BPD2ortO.d.ts → offer-Q1lVhrVX.d.ts} +11 -11
  22. package/dist/{offerFillPlan-B-5ae_gQ.d.cts → offerFillPlan-CvKlB246.d.cts} +16 -11
  23. package/dist/{offerFillPlan-CJzneX6F.d.ts → offerFillPlan-_PhFt4B1.d.ts} +16 -11
  24. package/dist/protocol.cjs +27 -38
  25. package/dist/protocol.d.cts +9 -8
  26. package/dist/protocol.d.ts +9 -8
  27. package/dist/protocol.js +2 -2
  28. package/dist/repositories/realm/index.d.cts +2 -2
  29. package/dist/repositories/realm/index.d.ts +2 -2
  30. package/dist/repositories/sqlite/index.cjs +37 -37
  31. package/dist/repositories/sqlite/index.d.cts +3 -3
  32. package/dist/repositories/sqlite/index.d.ts +3 -3
  33. package/dist/repositories/sqlite/index.js +37 -37
  34. package/dist/{repository-BBVRh9ez.d.ts → repository-BOQ1qYoj.d.ts} +8 -7
  35. package/dist/{repository-C4pvymhs.d.cts → repository-Cut4eEkm.d.cts} +8 -7
  36. package/dist/{rfq-C0tHOvn6.d.cts → rfq-CP-P0PSL.d.cts} +7 -7
  37. package/dist/{rfq-C0tHOvn6.d.ts → rfq-CP-P0PSL.d.ts} +7 -7
  38. package/dist/{watch-7BiRa4oB.d.ts → watch-D15U0QpD.d.ts} +1 -1
  39. package/dist/{watch-Bxq-lx_6.d.cts → watch-D4PeBZ3H.d.cts} +1 -1
  40. package/package.json +2 -2
@@ -60,7 +60,7 @@ import {
60
60
  undeliveredCarry,
61
61
  walletOperator,
62
62
  watchOfferSwaps
63
- } from "./chunk-BLECLU5Q.js";
63
+ } from "./chunk-GJKGPE3S.js";
64
64
  import {
65
65
  ARKADE_BTC,
66
66
  ASSET_CARRIER_SATS,
@@ -125,7 +125,7 @@ import {
125
125
  unilateralClaimDelay,
126
126
  verifyOfferAddress,
127
127
  withExitClosure
128
- } from "./chunk-ICSREL7N.js";
128
+ } from "./chunk-7BBQ74BG.js";
129
129
  import {
130
130
  assertRfqSwapPageFilter,
131
131
  collectAssetSwaps,
@@ -1204,7 +1204,7 @@ var emulatorPubkeyFor = (base) => {
1204
1204
  } catch {
1205
1205
  throw new MissingCorridorDep(
1206
1206
  "arkade",
1207
- `covenant co-signer key (none is pinned for ${base.networkName}; pass emulatorPubkey)`
1207
+ `key for the operator's cosigner that emulates Arkade Script (none is pinned for ${base.networkName}; pass emulatorPubkey)`
1208
1208
  );
1209
1209
  }
1210
1210
  };
@@ -1263,7 +1263,7 @@ function resolveCorridorDeps(corridor, overrides, base) {
1263
1263
  }
1264
1264
  }
1265
1265
  }
1266
- var liveArkadeInfo = async (wallet, opts = {}) => {
1266
+ var liveOperatorInfo = async (wallet, opts = {}) => {
1267
1267
  const requireLive = opts.requireLive ?? true;
1268
1268
  try {
1269
1269
  return await wallet.getArkadeInfo({ requireLive });
@@ -1274,8 +1274,9 @@ var liveArkadeInfo = async (wallet, opts = {}) => {
1274
1274
  );
1275
1275
  }
1276
1276
  };
1277
+ var liveArkadeInfo = liveOperatorInfo;
1277
1278
  var resolveCorridorBase = async (input) => {
1278
- const info = await liveArkadeInfo(input.wallet, { requireLive: input.requireLive });
1279
+ const info = await liveOperatorInfo(input.wallet, { requireLive: input.requireLive });
1279
1280
  const networkName = info.network;
1280
1281
  return {
1281
1282
  wallet: input.wallet,
@@ -2393,7 +2394,8 @@ var createSwapDrive = (config) => {
2393
2394
  // Passed through: `pushClaim`'s own value check decides whether `P` is published.
2394
2395
  expectedAmount: swap.expectedAmount,
2395
2396
  partiallyClaimed,
2396
- network: await pinnedNetwork()
2397
+ network: await pinnedNetwork(),
2398
+ oneShot: wallet.oneShotSubmit
2397
2399
  })
2398
2400
  );
2399
2401
  };
@@ -3700,7 +3702,7 @@ import { hex as hex8 } from "@scure/base";
3700
3702
  import {
3701
3703
  ArkAddress as ArkAddress6,
3702
3704
  asset as asset4,
3703
- networkFromArkadeInfo,
3705
+ networkFromOperatorInfo,
3704
3706
  provisionClaimSecret,
3705
3707
  provisionRefundKey,
3706
3708
  toXOnly
@@ -3712,7 +3714,7 @@ var lockupOf = (derived) => ({
3712
3714
  pkScript: derived.swapPkScript
3713
3715
  });
3714
3716
  var covenantInputs = (input) => {
3715
- const network = networkFromArkadeInfo(input.info);
3717
+ const network = networkFromOperatorInfo(input.info);
3716
3718
  const arkade2 = input.corridors.get("arkade").deps;
3717
3719
  return {
3718
3720
  operatorPubkey: toXOnly(hex8.decode(input.info.signerPubkey), "ark signer key"),
@@ -3782,7 +3784,7 @@ var quoteArkadeAsset = async (input) => {
3782
3784
  const receivePkScript = resolveReceivePkScript(
3783
3785
  receiveAddress,
3784
3786
  maker.pkScript,
3785
- networkFromArkadeInfo(input.info).hrp,
3787
+ networkFromOperatorInfo(input.info).hrp,
3786
3788
  toXOnly(hex8.decode(input.info.signerPubkey), "ark signer key")
3787
3789
  );
3788
3790
  const choice = payment?.carrier;
@@ -3850,7 +3852,7 @@ var quoteArkadeAsset = async (input) => {
3850
3852
  receiveAddress: receiveAddress ?? new ArkAddress6(
3851
3853
  toXOnly(hex8.decode(input.info.signerPubkey), "ark signer key"),
3852
3854
  maker.pkScript.slice(2),
3853
- networkFromArkadeInfo(input.info).hrp
3855
+ networkFromOperatorInfo(input.info).hrp
3854
3856
  ).encode(),
3855
3857
  validUntil,
3856
3858
  ...carrier === void 0 ? {} : { carrier },
@@ -4566,7 +4568,7 @@ var createSwapClient = (config) => {
4566
4568
  remember(quoteId, preparation);
4567
4569
  return quote;
4568
4570
  }
4569
- const info = await liveArkadeInfo(wallet, { requireLive: true });
4571
+ const info = await liveOperatorInfo(wallet, { requireLive: true });
4570
4572
  const rendezvous = market.card.discovery_pubkey;
4571
4573
  if (rendezvous === void 0) {
4572
4574
  throw new Error(`card ${market.card.solver} names no discovery key to address`);
@@ -4919,6 +4921,7 @@ export {
4919
4921
  esploraChainSource,
4920
4922
  ONCHAIN_CLAIM_FEE_RATE_SATVB,
4921
4923
  resolveCorridorDeps,
4924
+ liveOperatorInfo,
4922
4925
  liveArkadeInfo,
4923
4926
  resolveCorridorBase,
4924
4927
  CORRIDOR_FACTORIES,
package/dist/index.cjs CHANGED
@@ -1272,7 +1272,7 @@ async function deriveOffer(wallet, params) {
1272
1272
  })()
1273
1273
  ]);
1274
1274
  const operatorPubKey = import_base5.hex.decode((0, import_sdk5.toXOnlySignerHex)(info.signerPubkey));
1275
- const network = (0, import_sdk5.networkFromArkadeInfo)(info);
1275
+ const network = (0, import_sdk5.networkFromOperatorInfo)(info);
1276
1276
  const emuKey = import_base5.hex.decode(
1277
1277
  (0, import_sdk5.toXOnlySignerHex)((0, import_sdk5.resolveEmulatorPubkey)(network, params.emulatorPubkey))
1278
1278
  );
@@ -1331,8 +1331,9 @@ async function prepareOfferCancel(wallet, offerHex, opts) {
1331
1331
  identity: wallet.identity,
1332
1332
  // registered offers resolve VTXOs from the contract repository; the indexer is the fallback
1333
1333
  // for offers created before registration existed
1334
- contractManager
1334
+ contractManager,
1335
1335
  // no `network`: the row lookup is by script and the payout comes from wallet.getAddress()
1336
+ oneShotSubmit: wallet.oneShotSubmit
1336
1337
  });
1337
1338
  const operatorPubkey = swapAddress ? import_sdk5.ArkAddress.decode(swapAddress).serverPubKey : client.serverKey;
1338
1339
  const { program, args, keys } = swapProgramBinding(offer, operatorPubkey);
@@ -1367,7 +1368,7 @@ async function connectFillContract(wallet, arkServerUrl, offer, opts = {}) {
1367
1368
  const { swapAddress, emulator, emulatorPubkey } = opts;
1368
1369
  const contractManager = await wallet.getContractManager();
1369
1370
  const client = await import_sdk5.arkade.Arkade.connect({
1370
- arkade: new import_sdk5.RestArkProvider(arkServerUrl),
1371
+ arkade: new import_sdk5.RestOperatorProvider(arkServerUrl),
1371
1372
  indexer: new import_sdk5.RestIndexerProvider(arkServerUrl),
1372
1373
  identity: wallet.identity,
1373
1374
  contractManager,
@@ -1737,7 +1738,7 @@ var init_offer = __esm({
1737
1738
  derivingClient = (wallet, info, contractManager) => import_sdk5.arkade.Arkade.connect({
1738
1739
  arkade: { getInfo: async () => info },
1739
1740
  identity: wallet.identity,
1740
- network: (0, import_sdk5.networkFromArkadeInfo)(info),
1741
+ network: (0, import_sdk5.networkFromOperatorInfo)(info),
1741
1742
  contractManager
1742
1743
  });
1743
1744
  NoSpendableDepositError = class extends Error {
@@ -3097,7 +3098,7 @@ var operatorUnrollScript = async (operator, network) => {
3097
3098
  const info = await operator.getInfo();
3098
3099
  return (0, import_sdk8.assertValidServerUnrollScript)(
3099
3100
  info.checkpointTapscript,
3100
- network ?? (0, import_sdk8.networkFromArkadeInfo)(info),
3101
+ network ?? (0, import_sdk8.networkFromOperatorInfo)(info),
3101
3102
  (0, import_sdk8.toXOnly)(import_base7.hex.decode(info.forfeitPubkey), "forfeit key")
3102
3103
  );
3103
3104
  };
@@ -3143,30 +3144,16 @@ async function pushRefundWithoutReceiver(operator, input) {
3143
3144
  const leaf = input.contract.refundWithoutReceiver();
3144
3145
  const vtxos = boundedLockupSpend(input.vtxos);
3145
3146
  const amount = vtxos.reduce((sum, vtxo) => sum + vtxo.value, 0);
3146
- const { arkTx: tx, checkpoints } = (0, import_sdk8.buildOffchainTx)(
3147
- lockupInputs(vtxos, input.contract, leaf),
3148
- [{ script: refundPkScript, amount: BigInt(amount) }, ...lockupAssetOutputs(vtxos)],
3149
- serverUnrollScript
3150
- );
3151
- const signedTx = await input.sender.sign(tx);
3152
- const submitted = await operator.submitTx(
3153
- import_base7.base64.encode(signedTx.toPSBT()),
3154
- checkpoints.map((c) => import_base7.base64.encode(c.toPSBT()))
3155
- );
3156
- (0, import_sdk8.assertSubmittedArkTxid)(submitted, signedTx, "refundWithoutReceiver");
3157
- const matched = (0, import_sdk8.matchServerCheckpoints)(
3158
- submitted.signedCheckpointTxs,
3159
- checkpoints,
3160
- "refundWithoutReceiver"
3161
- );
3162
- const finalCheckpoints = await Promise.all(
3163
- matched.map(
3164
- async ({ server }) => import_base7.base64.encode((await input.sender.sign(server, [0])).toPSBT())
3165
- )
3166
- );
3167
- await operator.finalizeTx(submitted.arkTxid, finalCheckpoints);
3147
+ const txid = await (0, import_sdk8.signAndSubmitOffchainTx)({
3148
+ identity: input.sender,
3149
+ provider: operator,
3150
+ inputs: lockupInputs(vtxos, input.contract, leaf),
3151
+ outputs: [{ script: refundPkScript, amount: BigInt(amount) }, ...lockupAssetOutputs(vtxos)],
3152
+ serverUnrollScript,
3153
+ oneShot: input.oneShot
3154
+ });
3168
3155
  return {
3169
- txid: submitted.arkTxid,
3156
+ txid,
3170
3157
  amount,
3171
3158
  left: input.vtxos.length - vtxos.length,
3172
3159
  spent: vtxos
@@ -3665,7 +3652,7 @@ var emulatorPubkeyFor = (base) => {
3665
3652
  } catch {
3666
3653
  throw new MissingCorridorDep(
3667
3654
  "arkade",
3668
- `covenant co-signer key (none is pinned for ${base.networkName}; pass emulatorPubkey)`
3655
+ `key for the operator's cosigner that emulates Arkade Script (none is pinned for ${base.networkName}; pass emulatorPubkey)`
3669
3656
  );
3670
3657
  }
3671
3658
  };
@@ -3724,7 +3711,7 @@ function resolveCorridorDeps(corridor, overrides, base) {
3724
3711
  }
3725
3712
  }
3726
3713
  }
3727
- var liveArkadeInfo = async (wallet, opts = {}) => {
3714
+ var liveOperatorInfo = async (wallet, opts = {}) => {
3728
3715
  const requireLive = opts.requireLive ?? true;
3729
3716
  try {
3730
3717
  return await wallet.getArkadeInfo({ requireLive });
@@ -3736,7 +3723,7 @@ var liveArkadeInfo = async (wallet, opts = {}) => {
3736
3723
  }
3737
3724
  };
3738
3725
  var resolveCorridorBase = async (input) => {
3739
- const info = await liveArkadeInfo(input.wallet, { requireLive: input.requireLive });
3726
+ const info = await liveOperatorInfo(input.wallet, { requireLive: input.requireLive });
3740
3727
  const networkName = info.network;
3741
3728
  return {
3742
3729
  wallet: input.wallet,
@@ -6371,7 +6358,8 @@ async function pushClaim(operator, input) {
6371
6358
  ...lockupAssetOutputs(vtxos)
6372
6359
  ],
6373
6360
  serverUnrollScript,
6374
- verifyServerSignatures: { serverPubkey: input.contract.options.server }
6361
+ verifyServerSignatures: { serverPubkey: input.contract.options.server },
6362
+ oneShot: input.oneShot
6375
6363
  });
6376
6364
  return { txid, amount: locked, left: live.length - vtxos.length, spent: vtxos };
6377
6365
  }
@@ -6585,7 +6573,8 @@ function arkadeRefunder(deps) {
6585
6573
  contract,
6586
6574
  sender,
6587
6575
  vtxos,
6588
- network: await deps.network?.()
6576
+ network: await deps.network?.(),
6577
+ oneShot: deps.wallet.oneShotSubmit
6589
6578
  });
6590
6579
  if (result.left > 0 || done) {
6591
6580
  spentBy.set(swap.rfqId, /* @__PURE__ */ new Set([...done ?? [], ...result.spent.map(keyOf)]));
@@ -8312,7 +8301,8 @@ var createSwapDrive = (config) => {
8312
8301
  // Passed through: `pushClaim`'s own value check decides whether `P` is published.
8313
8302
  expectedAmount: swap.expectedAmount,
8314
8303
  partiallyClaimed,
8315
- network: await pinnedNetwork()
8304
+ network: await pinnedNetwork(),
8305
+ oneShot: wallet.oneShotSubmit
8316
8306
  })
8317
8307
  );
8318
8308
  };
@@ -9673,7 +9663,7 @@ var lockupOf = (derived) => ({
9673
9663
  pkScript: derived.swapPkScript
9674
9664
  });
9675
9665
  var covenantInputs = (input) => {
9676
- const network = (0, import_sdk35.networkFromArkadeInfo)(input.info);
9666
+ const network = (0, import_sdk35.networkFromOperatorInfo)(input.info);
9677
9667
  const arkade3 = input.corridors.get("arkade").deps;
9678
9668
  return {
9679
9669
  operatorPubkey: (0, import_sdk35.toXOnly)(import_base21.hex.decode(input.info.signerPubkey), "ark signer key"),
@@ -9743,7 +9733,7 @@ var quoteArkadeAsset = async (input) => {
9743
9733
  const receivePkScript = resolveReceivePkScript(
9744
9734
  receiveAddress,
9745
9735
  maker.pkScript,
9746
- (0, import_sdk35.networkFromArkadeInfo)(input.info).hrp,
9736
+ (0, import_sdk35.networkFromOperatorInfo)(input.info).hrp,
9747
9737
  (0, import_sdk35.toXOnly)(import_base21.hex.decode(input.info.signerPubkey), "ark signer key")
9748
9738
  );
9749
9739
  const choice = payment?.carrier;
@@ -9811,7 +9801,7 @@ var quoteArkadeAsset = async (input) => {
9811
9801
  receiveAddress: receiveAddress ?? new import_sdk35.ArkAddress(
9812
9802
  (0, import_sdk35.toXOnly)(import_base21.hex.decode(input.info.signerPubkey), "ark signer key"),
9813
9803
  maker.pkScript.slice(2),
9814
- (0, import_sdk35.networkFromArkadeInfo)(input.info).hrp
9804
+ (0, import_sdk35.networkFromOperatorInfo)(input.info).hrp
9815
9805
  ).encode(),
9816
9806
  validUntil,
9817
9807
  ...carrier === void 0 ? {} : { carrier },
@@ -10525,7 +10515,7 @@ var createSwapClient = (config) => {
10525
10515
  remember(quoteId, preparation);
10526
10516
  return quote;
10527
10517
  }
10528
- const info = await liveArkadeInfo(wallet, { requireLive: true });
10518
+ const info = await liveOperatorInfo(wallet, { requireLive: true });
10529
10519
  const rendezvous = market.card.discovery_pubkey;
10530
10520
  if (rendezvous === void 0) {
10531
10521
  throw new Error(`card ${market.card.solver} names no discovery key to address`);
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bc as pay, bg as receive, bn as unsignedPsbtBytes, bp as verifyJointGraph, bq as verifyOfferFillPlan } from './offerFillPlan-B-5ae_gQ.cjs';
2
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-C4pvymhs.cjs';
3
- export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-C4pvymhs.cjs';
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, T as TxStatus, i as isRfqRefusalErrorCode } from './rfq-C0tHOvn6.cjs';
1
+ export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bd as pay, bh as receive, bo as unsignedPsbtBytes, bq as verifyJointGraph, br as verifyOfferFillPlan } from './offerFillPlan-CvKlB246.cjs';
2
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-Cut4eEkm.cjs';
3
+ export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-Cut4eEkm.cjs';
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, T as TxStatus, i as isRfqRefusalErrorCode } from './rfq-CP-P0PSL.cjs';
5
5
  import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
- 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-CkhWMKCo.cjs';
6
+ 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-QfbsjyXG.cjs';
7
7
  import '@arkade-os/solver-discovery';
8
- import './offer-Diff5Flc.cjs';
8
+ import './offer-BxzPQ6zh.cjs';
9
9
  import 'nostr-tools';
10
10
 
11
11
  /** Browser backend over the SDK's shared IndexedDB manager. */
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bc as pay, bg as receive, bn as unsignedPsbtBytes, bp as verifyJointGraph, bq as verifyOfferFillPlan } from './offerFillPlan-CJzneX6F.js';
2
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-BBVRh9ez.js';
3
- export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-BBVRh9ez.js';
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, T as TxStatus, i as isRfqRefusalErrorCode } from './rfq-C0tHOvn6.js';
1
+ export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bd as pay, bh as receive, bo as unsignedPsbtBytes, bq as verifyJointGraph, br as verifyOfferFillPlan } from './offerFillPlan-_PhFt4B1.js';
2
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-BOQ1qYoj.js';
3
+ export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-BOQ1qYoj.js';
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, T as TxStatus, i as isRfqRefusalErrorCode } from './rfq-CP-P0PSL.js';
5
5
  import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
- 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-CIXkJPxV.js';
6
+ 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-CdXh9yIr.js';
7
7
  import '@arkade-os/solver-discovery';
8
- import './offer-BPD2ortO.js';
8
+ import './offer-Q1lVhrVX.js';
9
9
  import 'nostr-tools';
10
10
 
11
11
  /** Browser backend over the SDK's shared IndexedDB manager. */
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  unsignedPsbtBytes,
63
63
  verifyJointGraph,
64
64
  verifyOfferFillPlan
65
- } from "./chunk-J2PMAQP2.js";
65
+ } from "./chunk-HDCC3JZR.js";
66
66
  import {
67
67
  Amount,
68
68
  AmountFormatError,
@@ -73,7 +73,7 @@ import {
73
73
  isRfqSwapTerminal,
74
74
  quoteIdOfSwapId,
75
75
  toAtomicDecimal
76
- } from "./chunk-BLECLU5Q.js";
76
+ } from "./chunk-GJKGPE3S.js";
77
77
  import {
78
78
  CLAIM_PACKET_TYPE,
79
79
  LockupRegistrationFailed,
@@ -83,7 +83,7 @@ import {
83
83
  appendArkadeScript,
84
84
  claimPacketShape,
85
85
  isRfqRefusalErrorCode
86
- } from "./chunk-ICSREL7N.js";
86
+ } from "./chunk-7BBQ74BG.js";
87
87
  import {
88
88
  InMemoryAssetSwapRepository,
89
89
  assertRfqSwapPageFilter,
@@ -1,4 +1,4 @@
1
- import { C as CoverageRegistrationOptions } from './offer-BPD2ortO.js';
1
+ import { C as CoverageRegistrationOptions } from './offer-Q1lVhrVX.js';
2
2
  import { VHTLC, IContractManager } from '@arkade-os/sdk';
3
3
 
4
4
  interface SealedClaimPacket {
@@ -1,4 +1,4 @@
1
- import { C as CoverageRegistrationOptions } from './offer-Diff5Flc.cjs';
1
+ import { C as CoverageRegistrationOptions } from './offer-BxzPQ6zh.cjs';
2
2
  import { VHTLC, IContractManager } from '@arkade-os/sdk';
3
3
 
4
4
  interface SealedClaimPacket {
@@ -108,46 +108,46 @@ var SQLiteAssetSwapRepository = class {
108
108
  * while `initPromise` stayed resolved and every later statement failed with
109
109
  * `no such table`. */
110
110
  async init() {
111
- await this.withTx(async () => {
112
- await this.db.run(`CREATE TABLE IF NOT EXISTS ${this.swaps} (
111
+ await this.withTx(async (tx) => {
112
+ await tx.run(`CREATE TABLE IF NOT EXISTS ${this.swaps} (
113
113
  id TEXT PRIMARY KEY,
114
114
  status TEXT NOT NULL,
115
115
  created_at INTEGER NOT NULL,
116
116
  data TEXT NOT NULL
117
117
  )`);
118
- await this.db.run(
118
+ await tx.run(
119
119
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}asset_swaps_status ON ${this.swaps} (status)`
120
120
  );
121
- await this.db.run(
121
+ await tx.run(
122
122
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}asset_swaps_created_at ON ${this.swaps} (created_at)`
123
123
  );
124
- await this.db.run(`CREATE TABLE IF NOT EXISTS ${this.rfqSwaps} (
124
+ await tx.run(`CREATE TABLE IF NOT EXISTS ${this.rfqSwaps} (
125
125
  rfq_id TEXT PRIMARY KEY,
126
126
  state TEXT NOT NULL,
127
127
  updated_at INTEGER NOT NULL,
128
128
  data TEXT NOT NULL
129
129
  )`);
130
- await this.db.run(
130
+ await tx.run(
131
131
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_updated ON ${this.rfqSwaps} (updated_at, rfq_id)`
132
132
  );
133
- await this.db.run(
133
+ await tx.run(
134
134
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_swaps_history ON ${this.rfqSwaps} (state, updated_at, rfq_id)`
135
135
  );
136
- await this.db.run(`DROP INDEX IF EXISTS idx_${this.prefix}rfq_swaps_page`);
137
- await this.db.run(
136
+ await tx.run(`DROP INDEX IF EXISTS idx_${this.prefix}rfq_swaps_page`);
137
+ await tx.run(
138
138
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}rfq_swaps_state ON ${this.rfqSwaps} (state)`
139
139
  );
140
- await this.db.run(`CREATE TABLE IF NOT EXISTS ${this.swapRecords} (
140
+ await tx.run(`CREATE TABLE IF NOT EXISTS ${this.swapRecords} (
141
141
  id TEXT PRIMARY KEY,
142
142
  family TEXT NOT NULL,
143
143
  updated_at INTEGER NOT NULL,
144
144
  data TEXT NOT NULL
145
145
  )`);
146
- await this.db.run(
146
+ await tx.run(
147
147
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}swap_records_family ON ${this.swapRecords} (family)`
148
148
  );
149
- await this.db.run(`CREATE TABLE IF NOT EXISTS ${this.scanned} (txid TEXT PRIMARY KEY)`);
150
- await this.db.run(
149
+ await tx.run(`CREATE TABLE IF NOT EXISTS ${this.scanned} (txid TEXT PRIMARY KEY)`);
150
+ await tx.run(
151
151
  `CREATE TABLE IF NOT EXISTS ${this.markets} (cache_key TEXT PRIMARY KEY, data TEXT NOT NULL)`
152
152
  );
153
153
  });
@@ -155,7 +155,7 @@ var SQLiteAssetSwapRepository = class {
155
155
  /** Every write, including the single-statement ones. The chain serializes
156
156
  * transaction *blocks*, not bare statements: one issued between a
157
157
  * neighbour's BEGIN IMMEDIATE and its COMMIT becomes part of that
158
- * transaction and dies with it. `fn` must issue only raw db calls — no
158
+ * transaction and dies with it. `fn` must use its supplied raw executor — no
159
159
  * repository method, no `ensureInit` — since `runInTransaction` cannot
160
160
  * nest. */
161
161
  withTx(fn) {
@@ -163,8 +163,8 @@ var SQLiteAssetSwapRepository = class {
163
163
  }
164
164
  async saveSwap(swap) {
165
165
  await this.ensureInit();
166
- await this.withTx(async () => {
167
- await this.db.run(
166
+ await this.withTx(async (tx) => {
167
+ await tx.run(
168
168
  `INSERT OR REPLACE INTO ${this.swaps} (id, status, created_at, data)
169
169
  VALUES (?, ?, ?, ?)`,
170
170
  [swap.id, swap.status, swap.createdAt, JSON.stringify(swap)]
@@ -176,8 +176,8 @@ var SQLiteAssetSwapRepository = class {
176
176
  }
177
177
  async saveRfqSwap(record) {
178
178
  await this.ensureInit();
179
- await this.withTx(async () => {
180
- await this.db.run(
179
+ await this.withTx(async (tx) => {
180
+ await tx.run(
181
181
  `INSERT OR REPLACE INTO ${this.rfqSwaps} (rfq_id, state, updated_at, data)
182
182
  VALUES (?, ?, ?, ?)`,
183
183
  [record.rfqId, record.state, record.updatedAt, JSON.stringify(record)]
@@ -227,14 +227,14 @@ var SQLiteAssetSwapRepository = class {
227
227
  }
228
228
  async removeRfqSwap(rfqId) {
229
229
  await this.ensureInit();
230
- await this.withTx(async () => {
231
- await this.db.run(`DELETE FROM ${this.rfqSwaps} WHERE rfq_id = ?`, [rfqId]);
230
+ await this.withTx(async (tx) => {
231
+ await tx.run(`DELETE FROM ${this.rfqSwaps} WHERE rfq_id = ?`, [rfqId]);
232
232
  });
233
233
  }
234
234
  async saveSwapRecord(record) {
235
235
  await this.ensureInit();
236
- await this.withTx(async () => {
237
- await this.db.run(
236
+ await this.withTx(async (tx) => {
237
+ await tx.run(
238
238
  `INSERT OR REPLACE INTO ${this.swapRecords} (id, family, updated_at, data)
239
239
  VALUES (?, ?, ?, ?)`,
240
240
  [record.id, record.family, record.updatedAt, JSON.stringify(record)]
@@ -267,8 +267,8 @@ var SQLiteAssetSwapRepository = class {
267
267
  }
268
268
  async removeSwapRecord(id) {
269
269
  await this.ensureInit();
270
- await this.withTx(async () => {
271
- await this.db.run(`DELETE FROM ${this.swapRecords} WHERE id = ?`, [id]);
270
+ await this.withTx(async (tx) => {
271
+ await tx.run(`DELETE FROM ${this.swapRecords} WHERE id = ?`, [id]);
272
272
  });
273
273
  }
274
274
  async getScannedTxids() {
@@ -280,10 +280,10 @@ var SQLiteAssetSwapRepository = class {
280
280
  await this.ensureInit();
281
281
  const all = [...txids];
282
282
  if (all.length === 0) return;
283
- await this.withTx(async () => {
283
+ await this.withTx(async (tx) => {
284
284
  for (let i = 0; i < all.length; i += INSERT_CHUNK) {
285
285
  const chunk = all.slice(i, i + INSERT_CHUNK);
286
- await this.db.run(
286
+ await tx.run(
287
287
  `INSERT OR IGNORE INTO ${this.scanned} (txid) VALUES ${chunk.map(() => "(?)").join(", ")}`,
288
288
  chunk
289
289
  );
@@ -300,11 +300,11 @@ var SQLiteAssetSwapRepository = class {
300
300
  }
301
301
  async saveCachedMarkets(network, registry, entry) {
302
302
  await this.ensureInit();
303
- await this.withTx(async () => {
304
- await this.db.run(
305
- `INSERT OR REPLACE INTO ${this.markets} (cache_key, data) VALUES (?, ?)`,
306
- [marketsCacheKey(network, registry), JSON.stringify(entry)]
307
- );
303
+ await this.withTx(async (tx) => {
304
+ await tx.run(`INSERT OR REPLACE INTO ${this.markets} (cache_key, data) VALUES (?, ?)`, [
305
+ marketsCacheKey(network, registry),
306
+ JSON.stringify(entry)
307
+ ]);
308
308
  });
309
309
  }
310
310
  /** Every table in one transaction: clearing swaps but keeping scanned txids
@@ -312,12 +312,12 @@ var SQLiteAssetSwapRepository = class {
312
312
  * partial clear must not be observable. */
313
313
  async clear() {
314
314
  await this.ensureInit();
315
- await this.withTx(async () => {
316
- await this.db.run(`DELETE FROM ${this.swaps}`);
317
- await this.db.run(`DELETE FROM ${this.rfqSwaps}`);
318
- await this.db.run(`DELETE FROM ${this.swapRecords}`);
319
- await this.db.run(`DELETE FROM ${this.scanned}`);
320
- await this.db.run(`DELETE FROM ${this.markets}`);
315
+ await this.withTx(async (tx) => {
316
+ await tx.run(`DELETE FROM ${this.swaps}`);
317
+ await tx.run(`DELETE FROM ${this.rfqSwaps}`);
318
+ await tx.run(`DELETE FROM ${this.swapRecords}`);
319
+ await tx.run(`DELETE FROM ${this.scanned}`);
320
+ await tx.run(`DELETE FROM ${this.markets}`);
321
321
  });
322
322
  }
323
323
  async [Symbol.asyncDispose]() {