@arkade-os/swap 0.1.0-rc.32 → 0.1.0-rc.33

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 (35) hide show
  1. package/dist/advanced.cjs +53 -10
  2. package/dist/advanced.d.cts +13 -9
  3. package/dist/advanced.d.ts +13 -9
  4. package/dist/advanced.js +24 -6
  5. package/dist/{chunk-75YNMBFR.js → chunk-A5NAC2XU.js} +28 -8
  6. package/dist/{chunk-2CAOQFSK.js → chunk-B7RFWT3B.js} +3 -5
  7. package/dist/{chunk-JKTIGGFR.js → chunk-RYJHBEDN.js} +10 -3
  8. package/dist/index.cjs +32 -7
  9. package/dist/index.d.cts +6 -6
  10. package/dist/index.d.ts +6 -6
  11. package/dist/index.js +3 -3
  12. package/dist/{lockupContract-uj-o9rLJ.d.ts → lockupContract-BlUEw4Ry.d.ts} +6 -2
  13. package/dist/{lockupContract-CSIUio9d.d.cts → lockupContract-DGQkMEl3.d.cts} +6 -2
  14. package/dist/nostr.d.cts +1 -1
  15. package/dist/nostr.d.ts +1 -1
  16. package/dist/nostr.js +1 -1
  17. package/dist/{offer-DmfRrycC.d.cts → offer-DLruA4Bf.d.cts} +1 -1
  18. package/dist/{offer-C3nyUS9S.d.ts → offer-gSQxAA2I.d.ts} +1 -1
  19. package/dist/{offerFillPlan-BGO7-K8C.d.cts → offerFillPlan-BLBaR8B9.d.cts} +5 -4
  20. package/dist/{offerFillPlan-Y1M-7i7T.d.ts → offerFillPlan-CA9dMjDg.d.ts} +5 -4
  21. package/dist/protocol.cjs +35 -12
  22. package/dist/protocol.d.cts +8 -8
  23. package/dist/protocol.d.ts +8 -8
  24. package/dist/protocol.js +2 -2
  25. package/dist/repositories/realm/index.d.cts +2 -2
  26. package/dist/repositories/realm/index.d.ts +2 -2
  27. package/dist/repositories/sqlite/index.d.cts +2 -2
  28. package/dist/repositories/sqlite/index.d.ts +2 -2
  29. package/dist/{repository-CJx_AEvo.d.cts → repository-KjoxTB5l.d.ts} +1 -1
  30. package/dist/{repository-DgwOJVx0.d.ts → repository-UCY_eoQx.d.cts} +1 -1
  31. package/dist/{rfq-BJ8SC_Gp.d.cts → rfq-DS8_IMU9.d.cts} +8 -5
  32. package/dist/{rfq-BJ8SC_Gp.d.ts → rfq-DS8_IMU9.d.ts} +8 -5
  33. package/dist/{watch-DlkKUJou.d.ts → watch-fL2WVy3J.d.ts} +1 -1
  34. package/dist/{watch-BAyo3_bk.d.cts → watch-lFnfGaqA.d.cts} +1 -1
  35. package/package.json +2 -2
package/dist/advanced.cjs CHANGED
@@ -1576,6 +1576,15 @@ var init_onchainHtlc = __esm({
1576
1576
  }
1577
1577
  });
1578
1578
 
1579
+ // src/claimAmountGate.ts
1580
+ var bindsClaimAmount;
1581
+ var init_claimAmountGate = __esm({
1582
+ "src/claimAmountGate.ts"() {
1583
+ "use strict";
1584
+ bindsClaimAmount = () => false;
1585
+ }
1586
+ });
1587
+
1579
1588
  // src/claimPacket.ts
1580
1589
  async function sealClaimPacket(input) {
1581
1590
  return sealWithEntropy(
@@ -1589,23 +1598,31 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
1589
1598
  if (input.covclaimdPubkey.length !== 33) {
1590
1599
  throw new Error("covclaimd pubkey must be 33-byte compressed");
1591
1600
  }
1601
+ const { minAmount } = input;
1602
+ if (minAmount !== void 0 && (typeof minAmount !== "bigint" || minAmount < 1n || minAmount >= 1n << 64n)) {
1603
+ throw new Error("minAmount must be a bigint in [1, 2^64-1]");
1604
+ }
1592
1605
  const ephemeralPub = import_secp256k1.secp256k1.getPublicKey(ephemeralKey, true);
1593
1606
  const sharedX = import_secp256k1.secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
1594
1607
  const key = (0, import_hkdf.hkdf)(import_sha23.sha256, sharedX, ephemeralPub, HKDF_INFO, 32);
1595
1608
  if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
1596
- const sealed = (0, import_aes.gcm)(key, nonce, ephemeralPub).encrypt(input.preimage);
1609
+ const amount = new Uint8Array(8);
1610
+ if (minAmount !== void 0) new DataView(amount.buffer).setBigUint64(0, minAmount, false);
1611
+ const additionalData = minAmount === void 0 ? ephemeralPub : (0, import_utils2.concatBytes)(ephemeralPub, amount);
1612
+ const sealed = (0, import_aes.gcm)(key, nonce, additionalData).encrypt(input.preimage);
1597
1613
  const ciphertext = (0, import_utils2.concatBytes)(ephemeralPub, nonce, sealed);
1598
1614
  return {
1599
1615
  ciphertext: import_base6.base64.encode(ciphertext),
1600
1616
  packet: import_base6.base64.encode(
1601
1617
  (0, import_utils2.concatBytes)(
1602
1618
  tlv2(TLV_CIPHERTEXT, ciphertext),
1603
- tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey)
1619
+ tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey),
1620
+ minAmount === void 0 ? new Uint8Array() : tlv2(TLV_MIN_AMOUNT, amount)
1604
1621
  )
1605
1622
  )
1606
1623
  };
