@arkade-os/swap 0.0.3 → 0.0.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.
package/dist/index.js CHANGED
@@ -16,31 +16,24 @@ import {
16
16
  ONCHAIN_RECEIVE_PAIR,
17
17
  ONCHAIN_SECONDS_PER_BLOCK,
18
18
  ONCHAIN_SEND_PAIR,
19
- RFQ_PREIMAGE_TAG,
20
19
  RFQ_TERMINAL_STATES,
21
- RefundNotLocallyPossibleError,
22
20
  SWAP_LOCKUP_CONTRACT_KIND,
23
21
  SWAP_LOCKUP_CONTRACT_LABEL,
24
22
  SWAP_LOCKUP_CONTRACT_TYPE,
25
23
  SwapRefusal,
26
- adoptSwapDescriptor,
27
24
  arkadeSwapRequest,
28
25
  assertFundable,
29
26
  assertReceivable,
30
27
  awaitOnchainFill,
31
28
  buildHtlcClaim,
32
29
  buildHtlcRefund,
33
- buildPreimageMessage,
34
30
  claimOnchainFill,
35
31
  classifyOnchainHtlc,
36
32
  deriveLightningReceive,
37
33
  deriveOnchainReceive,
38
34
  deriveOnchainSend,
39
- derivePreimage,
40
- deriveSwapSecrets,
41
35
  extractPreimage,
42
36
  httpTransport,
43
- isDeterministicSigner,
44
37
  lightningReceiveRequest,
45
38
  lightningSendRequest,
46
39
  lightningSendVtxoScript,
@@ -51,8 +44,6 @@ import {
51
44
  onchainReceiveRequest,
52
45
  onchainSendRequest,
53
46
  paymentHashOf,
54
- preimageForRfqSecrets,
55
- randomSwapSecrets,
56
47
  receiveVtxoScript,
57
48
  registerLockupContract,
58
49
  relayTransport,
@@ -61,21 +52,16 @@ import {
61
52
  requestOnchainReceive,
62
53
  requestOnchainSend,
63
54
  rfqPair,
64
- rfqSecretsOfRecord,
65
- rfqSecretsToRecord,
66
55
  sealClaimPacket,
67
- senderIdentityForRfqSecrets,
68
- senderIdentityForSwapRecord,
69
- senderPubkeyForRfqSecrets,
70
56
  unilateralClaimDelay,
71
57
  unilateralRefundDelay,
72
58
  unilateralRefundWithoutReceiverDelay,
73
59
  verifyLockupAddress,
74
60
  verifyReceiveInvoice
75
- } from "./chunk-HLMMA3LJ.js";
61
+ } from "./chunk-DLM6BVTB.js";
76
62
 
77
63
  // src/offer.ts
78
- import { hex } from "@scure/base";
64
+ import { hex as hex2 } from "@scure/base";
79
65
  import { concatBytes } from "@scure/btc-signer/utils.js";
80
66
  import {
81
67
  ArkAddress,
@@ -216,6 +202,7 @@ async function retireSettledOfferContracts(manager, swaps) {
216
202
  }
217
203
 
218
204
  // src/store.ts
205
+ import { hex } from "@scure/base";
219
206
  var BTC_ASSET_ID = "btc";
220
207
  var byNewest = (a, b) => b.createdAt - a.createdAt;
221
208
  var getAssetSwapsOrThrow = async (repository) => {
@@ -268,6 +255,10 @@ var updateAssetSwapBestEffort = async (repository, id, changes) => {
268
255
  return { swaps, persisted: false };
269
256
  }
270
257
  };
258
+ var swapSecretsToRecord = (secrets) => ({
259
+ signingDescriptor: secrets.descriptor,
260
+ ..."mustPersistPreimage" in secrets && secrets.mustPersistPreimage ? { preimageHex: hex.encode(secrets.preimage) } : {}
261
+ });
271
262
 
272
263
  // src/offer.ts
273
264
  var swapPrograms = {
@@ -405,14 +396,14 @@ async function registerOfferContract(wallet, arkServerUrl, network, binding, ser
405
396
  contractManager
406
397
  });
407
398
  const contract = new arkade.ArkadeContract(client, program, args, keys);
408
- if (hex.encode(contract.pkScript) !== hex.encode(expectedPkScript)) {
399
+ if (hex2.encode(contract.pkScript) !== hex2.encode(expectedPkScript)) {
409
400
  throw new Error("derived covenant does not match the offer's swapPkScript");
410
401
  }
411
402
  await contract.register({
412
403
  label: OFFER_CONTRACT_LABEL,
413
404
  metadata: { genericallySpendable: false, kind: OFFER_CONTRACT_KIND }
414
405
  });
415
- await promoteOfferContract(contractManager, hex.encode(expectedPkScript));
406
+ await promoteOfferContract(contractManager, hex2.encode(expectedPkScript));
416
407
  }
417
408
  async function createOffer(wallet, arkServerUrl, params) {
418
409
  if (Boolean(params.wantAsset) === Boolean(params.offerAsset)) {
@@ -423,9 +414,9 @@ async function createOffer(wallet, arkServerUrl, params) {
423
414
  wallet.getAddress(),
424
415
  wallet.identity.xOnlyPublicKey()
425
416
  ]);
426
- const serverPubKey = hex.decode(toXOnlySignerHex(info.signerPubkey));
417
+ const serverPubKey = hex2.decode(toXOnlySignerHex(info.signerPubkey));
427
418
  const network = getNetwork(info.network);
428
- const emuKey = hex.decode(
419
+ const emuKey = hex2.decode(
429
420
  toXOnlySignerHex(resolveEmulatorPubkey(network, params.emulatorPubkey))
430
421
  );
431
422
  const binding = {
@@ -448,7 +439,7 @@ async function createOffer(wallet, arkServerUrl, params) {
448
439
  );
449
440
  const payload = encodeOffer(offer);
450
441
  return {
451
- offerHex: hex.encode(payload),
442
+ offerHex: hex2.encode(payload),
452
443
  extension: { type: OFFER_PACKET_TYPE, payload },
453
444
  // VtxoScript.address owns address construction; assembling an ArkAddress
454
445
  // from tweakedPublicKey here would silently miss any future step it gains
@@ -458,7 +449,7 @@ async function createOffer(wallet, arkServerUrl, params) {
458
449
  }
459
450
  async function cancelOffer(wallet, arkServerUrl, offerHex, opts) {
460
451
  const { repository, fundingTxid, swapAddress } = opts;
461
- const offer = decodeOffer(hex.decode(offerHex));
452
+ const offer = decodeOffer(hex2.decode(offerHex));
462
453
  const contractManager = await wallet.getContractManager();
463
454
  const client = await arkade.Arkade.connect({
464
455
  arkade: new RestArkProvider(arkServerUrl),
@@ -475,7 +466,7 @@ async function cancelOffer(wallet, arkServerUrl, offerHex, opts) {
475
466
  const serverKey = swapAddress ? ArkAddress.decode(swapAddress).serverPubKey : client.serverKey;
476
467
  const { program, args, keys } = swapProgramBinding(offer, serverKey);
477
468
  const rebuilt = new arkade.ArkadeProgramScript(program, args, keys);
478
- if (hex.encode(rebuilt.pkScript) !== hex.encode(offer.swapPkScript)) {
469
+ if (hex2.encode(rebuilt.pkScript) !== hex2.encode(offer.swapPkScript)) {
479
470
  throw new Error(
480
471
  "rebuilt covenant does not match the offer's swapPkScript \u2014 the server signing key has likely rotated since funding; pass swapAddress (the funded address) to pin the original key"
481
472
  );
@@ -508,7 +499,7 @@ async function cancelOffer(wallet, arkServerUrl, offerHex, opts) {
508
499
  spentTxid: txid
509
500
  });
510
501
  if (persisted) {
511
- await retireOfferContract(contractManager, swaps, hex.encode(offer.swapPkScript));
502
+ await retireOfferContract(contractManager, swaps, hex2.encode(offer.swapPkScript));
512
503
  }
513
504
  }
514
505
  return txid;
@@ -779,7 +770,7 @@ var IndexedDbAssetSwapRepository = class {
779
770
  };
780
771
 
781
772
  // src/restore.ts
782
- import { base64, hex as hex2 } from "@scure/base";
773
+ import { base64, hex as hex3 } from "@scure/base";
783
774
  import {
784
775
  Extension,
785
776
  Transaction,
@@ -815,7 +806,7 @@ function classifySpend(offer, serverPubkey, spendTx, deposit) {
815
806
  let leaves;
816
807
  try {
817
808
  const script = offerVtxoScript(offer, serverPubkey);
818
- if (hex2.encode(script.pkScript) !== hex2.encode(offer.swapPkScript)) return "indeterminate";
809
+ if (hex3.encode(script.pkScript) !== hex3.encode(offer.swapPkScript)) return "indeterminate";
819
810
  leaves = {
820
811
  cancel: script.functionByName("cancel")?.leafScript,
821
812
  fulfill: script.functionByName("fulfill")?.leafScript
@@ -826,11 +817,11 @@ function classifySpend(offer, serverPubkey, spendTx, deposit) {
826
817
  for (let i = 0; i < spendTx.inputsLength; i++) {
827
818
  const input = spendTx.getInput(i);
828
819
  if (!input.txid || input.index !== deposit.vout) continue;
829
- if (hex2.encode(input.txid) !== deposit.txid) continue;
820
+ if (hex3.encode(input.txid) !== deposit.txid) continue;
830
821
  for (const leaf of input.tapLeafScript ?? []) {
831
- const spent = hex2.encode(scriptFromTapLeafScript(leaf));
832
- if (leaves.cancel && spent === hex2.encode(leaves.cancel)) return "cancelled";
833
- if (leaves.fulfill && spent === hex2.encode(leaves.fulfill)) return "fulfilled";
822
+ const spent = hex3.encode(scriptFromTapLeafScript(leaf));
823
+ if (leaves.cancel && spent === hex3.encode(leaves.cancel)) return "cancelled";
824
+ if (leaves.fulfill && spent === hex3.encode(leaves.fulfill)) return "fulfilled";
834
825
  }
835
826
  }
836
827
  return "indeterminate";
@@ -865,13 +856,13 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
865
856
  found.push({
866
857
  fundingTx,
867
858
  offer: decodeOffer(payload),
868
- offerHex: hex2.encode(payload)
859
+ offerHex: hex3.encode(payload)
869
860
  });
870
861
  } catch {
871
862
  }
872
863
  }
873
864
  if (found.length === 0) return { restored: [], scannedTxids: fetchedTxids };
874
- const scripts = [...new Set(found.map((f) => hex2.encode(f.offer.swapPkScript)))];
865
+ const scripts = [...new Set(found.map((f) => hex3.encode(f.offer.swapPkScript)))];
875
866
  const { vtxos } = await indexer.getVtxos({ scripts });
876
867
  const vtxoByScriptAndTxid = new Map(vtxos.map((v) => [`${v.script}:${v.txid}`, v]));
877
868
  const txByAnyId = /* @__PURE__ */ new Map();
@@ -883,7 +874,7 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
883
874
  const spendTxids = /* @__PURE__ */ new Set();
884
875
  for (const { fundingTx, offer } of found) {
885
876
  const vtxo = vtxoByScriptAndTxid.get(
886
- `${hex2.encode(offer.swapPkScript)}:${fundingTx.redeemTxid}`
877
+ `${hex3.encode(offer.swapPkScript)}:${fundingTx.redeemTxid}`
887
878
  );
888
879
  if (vtxo?.virtualStatus.state !== "spent") continue;
889
880
  for (const txid of spendTxidsOf(vtxo)) spendTxids.add(txid);
@@ -892,7 +883,7 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
892
883
  const restored = [];
893
884
  const unresolved = /* @__PURE__ */ new Set();
894
885
  for (const { fundingTx, offer, offerHex } of found) {
895
- const swapPkScript = hex2.encode(offer.swapPkScript);
886
+ const swapPkScript = hex3.encode(offer.swapPkScript);
896
887
  const vtxo = vtxoByScriptAndTxid.get(`${swapPkScript}:${fundingTx.redeemTxid}`);
897
888
  if (!vtxo) {
898
889
  unresolved.add(fundingTx.redeemTxid);
@@ -949,7 +940,7 @@ async function restoreAssetSwaps(indexer, txs, existingIds, opts) {
949
940
  }
950
941
 
951
942
  // src/watch.ts
952
- import { base64 as base642, hex as hex3 } from "@scure/base";
943
+ import { base64 as base642, hex as hex4 } from "@scure/base";
953
944
  import {
954
945
  ArkAddress as ArkAddress2,
955
946
  RestIndexerProvider as RestIndexerProvider3,
@@ -988,7 +979,7 @@ async function watchOfferSwaps({
988
979
  if (candidates.length === 0) return "indeterminate";
989
980
  const { txs } = await indexer.getVirtualTxs(candidates);
990
981
  return classifyDepositSpend(
991
- decodeOffer(hex3.decode(swap.offerHex)),
982
+ decodeOffer(hex4.decode(swap.offerHex)),
992
983
  serverPubkey,
993
984
  txs.map((psbt) => Transaction2.fromPSBT(base642.decode(psbt))),
994
985
  { txid: vtxo.txid, vout: vtxo.vout }
@@ -1032,7 +1023,7 @@ async function watchOfferSwaps({
1032
1023
  }
1033
1024
 
1034
1025
  // src/claim.ts
1035
- import { hex as hex5 } from "@scure/base";
1026
+ import { hex as hex6 } from "@scure/base";
1036
1027
  import { ripemd160 } from "@noble/hashes/legacy.js";
1037
1028
  import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
1038
1029
  import {
@@ -1042,7 +1033,7 @@ import {
1042
1033
  } from "@arkade-os/sdk";
1043
1034
 
1044
1035
  // src/refund.ts
1045
- import { base64 as base643, hex as hex4 } from "@scure/base";
1036
+ import { base64 as base643, hex as hex5 } from "@scure/base";
1046
1037
  import { sha256 } from "@noble/hashes/sha2.js";
1047
1038
  import {
1048
1039
  CSVMultisigTapscript,
@@ -1099,7 +1090,7 @@ var LockupNeedsRecoveryError = class extends Error {
1099
1090
  }
1100
1091
  };
1101
1092
  async function findLockupVtxos(indexer, swapPkScript) {
1102
- const scripts = [hex4.encode(swapPkScript)];
1093
+ const scripts = [hex5.encode(swapPkScript)];
1103
1094
  const [spendable, recoverable] = await Promise.all([
1104
1095
  indexer.getVtxos({ scripts, spendableOnly: true }),
1105
1096
  indexer.getVtxos({ scripts, recoverableOnly: true })
@@ -1124,13 +1115,13 @@ async function findLockupVtxos(indexer, swapPkScript) {
1124
1115
  }
1125
1116
  return out;
1126
1117
  }
1127
- var hashesTo = (candidate, paymentHash) => hex4.encode(sha256(candidate)) === paymentHash;
1118
+ var hashesTo = (candidate, paymentHash) => hex5.encode(sha256(candidate)) === paymentHash;
1128
1119
  var candidateWitnessItems = (tx, inputIndex) => [
1129
1120
  ...getArkPsbtFields(tx, inputIndex, ConditionWitness).flat(),
1130
1121
  ...tx.getInput(inputIndex).finalScriptWitness ?? []
1131
1122
  ];
1132
1123
  async function readLockupFate(indexer, input) {
1133
- const { vtxos } = await indexer.getVtxos({ scripts: [hex4.encode(input.swapPkScript)] });
1124
+ const { vtxos } = await indexer.getVtxos({ scripts: [hex5.encode(input.swapPkScript)] });
1134
1125
  const all = vtxos ?? [];
1135
1126
  if (all.length === 0) return { fate: "unknown" };
1136
1127
  const spentBy = /* @__PURE__ */ new Set();
@@ -1153,7 +1144,7 @@ async function readLockupFate(indexer, input) {
1153
1144
  for (let i = 0; i < tx.inputsLength; i++) {
1154
1145
  const spent = tx.getInput(i);
1155
1146
  if (!spent.txid) continue;
1156
- const txid = hex4.encode(spent.txid);
1147
+ const txid = hex5.encode(spent.txid);
1157
1148
  if (!all.some((vtxo) => vtxo.txid === txid && vtxo.vout === spent.index)) continue;
1158
1149
  for (const candidate of candidateWitnessItems(tx, i)) {
1159
1150
  if (hashesTo(candidate, input.paymentHash)) {
@@ -1182,7 +1173,7 @@ async function pushRefundWithoutReceiver(ark, input) {
1182
1173
  const info = await ark.getInfo();
1183
1174
  let serverUnrollScript;
1184
1175
  try {
1185
- serverUnrollScript = CSVMultisigTapscript.decode(hex4.decode(info.checkpointTapscript));
1176
+ serverUnrollScript = CSVMultisigTapscript.decode(hex5.decode(info.checkpointTapscript));
1186
1177
  } catch {
1187
1178
  throw new Error("invalid checkpointTapscript from the Arkade server");
1188
1179
  }
@@ -1293,13 +1284,13 @@ async function pushClaim(ark, input) {
1293
1284
  }
1294
1285
  }
1295
1286
  const committed = input.script.options.preimageHash;
1296
- if (hex5.encode(ripemd160(sha2562(input.preimage))) !== hex5.encode(committed)) {
1287
+ if (hex6.encode(ripemd160(sha2562(input.preimage))) !== hex6.encode(committed)) {
1297
1288
  throw new Error("preimage does not match the covenant's payment hash");
1298
1289
  }
1299
1290
  const info = await ark.getInfo();
1300
1291
  let serverUnrollScript;
1301
1292
  try {
1302
- serverUnrollScript = CSVMultisigTapscript2.decode(hex5.decode(info.checkpointTapscript));
1293
+ serverUnrollScript = CSVMultisigTapscript2.decode(hex6.decode(info.checkpointTapscript));
1303
1294
  } catch {
1304
1295
  throw new Error("invalid checkpointTapscript from the Arkade server");
1305
1296
  }
@@ -1352,8 +1343,50 @@ async function claimReceiveLockup(indexer, ark, input) {
1352
1343
  });
1353
1344
  }
1354
1345
 
1346
+ // src/refundBlocked.ts
1347
+ import {
1348
+ ForeignDescriptorError,
1349
+ WalletCannotSignError,
1350
+ contractSigner
1351
+ } from "@arkade-os/sdk";
1352
+ var RefundNotLocallyPossibleError = class extends Error {
1353
+ constructor(reason, message, options) {
1354
+ super(message, options);
1355
+ this.reason = reason;
1356
+ }
1357
+ reason;
1358
+ name = "RefundNotLocallyPossibleError";
1359
+ };
1360
+ async function senderIdentityForSwapRecord(wallet, record) {
1361
+ if (!record.signingDescriptor) {
1362
+ throw new RefundNotLocallyPossibleError(
1363
+ "no-secrets",
1364
+ "this swap record carries no signing descriptor"
1365
+ );
1366
+ }
1367
+ try {
1368
+ return await contractSigner(wallet, record.signingDescriptor);
1369
+ } catch (cause) {
1370
+ if (cause instanceof WalletCannotSignError) {
1371
+ throw new RefundNotLocallyPossibleError(
1372
+ "unsignable-wallet",
1373
+ `this wallet holds ${record.signingDescriptor} but cannot sign with it; attach its signer`,
1374
+ { cause }
1375
+ );
1376
+ }
1377
+ if (cause instanceof ForeignDescriptorError) {
1378
+ throw new RefundNotLocallyPossibleError(
1379
+ "foreign-descriptor",
1380
+ `this wallet cannot derive ${record.signingDescriptor}; the swap was created on another wallet`,
1381
+ { cause }
1382
+ );
1383
+ }
1384
+ throw cause;
1385
+ }
1386
+ }
1387
+
1355
1388
  // src/swapManager.ts
1356
- import { hex as hex6 } from "@scure/base";
1389
+ import { hex as hex7 } from "@scure/base";
1357
1390
  var RFQ_SWAP_TERMINAL_STATES = ["settled", "refunded", "failed"];
1358
1391
  var isRfqSwapTerminal = (state) => RFQ_SWAP_TERMINAL_STATES.includes(state);
1359
1392
  function nextOnchainAction(input) {
@@ -1621,7 +1654,7 @@ var RfqSwapManager = class {
1621
1654
  // ── internals ────────────────────────────────────────────────────────────
1622
1655
  track(swap) {
1623
1656
  this.monitored.set(swap.rfqId, swap);
1624
- this.byLockupScript.set(hex6.encode(swap.lockupPkScript), swap);
1657
+ this.byLockupScript.set(hex7.encode(swap.lockupPkScript), swap);
1625
1658
  }
1626
1659
  /** Drops the swap from BOTH indexes. The event index is the one that stops
1627
1660
  * a late event finding a swap that is gone; `pollSwap`'s own
@@ -1630,7 +1663,7 @@ var RfqSwapManager = class {
1630
1663
  * them from silently re-driving a cancelled swap. */
1631
1664
  untrack(rfqId) {
1632
1665
  const swap = this.monitored.get(rfqId);
1633
- if (swap) this.byLockupScript.delete(hex6.encode(swap.lockupPkScript));
1666
+ if (swap) this.byLockupScript.delete(hex7.encode(swap.lockupPkScript));
1634
1667
  this.monitored.delete(rfqId);
1635
1668
  this.refundRefused.delete(rfqId);
1636
1669
  this.lastClaimError.delete(rfqId);
@@ -1692,7 +1725,7 @@ var RfqSwapManager = class {
1692
1725
  if (!lockup) {
1693
1726
  try {
1694
1727
  const [existing] = await contracts.getContracts({
1695
- script: hex6.encode(swap.lockupPkScript)
1728
+ script: hex7.encode(swap.lockupPkScript)
1696
1729
  });
1697
1730
  if (existing) {
1698
1731
  this.registered.set(swap.rfqId, true);
@@ -1711,13 +1744,13 @@ var RfqSwapManager = class {
1711
1744
  );
1712
1745
  return;
1713
1746
  }
1714
- const script = hex6.encode(lockup.script.pkScript);
1715
- if (script !== hex6.encode(swap.lockupPkScript)) {
1747
+ const script = hex7.encode(lockup.script.pkScript);
1748
+ if (script !== hex7.encode(swap.lockupPkScript)) {
1716
1749
  this.registered.set(swap.rfqId, false);
1717
1750
  this.emitFailed(
1718
1751
  swap,
1719
1752
  new Error(
1720
- `swap ${swap.rfqId} lockup script ${script} does not match its lockupPkScript ${hex6.encode(swap.lockupPkScript)}`
1753
+ `swap ${swap.rfqId} lockup script ${script} does not match its lockupPkScript ${hex7.encode(swap.lockupPkScript)}`
1721
1754
  )
1722
1755
  );
1723
1756
  return;
@@ -1736,7 +1769,7 @@ var RfqSwapManager = class {
1736
1769
  * script for its whole life. Best-effort — the swap is over either way. */
1737
1770
  retireContract(swap) {
1738
1771
  if (!this.deps.contracts || !this.registered.get(swap.rfqId)) return;
1739
- void this.deps.contracts.setContractWatchState(hex6.encode(swap.lockupPkScript), "retained").catch((error) => this.emitFailed(swap, error));
1772
+ void this.deps.contracts.setContractWatchState(hex7.encode(swap.lockupPkScript), "retained").catch((error) => this.emitFailed(swap, error));
1740
1773
  }
1741
1774
  arm() {
1742
1775
  if (!this.running) return;
@@ -2144,7 +2177,6 @@ export {
2144
2177
  ONCHAIN_SEND_PAIR,
2145
2178
  QUOTE_OPTIONS,
2146
2179
  REFUND_MTP_LAG_SECONDS,
2147
- RFQ_PREIMAGE_TAG,
2148
2180
  RFQ_RESOLVED_STATES,
2149
2181
  RFQ_SWAP_TERMINAL_STATES,
2150
2182
  RFQ_TERMINAL_STATES,
@@ -2155,7 +2187,6 @@ export {
2155
2187
  SWAP_LOCKUP_CONTRACT_TYPE,
2156
2188
  SwapRefusal,
2157
2189
  addAssetSwap,
2158
- adoptSwapDescriptor,
2159
2190
  arkadeSwapRequest,
2160
2191
  assertFundable,
2161
2192
  assertReceivable,
@@ -2164,7 +2195,6 @@ export {
2164
2195
  awaitRfqResolution,
2165
2196
  buildHtlcClaim,
2166
2197
  buildHtlcRefund,
2167
- buildPreimageMessage,
2168
2198
  cancelOffer,
2169
2199
  claimOnchainFill,
2170
2200
  claimReceiveLockup,
@@ -2176,8 +2206,6 @@ export {
2176
2206
  deriveLightningReceive,
2177
2207
  deriveOnchainReceive,
2178
2208
  deriveOnchainSend,
2179
- derivePreimage,
2180
- deriveSwapSecrets,
2181
2209
  discoverMarkets,
2182
2210
  encodeOffer,
2183
2211
  extractPreimage,
@@ -2186,7 +2214,6 @@ export {
2186
2214
  getAssetSwaps,
2187
2215
  getAssetSwapsOrThrow,
2188
2216
  httpTransport,
2189
- isDeterministicSigner,
2190
2217
  isRfqSwapTerminal,
2191
2218
  isRfqTerminal,
2192
2219
  lightningReceiveRequest,
@@ -2202,10 +2229,8 @@ export {
2202
2229
  onchainReceiveRequest,
2203
2230
  onchainSendRequest,
2204
2231
  paymentHashOf,
2205
- preimageForRfqSecrets,
2206
2232
  pushClaim,
2207
2233
  pushRefundWithoutReceiver,
2208
- randomSwapSecrets,
2209
2234
  readLockupFate,
2210
2235
  receiveVtxoScript,
2211
2236
  refundIfUnresolved,
@@ -2218,15 +2243,12 @@ export {
2218
2243
  restoreAssetSwaps,
2219
2244
  retireSettledOfferContracts,
2220
2245
  rfqPair,
2221
- rfqSecretsOfRecord,
2222
- rfqSecretsToRecord,
2223
2246
  sealClaimPacket,
2224
- senderIdentityForRfqSecrets,
2225
2247
  senderIdentityForSwapRecord,
2226
- senderPubkeyForRfqSecrets,
2227
2248
  spendTxidsOf,
2228
2249
  spendUpdate,
2229
2250
  swapPrograms,
2251
+ swapSecretsToRecord,
2230
2252
  unilateralClaimDelay,
2231
2253
  unilateralRefundDelay,
2232
2254
  unilateralRefundWithoutReceiverDelay,
package/dist/nostr.cjs CHANGED
@@ -38,9 +38,9 @@ __export(nostr_exports, {
38
38
  module.exports = __toCommonJS(nostr_exports);
39
39
 
40
40
  // src/rfq.ts
41
- var import_base5 = require("@scure/base");
41
+ var import_base4 = require("@scure/base");
42
42
  var import_legacy2 = require("@noble/hashes/legacy.js");
43
- var import_sdk3 = require("@arkade-os/sdk");
43
+ var import_sdk2 = require("@arkade-os/sdk");
44
44
 
45
45
  // src/onchainHtlc.ts
46
46
  var import_base = require("@scure/base");
@@ -56,23 +56,19 @@ var L1_NETWORKS = {
56
56
  regtest: { ...btc.TEST_NETWORK, bech32: "bcrt" }
57
57
  };
58
58
 
59
- // src/secrets.ts
60
- var import_base2 = require("@scure/base");
61
- var import_sha22 = require("@noble/hashes/sha2.js");
62
- var import_utils = require("@noble/hashes/utils.js");
63
- var import_secp256k1 = require("@noble/curves/secp256k1.js");
64
- var import_sdk = require("@arkade-os/sdk");
59
+ // src/rfq.ts
60
+ var import_sdk3 = require("@arkade-os/sdk");
65
61
 
66
62
  // src/claimPacket.ts
67
- var import_base3 = require("@scure/base");
68
- var import_secp256k12 = require("@noble/curves/secp256k1.js");
63
+ var import_base2 = require("@scure/base");
64
+ var import_secp256k1 = require("@noble/curves/secp256k1.js");
69
65
  var import_hkdf = require("@noble/hashes/hkdf.js");
70
- var import_sha23 = require("@noble/hashes/sha2.js");
66
+ var import_sha22 = require("@noble/hashes/sha2.js");
71
67
  var HKDF_INFO = new TextEncoder().encode("covclaimd/preimage/v1");
72
68
 
73
69
  // src/lockupContract.ts
74
- var import_base4 = require("@scure/base");
75
- var import_sdk2 = require("@arkade-os/sdk");
70
+ var import_base3 = require("@scure/base");
71
+ var import_sdk = require("@arkade-os/sdk");
76
72
 
77
73
  // src/rfq.ts
78
74
  var ARKADE_BTC = "arkade:BTC";
@@ -208,9 +204,9 @@ var nostrRfqTransport = (options) => {
208
204
  },
209
205
  async close() {
210
206
  closed = true;
211
- subscription.close();
212
207
  waiters.clear();
213
208
  if (ownsPool) pool.close(relays);
209
+ else subscription.close();
214
210
  }
215
211
  };
216
212
  };
package/dist/nostr.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { b as RfqTransport } from './rfq-CCAFoFtR.cjs';
1
+ import { a as RfqTransport } from './rfq-DjZlesr4.cjs';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
- import '@arkade-os/solver-discovery';
5
4
 
6
5
  /**
7
6
  * The Nostr RFQ transport — the PRODUCTION one (docs/rfq-protocol.md § 3.1 in
package/dist/nostr.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { b as RfqTransport } from './rfq-CCAFoFtR.js';
1
+ import { a as RfqTransport } from './rfq-DjZlesr4.js';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
- import '@arkade-os/solver-discovery';
5
4
 
6
5
  /**
7
6
  * The Nostr RFQ transport — the PRODUCTION one (docs/rfq-protocol.md § 3.1 in
package/dist/nostr.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SwapRefusal
3
- } from "./chunk-HLMMA3LJ.js";
3
+ } from "./chunk-DLM6BVTB.js";
4
4
 
5
5
  // src/nostr.ts
6
6
  import {
@@ -120,9 +120,9 @@ var nostrRfqTransport = (options) => {
120
120
  },
121
121
  async close() {
122
122
  closed = true;
123
- subscription.close();
124
123
  waiters.clear();
125
124
  if (ownsPool) pool.close(relays);
125
+ else subscription.close();
126
126
  }
127
127
  };
128
128
  };