1607
1624
  }
1608
- var import_base6, import_utils2, import_aes, import_secp256k1, import_hkdf, import_sha23, HKDF_INFO, TLV_CIPHERTEXT, TLV_COVCLAIMD_PUBKEY, tlv2;
1625
+ var import_base6, import_utils2, import_aes, import_secp256k1, import_hkdf, import_sha23, HKDF_INFO, TLV_CIPHERTEXT, TLV_COVCLAIMD_PUBKEY, TLV_MIN_AMOUNT, tlv2;
1609
1626
  var init_claimPacket = __esm({
1610
1627
  "src/claimPacket.ts"() {
1611
1628
  "use strict";
@@ -1618,6 +1635,7 @@ var init_claimPacket = __esm({
1618
1635
  HKDF_INFO = new TextEncoder().encode("covclaimd/preimage/v1");
1619
1636
  TLV_CIPHERTEXT = 1;
1620
1637
  TLV_COVCLAIMD_PUBKEY = 3;
1638
+ TLV_MIN_AMOUNT = 4;
1621
1639
  tlv2 = (type, value) => Uint8Array.from([type, value.length >> 8 & 255, value.length & 255, ...value]);
1622
1640
  }
1623
1641
  });
@@ -1811,6 +1829,7 @@ var init_rfq = __esm({
1811
1829
  init_onchainHtlc();
1812
1830
  init_onchainHtlc();
1813
1831
  import_sdk8 = require("@arkade-os/sdk");
1832
+ init_claimAmountGate();
1814
1833
  init_claimPacket();
1815
1834
  init_lockupContract();
1816
1835
  init_offer();
@@ -4869,9 +4888,8 @@ var operatorUnrollScript = async (operator, network) => {
4869
4888
  const info = await operator.getInfo();
4870
4889
  return (0, import_sdk14.assertValidServerUnrollScript)(
4871
4890
  info.checkpointTapscript,
4872
- (0, import_sdk14.resolveCheckpointExitDelayPolicy)(network ?? (0, import_sdk14.networkFromArkadeInfo)(info), {
4873
- advertisedForfeitPubkey: (0, import_sdk14.toXOnly)(import_base10.hex.decode(info.forfeitPubkey), "forfeit key")
4874
- })
4891
+ network ?? (0, import_sdk14.networkFromArkadeInfo)(info),
4892
+ (0, import_sdk14.toXOnly)(import_base10.hex.decode(info.forfeitPubkey), "forfeit key")
4875
4893
  );
4876
4894
  };
4877
4895
  var MAX_LOCKUP_SPEND_INPUTS = 16;
@@ -9141,6 +9159,7 @@ function unsignedPsbtBytes(tx) {
9141
9159
  }
9142
9160
 
9143
9161
  // src/client/quoteRfq.ts
9162
+ init_claimAmountGate();
9144
9163
  init_claimPacket();
9145
9164
  init_offer();
9146
9165
  init_store();
@@ -9523,7 +9542,13 @@ var quoteLightningReceive = async (input) => {
9523
9542
  const payoutAddress = await input.wallet.getAddress();
9524
9543
  const lightning = input.corridors.get("lightning").deps;
9525
9544
  const sealTo = sealingKey(lightning);
9526
- const claimPacket = sealTo ? await sealClaimPacket({ preimage: secrets.preimage, covclaimdPubkey: sealTo }) : void 0;
9545
+ const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
9546
+ const binds = bindsClaimAmount();
9547
+ const claimPacket = sealTo !== void 0 && (!binds || sealsAmount) ? await sealClaimPacket({
9548
+ preimage: secrets.preimage,
9549
+ covclaimdPubkey: sealTo,
9550
+ minAmount: binds ? pinned.value : void 0
9551
+ }) : void 0;
9527
9552
  const wire = await input.transport.requestQuote(
9528
9553
  withCanonicalAmount(
9529
9554
  lightningReceiveRequest({
@@ -10196,6 +10221,7 @@ var createSwapClient = (config) => {
10196
10221
  // src/reveal.ts
10197
10222
  var import_base23 = require("@scure/base");
10198
10223
  var import_sdk37 = require("@arkade-os/sdk");
10224
+ init_claimAmountGate();
10199
10225
  init_claimPacket();
10200
10226
  init_onchainHtlc();
10201
10227
  var CovclaimdRevealError = class extends Error {
@@ -10210,6 +10236,13 @@ var CovclaimdRevealError = class extends Error {
10210
10236
  this.retryable = status === 0 || status === 429 || status >= 500;
10211
10237
  }
10212
10238
  };
10239
+ var assertRevealAmount = (minAmount) => {
10240
+ if (typeof minAmount !== "bigint" || minAmount < 1n || minAmount > BigInt(Number.MAX_SAFE_INTEGER)) {
10241
+ throw new Error(
10242
+ `min_amount ${minAmount} is missing, not positive, or past what a JSON number carries`
10243
+ );
10244
+ }
10245
+ };
10213
10246
  var decodeKey = (value, field) => {
10214
10247
  if (typeof value !== "string") throw new Error(`covclaimd info: ${field} is not a string`);
10215
10248
  let bytes;
@@ -10279,12 +10312,19 @@ var covclaimdClient = (baseUrl, options = {}) => {
10279
10312
  };
10280
10313
  },
10281
10314
  async reveal(params) {
10315
+ const { minAmount } = params;
10316
+ if (minAmount !== void 0) assertRevealAmount(minAmount);
10282
10317
  await send("reveal", "/v1/reveal", {
10283
10318
  method: "POST",
10284
10319
  headers: { "content-type": "application/json" },
10285
10320
  body: JSON.stringify({
10286
10321
  swap_address: params.swapAddress,
10287
- packet: { ciphertext: params.ciphertext, arkade_script: params.arkadeScript },
10322
+ packet: {
10323
+ ciphertext: params.ciphertext,
10324
+ arkade_script: params.arkadeScript,
10325
+ // covclaimd reads an absent field as unbound
10326
+ min_amount: minAmount === void 0 ? void 0 : Number(minAmount)
10327
+ },
10288
10328
  taptree: params.taptree
10289
10329
  })
10290
10330
  });
@@ -10306,11 +10346,14 @@ async function revealClaimPacket(client, input) {
10306
10346
  throw new Error("address does not belong to this covenant");
10307
10347
  }
10308
10348
  assertPreimageMatches(input.preimage, input.script.options.preimageHash);
10349
+ assertRevealAmount(input.minAmount);
10350
+ const minAmount = bindsClaimAmount() ? input.minAmount : void 0;
10309
10351
  const { ciphertext } = await sealClaimPacket({
10310
10352
  preimage: input.preimage,
10311
- covclaimdPubkey: (await client.info()).covclaimdPubkey
10353
+ covclaimdPubkey: (await client.info()).covclaimdPubkey,
10354
+ minAmount
10312
10355
  });
10313
- await client.reveal({ swapAddress: input.address, ciphertext, ...fields });
10356
+ await client.reveal({ swapAddress: input.address, ciphertext, minAmount, ...fields });
10314
10357
  return { ciphertext };
10315
10358
  }
10316
10359
 
@@ -1,14 +1,14 @@
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 './offerFillPlan-BGO7-K8C.cjs';
2
- export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-BGO7-K8C.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 './offerFillPlan-BLBaR8B9.cjs';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-BLBaR8B9.cjs';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
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-CJx_AEvo.cjs';
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 ArkadeCarrierChoice, u as Artifact, 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, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-CJx_AEvo.cjs';
6
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-BJ8SC_Gp.cjs';
7
- export { S as SwapRefusal } from './rfq-BJ8SC_Gp.cjs';
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-UCY_eoQx.cjs';
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 ArkadeCarrierChoice, u as Artifact, 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, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-UCY_eoQx.cjs';
6
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-DS8_IMU9.cjs';
7
+ export { S as SwapRefusal } from './rfq-DS8_IMU9.cjs';
8
8
  import * as btc from '@scure/btc-signer';
9
9
  import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
10
- import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-BAyo3_bk.cjs';
11
- import './offer-DmfRrycC.cjs';
10
+ import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-lFnfGaqA.cjs';
11
+ import './offer-DLruA4Bf.cjs';
12
12
  import 'nostr-tools';
13
13
 
14
14
  /** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
@@ -641,7 +641,7 @@ interface CovclaimdInfo {
641
641
  /** Compressed hex — feeds `requestLightningReceive`'s `emulatorPubkey`. */
642
642
  emulatorPubkey: string;
643
643
  }
644
- /** The four fields `POST /v1/reveal` takes. */
644
+ /** The fields `POST /v1/reveal` takes. */
645
645
  interface RevealParams {
646
646
  /** The funded lockup's Arkade address, bech32m. */
647
647
  swapAddress: string;
@@ -649,6 +649,8 @@ interface RevealParams {
649
649
  ciphertext: string;
650
650
  /** The covenant's `enforcePayTo` ArkadeScript, base64. */
651
651
  arkadeScript: string;
652
+ /** The `minAmount` {@link ciphertext} was sealed with, in sats; omit for an unbound one. */
653
+ minAmount?: bigint;
652
654
  /** The lockup's serialized taptree, hex. */
653
655
  taptree: string;
654
656
  }
@@ -689,6 +691,8 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
689
691
  address: string;
690
692
  /** `P`, 32 bytes, from the swap's `secrets`. */
691
693
  preimage: Uint8Array;
694
+ /** Sats the lockup must carry, e.g. the record's `expectedAmount`. */
695
+ minAmount: bigint;
692
696
  }): Promise<{
693
697
  ciphertext: string;
694
698
  }>;
@@ -1,14 +1,14 @@
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 './offerFillPlan-Y1M-7i7T.js';
2
- export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-Y1M-7i7T.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 './offerFillPlan-CA9dMjDg.js';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-CA9dMjDg.js';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
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-DgwOJVx0.js';
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 ArkadeCarrierChoice, u as Artifact, 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, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-DgwOJVx0.js';
6
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-BJ8SC_Gp.js';
7
- export { S as SwapRefusal } from './rfq-BJ8SC_Gp.js';
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-KjoxTB5l.js';
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 ArkadeCarrierChoice, u as Artifact, 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, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-KjoxTB5l.js';
6
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-DS8_IMU9.js';
7
+ export { S as SwapRefusal } from './rfq-DS8_IMU9.js';
8
8
  import * as btc from '@scure/btc-signer';
9
9
  import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
10
- import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-DlkKUJou.js';
11
- import './offer-C3nyUS9S.js';
10
+ import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-fL2WVy3J.js';
11
+ import './offer-gSQxAA2I.js';
12
12
  import 'nostr-tools';
13
13
 
14
14
  /** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
@@ -641,7 +641,7 @@ interface CovclaimdInfo {
641
641
  /** Compressed hex — feeds `requestLightningReceive`'s `emulatorPubkey`. */
642
642
  emulatorPubkey: string;
643
643
  }
644
- /** The four fields `POST /v1/reveal` takes. */
644
+ /** The fields `POST /v1/reveal` takes. */
645
645
  interface RevealParams {
646
646
  /** The funded lockup's Arkade address, bech32m. */
647
647
  swapAddress: string;
@@ -649,6 +649,8 @@ interface RevealParams {
649
649
  ciphertext: string;
650
650
  /** The covenant's `enforcePayTo` ArkadeScript, base64. */
651
651
  arkadeScript: string;
652
+ /** The `minAmount` {@link ciphertext} was sealed with, in sats; omit for an unbound one. */
653
+ minAmount?: bigint;
652
654
  /** The lockup's serialized taptree, hex. */
653
655
  taptree: string;
654
656
  }
@@ -689,6 +691,8 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
689
691
  address: string;
690
692
  /** `P`, 32 bytes, from the swap's `secrets`. */
691
693
  preimage: Uint8Array;
694
+ /** Sats the lockup must carry, e.g. the record's `expectedAmount`. */
695
+ minAmount: bigint;
692
696
  }): Promise<{
693
697
  ciphertext: string;
694
698
  }>;
package/dist/advanced.js CHANGED
@@ -136,7 +136,7 @@ import {
136
136
  withCanonicalAmount,
137
137
  withDepositFate,
138
138
  withRfqState
139
- } from "./chunk-JKTIGGFR.js";
139
+ } from "./chunk-RYJHBEDN.js";
140
140
  import {
141
141
  ACTIVITY_TOKEN,
142
142
  Amount,
@@ -171,15 +171,16 @@ import {
171
171
  recordOutcome,
172
172
  swapOf,
173
173
  toAtomicDecimal
174
- } from "./chunk-2CAOQFSK.js";
174
+ } from "./chunk-B7RFWT3B.js";
175
175
  import {
176
176
  ARKADE_BTC,
177
177
  SwapRefusal,
178
178
  assertPairLength,
179
179
  assertPreimageMatches,
180
+ bindsClaimAmount,
180
181
  rfqPair,
181
182
  sealClaimPacket
182
- } from "./chunk-75YNMBFR.js";
183
+ } from "./chunk-A5NAC2XU.js";
183
184
  import "./chunk-A3SHHRX4.js";
184
185
 
185
186
  // src/reveal.ts
@@ -197,6 +198,13 @@ var CovclaimdRevealError = class extends Error {
197
198
  this.retryable = status === 0 || status === 429 || status >= 500;
198
199
  }
199
200
  };
201
+ var assertRevealAmount = (minAmount) => {
202
+ if (typeof minAmount !== "bigint" || minAmount < 1n || minAmount > BigInt(Number.MAX_SAFE_INTEGER)) {
203
+ throw new Error(
204
+ `min_amount ${minAmount} is missing, not positive, or past what a JSON number carries`
205
+ );
206
+ }
207
+ };
200
208
  var decodeKey = (value, field) => {
201
209
  if (typeof value !== "string") throw new Error(`covclaimd info: ${field} is not a string`);
202
210
  let bytes;
@@ -266,12 +274,19 @@ var covclaimdClient = (baseUrl, options = {}) => {
266
274
  };
267
275
  },
268
276
  async reveal(params) {
277
+ const { minAmount } = params;
278
+ if (minAmount !== void 0) assertRevealAmount(minAmount);
269
279
  await send("reveal", "/v1/reveal", {
270
280
  method: "POST",
271
281
  headers: { "content-type": "application/json" },
272
282
  body: JSON.stringify({
273
283
  swap_address: params.swapAddress,
274
- packet: { ciphertext: params.ciphertext, arkade_script: params.arkadeScript },
284
+ packet: {
285
+ ciphertext: params.ciphertext,
286
+ arkade_script: params.arkadeScript,
287
+ // covclaimd reads an absent field as unbound
288
+ min_amount: minAmount === void 0 ? void 0 : Number(minAmount)
289
+ },
275
290
  taptree: params.taptree
276
291
  })
277
292
  });
@@ -293,11 +308,14 @@ async function revealClaimPacket(client, input) {
293
308
  throw new Error("address does not belong to this covenant");
294
309
  }
295
310
  assertPreimageMatches(input.preimage, input.script.options.preimageHash);
311
+ assertRevealAmount(input.minAmount);
312
+ const minAmount = bindsClaimAmount() ? input.minAmount : void 0;
296
313
  const { ciphertext } = await sealClaimPacket({
297
314
  preimage: input.preimage,
298
- covclaimdPubkey: (await client.info()).covclaimdPubkey
315
+ covclaimdPubkey: (await client.info()).covclaimdPubkey,
316
+ minAmount
299
317
  });
300
- await client.reveal({ swapAddress: input.address, ciphertext, ...fields });
318
+ await client.reveal({ swapAddress: input.address, ciphertext, minAmount, ...fields });
301
319
  return { ciphertext };
302
320
  }
303
321
 
@@ -1592,18 +1592,26 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
1592
1592
  if (input.covclaimdPubkey.length !== 33) {
1593
1593
  throw new Error("covclaimd pubkey must be 33-byte compressed");
1594
1594
  }
1595
+ const { minAmount } = input;
1596
+ if (minAmount !== void 0 && (typeof minAmount !== "bigint" || minAmount < 1n || minAmount >= 1n << 64n)) {
1597
+ throw new Error("minAmount must be a bigint in [1, 2^64-1]");
1598
+ }
1595
1599
  const ephemeralPub = secp256k1.getPublicKey(ephemeralKey, true);
1596
1600
  const sharedX = secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
1597
1601
  const key = hkdf(sha2563, sharedX, ephemeralPub, HKDF_INFO, 32);
1598
1602
  if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
1599
- const sealed = gcm(key, nonce, ephemeralPub).encrypt(input.preimage);
1603
+ const amount = new Uint8Array(8);
1604
+ if (minAmount !== void 0) new DataView(amount.buffer).setBigUint64(0, minAmount, false);
1605
+ const additionalData = minAmount === void 0 ? ephemeralPub : concatBytes2(ephemeralPub, amount);
1606
+ const sealed = gcm(key, nonce, additionalData).encrypt(input.preimage);
1600
1607
  const ciphertext = concatBytes2(ephemeralPub, nonce, sealed);
1601
1608
  return {
1602
1609
  ciphertext: base64.encode(ciphertext),
1603
1610
  packet: base64.encode(
1604
1611
  concatBytes2(
1605
1612
  tlv2(TLV_CIPHERTEXT, ciphertext),
1606
- tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey)
1613
+ tlv2(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey),
1614
+ minAmount === void 0 ? new Uint8Array() : tlv2(TLV_MIN_AMOUNT, amount)
1607
1615
  )
1608
1616
  )
1609
1617
  };
@@ -1611,6 +1619,7 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
1611
1619
  var TLV_CIPHERTEXT = 1;
1612
1620
  var TLV_ARKADE_SCRIPT = 2;
1613
1621
  var TLV_COVCLAIMD_PUBKEY = 3;
1622
+ var TLV_MIN_AMOUNT = 4;
1614
1623
  var COMPRESSED_PUBKEY_LENGTH = 33;
1615
1624
  var SEALED_CIPHERTEXT_LENGTH = 93;
1616
1625
  var CLAIM_PACKET_TYPE = 4;
@@ -1679,6 +1688,11 @@ import {
1679
1688
  provisionClaimSecret,
1680
1689
  provisionRefundKey
1681
1690
  } from "@arkade-os/sdk";
1691
+
1692
+ // src/claimAmountGate.ts
1693
+ var bindsClaimAmount = () => false;
1694
+
1695
+ // src/rfq.ts
1682
1696
  var solverHex = (value, field) => {
1683
1697
  try {
1684
1698
  return hex5.decode(value);
@@ -2720,7 +2734,7 @@ function deriveLightningReceive(input) {
2720
2734
  }
2721
2735
  };
2722
2736
  }
2723
- var provisionReceive = async (wallet, covclaimdPubkey, persistBefore) => {
2737
+ var provisionReceive = async (wallet, params, persistBefore) => {
2724
2738
  const secrets = await provisionClaimSecret(wallet);
2725
2739
  if (secrets.mustPersistPreimage) {
2726
2740
  console.warn(
@@ -2734,12 +2748,17 @@ var provisionReceive = async (wallet, covclaimdPubkey, persistBefore) => {
2734
2748
  wallet.getArkadeInfo({ requireLive: true }),
2735
2749
  wallet.getAddress()
2736
2750
  ]);
2737
- const claimPacket = covclaimdPubkey ? await sealClaimPacket({ preimage, covclaimdPubkey }) : void 0;
2751
+ const binds = bindsClaimAmount();
2752
+ const claimPacket = params.covclaimdPubkey && (!binds || params.amountSide === "to") ? await sealClaimPacket({
2753
+ preimage,
2754
+ covclaimdPubkey: params.covclaimdPubkey,
2755
+ minAmount: binds ? BigInt(params.amount) : void 0
2756
+ }) : void 0;
2738
2757
  return { secrets, paymentHash, payoutPubkey, info, payoutAddress, claimPacket };
2739
2758
  };
2740
- var quoteReceive = async (wallet, transport, covclaimdPubkey, persistBefore, request) => {
2759
+ var quoteReceive = async (wallet, transport, params, persistBefore, request) => {
2741
2760
  for (let attempt = 0; ; attempt++) {
2742
- const provisioned = await provisionReceive(wallet, covclaimdPubkey, persistBefore);
2761
+ const provisioned = await provisionReceive(wallet, params, persistBefore);
2743
2762
  try {
2744
2763
  return { ...provisioned, quote: await transport.requestQuote(request(provisioned)) };
2745
2764
  } catch (error) {
@@ -2753,7 +2772,7 @@ async function requestLightningReceive(wallet, transport, params) {
2753
2772
  const { secrets, paymentHash, payoutPubkey, info, payoutAddress, quote } = await quoteReceive(
2754
2773
  wallet,
2755
2774
  transport,
2756
- params.covclaimdPubkey,
2775
+ params,
2757
2776
  "paying",
2758
2777
  ({ paymentHash: paymentHash2, payoutAddress: payoutAddress2, payoutPubkey: payoutPubkey2, claimPacket }) => lightningReceiveRequest({
2759
2778
  rfqId,
@@ -2844,7 +2863,7 @@ async function requestOnchainReceive(wallet, transport, params) {
2844
2863
  const { secrets, paymentHash, payoutPubkey, info, payoutAddress, quote } = await quoteReceive(
2845
2864
  wallet,
2846
2865
  transport,
2847
- params.covclaimdPubkey,
2866
+ params,
2848
2867
  "funding",
2849
2868
  ({ paymentHash: paymentHash2, payoutAddress: payoutAddress2, payoutPubkey: payoutPubkey2, claimPacket }) => onchainReceiveRequest({
2850
2869
  rfqId,
@@ -2968,6 +2987,7 @@ export {
2968
2987
  awaitOnchainFill,
2969
2988
  claimOnchainFill,
2970
2989
  classifyOnchainHtlc,
2990
+ bindsClaimAmount,
2971
2991
  sealClaimPacket,
2972
2992
  SEALED_CIPHERTEXT_LENGTH,
2973
2993
  CLAIM_PACKET_TYPE,
@@ -24,7 +24,7 @@ import {
24
24
  rfqCorridorHandlers,
25
25
  rfqSignerOf,
26
26
  updateAssetSwapBestEffort
27
- } from "./chunk-75YNMBFR.js";
27
+ } from "./chunk-A5NAC2XU.js";
28
28
  import {
29
29
  collectRfqSwaps
30
30
  } from "./chunk-A3SHHRX4.js";
@@ -933,7 +933,6 @@ import {
933
933
  isVtxoSpent,
934
934
  matchServerCheckpoints,
935
935
  networkFromArkadeInfo,
936
- resolveCheckpointExitDelayPolicy,
937
936
  scriptFromTapLeafScript,
938
937
  toXOnly
939
938
  } from "@arkade-os/sdk";
@@ -1085,9 +1084,8 @@ var operatorUnrollScript = async (operator, network) => {
1085
1084
  const info = await operator.getInfo();
1086
1085
  return assertValidServerUnrollScript(
1087
1086
  info.checkpointTapscript,
1088
- resolveCheckpointExitDelayPolicy(network ?? networkFromArkadeInfo(info), {
1089
- advertisedForfeitPubkey: toXOnly(hex2.decode(info.forfeitPubkey), "forfeit key")
1090
- })
1087
+ network ?? networkFromArkadeInfo(info),
1088
+ toXOnly(hex2.decode(info.forfeitPubkey), "forfeit key")
1091
1089
  );
1092
1090
  };
1093
1091
  var MAX_LOCKUP_SPEND_INPUTS = 16;
@@ -58,7 +58,7 @@ import {
58
58
  undeliveredCarry,
59
59
  walletOperator,
60
60
  watchOfferSwaps
61
- } from "./chunk-2CAOQFSK.js";
61
+ } from "./chunk-B7RFWT3B.js";
62
62
  import {
63
63
  ARKADE_BTC,
64
64
  ASSET_CARRIER_SATS,
@@ -80,6 +80,7 @@ import {
80
80
  assertFundable,
81
81
  assertPairLength,
82
82
  assertReceivable,
83
+ bindsClaimAmount,
83
84
  buildHtlcRefund,
84
85
  claimOnchainFill,
85
86
  connectFillContract,
@@ -119,7 +120,7 @@ import {
119
120
  sealClaimPacket,
120
121
  unilateralClaimDelay,
121
122
  verifyOfferAddress
122
- } from "./chunk-75YNMBFR.js";
123
+ } from "./chunk-A5NAC2XU.js";
123
124
  import {
124
125
  assertRfqSwapPageFilter,
125
126
  collectAssetSwaps,
@@ -3841,7 +3842,13 @@ var quoteLightningReceive = async (input) => {
3841
3842
  const payoutAddress = await input.wallet.getAddress();
3842
3843
  const lightning = input.corridors.get("lightning").deps;
3843
3844
  const sealTo = sealingKey(lightning);
3844
- const claimPacket = sealTo ? await sealClaimPacket({ preimage: secrets.preimage, covclaimdPubkey: sealTo }) : void 0;
3845
+ const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
3846
+ const binds = bindsClaimAmount();
3847
+ const claimPacket = sealTo !== void 0 && (!binds || sealsAmount) ? await sealClaimPacket({
3848
+ preimage: secrets.preimage,
3849
+ covclaimdPubkey: sealTo,
3850
+ minAmount: binds ? pinned.value : void 0
3851
+ }) : void 0;
3845
3852
  const wire = await input.transport.requestQuote(
3846
3853
  withCanonicalAmount(
3847
3854
  lightningReceiveRequest({
package/dist/index.cjs CHANGED
@@ -364,6 +364,15 @@ var init_onchainHtlc = __esm({
364
364
  }
365
365
  });
366
366
 
367
+ // src/claimAmountGate.ts
368
+ var bindsClaimAmount;
369
+ var init_claimAmountGate = __esm({
370
+ "src/claimAmountGate.ts"() {
371
+ "use strict";
372
+ bindsClaimAmount = () => false;
373
+ }
374
+ });
375
+
367
376
  // src/claimPacket.ts
368
377
  async function sealClaimPacket(input) {
369
378
  return sealWithEntropy(
@@ -377,23 +386,31 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
377
386
  if (input.covclaimdPubkey.length !== 33) {
378
387
  throw new Error("covclaimd pubkey must be 33-byte compressed");
379
388
  }
389
+ const { minAmount } = input;
390
+ if (minAmount !== void 0 && (typeof minAmount !== "bigint" || minAmount < 1n || minAmount >= 1n << 64n)) {
391
+ throw new Error("minAmount must be a bigint in [1, 2^64-1]");
392
+ }
380
393
  const ephemeralPub = import_secp256k1.secp256k1.getPublicKey(ephemeralKey, true);
381
394
  const sharedX = import_secp256k1.secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
382
395
  const key = (0, import_hkdf.hkdf)(import_sha22.sha256, sharedX, ephemeralPub, HKDF_INFO, 32);
383
396
  if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
384
- const sealed = (0, import_aes.gcm)(key, nonce, ephemeralPub).encrypt(input.preimage);
397
+ const amount = new Uint8Array(8);
398
+ if (minAmount !== void 0) new DataView(amount.buffer).setBigUint64(0, minAmount, false);
399
+ const additionalData = minAmount === void 0 ? ephemeralPub : (0, import_utils.concatBytes)(ephemeralPub, amount);
400
+ const sealed = (0, import_aes.gcm)(key, nonce, additionalData).encrypt(input.preimage);
385
401
  const ciphertext = (0, import_utils.concatBytes)(ephemeralPub, nonce, sealed);
386
402
  return {
387
403
  ciphertext: import_base2.base64.encode(ciphertext),
388
404
  packet: import_base2.base64.encode(
389
405
  (0, import_utils.concatBytes)(
390
406
  tlv(TLV_CIPHERTEXT, ciphertext),
391
- tlv(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey)
407
+ tlv(TLV_COVCLAIMD_PUBKEY, input.covclaimdPubkey),
408
+ minAmount === void 0 ? new Uint8Array() : tlv(TLV_MIN_AMOUNT, amount)
392
409
  )
393
410
  )
394
411
  };
395
412
  }
396
- var import_base2, import_utils, import_aes, import_secp256k1, import_hkdf, import_sha22, HKDF_INFO, TLV_CIPHERTEXT, TLV_ARKADE_SCRIPT, TLV_COVCLAIMD_PUBKEY, COMPRESSED_PUBKEY_LENGTH, SEALED_CIPHERTEXT_LENGTH, CLAIM_PACKET_TYPE, tlv, appendArkadeScript, parseTlv, claimPacketShape;
413
+ var import_base2, import_utils, import_aes, import_secp256k1, import_hkdf, import_sha22, HKDF_INFO, TLV_CIPHERTEXT, TLV_ARKADE_SCRIPT, TLV_COVCLAIMD_PUBKEY, TLV_MIN_AMOUNT, COMPRESSED_PUBKEY_LENGTH, SEALED_CIPHERTEXT_LENGTH, CLAIM_PACKET_TYPE, tlv, appendArkadeScript, parseTlv, claimPacketShape;
397
414
  var init_claimPacket = __esm({
398
415
  "src/claimPacket.ts"() {
399
416
  "use strict";
@@ -407,6 +424,7 @@ var init_claimPacket = __esm({
407
424
  TLV_CIPHERTEXT = 1;
408
425
  TLV_ARKADE_SCRIPT = 2;
409
426
  TLV_COVCLAIMD_PUBKEY = 3;
427
+ TLV_MIN_AMOUNT = 4;
410
428
  COMPRESSED_PUBKEY_LENGTH = 33;
411
429
  SEALED_CIPHERTEXT_LENGTH = 93;
412
430
  CLAIM_PACKET_TYPE = 4;
@@ -1941,6 +1959,7 @@ var init_rfq = __esm({
1941
1959
  init_onchainHtlc();
1942
1960
  init_onchainHtlc();
1943
1961
  import_sdk7 = require("@arkade-os/sdk");
1962
+ init_claimAmountGate();
1944
1963
  init_claimPacket();
1945
1964
  init_lockupContract();
1946
1965
  init_offer();
@@ -3056,9 +3075,8 @@ var operatorUnrollScript = async (operator, network) => {
3056
3075
  const info = await operator.getInfo();
3057
3076
  return (0, import_sdk8.assertValidServerUnrollScript)(
3058
3077
  info.checkpointTapscript,
3059
- (0, import_sdk8.resolveCheckpointExitDelayPolicy)(network ?? (0, import_sdk8.networkFromArkadeInfo)(info), {
3060
- advertisedForfeitPubkey: (0, import_sdk8.toXOnly)(import_base7.hex.decode(info.forfeitPubkey), "forfeit key")
3061
- })
3078
+ network ?? (0, import_sdk8.networkFromArkadeInfo)(info),
3079
+ (0, import_sdk8.toXOnly)(import_base7.hex.decode(info.forfeitPubkey), "forfeit key")
3062
3080
  );
3063
3081
  };
3064
3082
  var MAX_LOCKUP_SPEND_INPUTS = 16;
@@ -9147,6 +9165,7 @@ function unsignedPsbtBytes(tx) {
9147
9165
  }
9148
9166
 
9149
9167
  // src/client/quoteRfq.ts
9168
+ init_claimAmountGate();
9150
9169
  init_claimPacket();
9151
9170
  init_offer();
9152
9171
  init_store();
@@ -9698,7 +9717,13 @@ var quoteLightningReceive = async (input) => {
9698
9717
  const payoutAddress = await input.wallet.getAddress();
9699
9718
  const lightning = input.corridors.get("lightning").deps;
9700
9719
  const sealTo = sealingKey(lightning);
9701
- const claimPacket = sealTo ? await sealClaimPacket({ preimage: secrets.preimage, covclaimdPubkey: sealTo }) : void 0;
9720
+ const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
9721
+ const binds = bindsClaimAmount();
9722
+ const claimPacket = sealTo !== void 0 && (!binds || sealsAmount) ? await sealClaimPacket({
9723
+ preimage: secrets.preimage,
9724
+ covclaimdPubkey: sealTo,
9725
+ minAmount: binds ? pinned.value : void 0
9726
+ }) : void 0;
9702
9727
  const wire = await input.transport.requestQuote(
9703
9728
  withCanonicalAmount(
9704
9729
  lightningReceiveRequest({