@arkade-os/swap 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -7,6 +7,11 @@ Node-specific APIs, so it runs in Node, the browser, and React Native alike. Fou
7
7
  ship — in-memory (anywhere, nothing outlives the process), IndexedDB (browser), SQLite and Realm
8
8
  (React Native, on subpath entry points) — see "Storage backends" below.
9
9
 
10
+ The one global the core API requires is `crypto.getRandomValues`. Node and browsers have it;
11
+ React Native does not, so install `react-native-get-random-values` (or `expo-crypto`) and import
12
+ it before this package. `crypto.subtle` is not used. `EventSource` and `WebSocket` are needed only
13
+ by the watch and relay transports, both of which take an injected implementation.
14
+
10
15
  ## Roles
11
16
 
12
17
  Arkade Intents names two participants:
@@ -6,6 +6,7 @@ import * as btc from "@scure/btc-signer";
6
6
  var ONCHAIN_ORDER_MARGIN_SECONDS = 2 * 60 * 60;
7
7
  var ONCHAIN_CLAIM_MARGIN_SECONDS = 90 * 60;
8
8
  var MAX_MIN_CONFIRMATIONS = 6;
9
+ var LOCKTIME_THRESHOLD = 5e8;
9
10
  var ONCHAIN_SECONDS_PER_BLOCK = 600;
10
11
  var ONCHAIN_DUST_SATS = BigInt(330);
11
12
  var newPreimage = () => crypto.getRandomValues(new Uint8Array(32));
@@ -25,6 +26,11 @@ function onchainHtlcScript(params, network) {
25
26
  `refundLocktime must be a positive unix timestamp, got ${params.refundLocktime}`
26
27
  );
27
28
  }
29
+ if (params.refundLocktime < LOCKTIME_THRESHOLD) {
30
+ throw new Error(
31
+ `refundLocktime ${params.refundLocktime} is below LOCKTIME_THRESHOLD (${LOCKTIME_THRESHOLD}) and would be interpreted as a block height`
32
+ );
33
+ }
28
34
  if (!Object.hasOwn(L1_NETWORKS, network)) {
29
35
  throw new Error(
30
36
  `unknown L1 network '${String(network)}' \u2014 expected one of ${Object.keys(L1_NETWORKS).join(", ")}`
@@ -211,6 +217,7 @@ async function classifyOnchainHtlc(chain, input) {
211
217
 
212
218
  // src/claimPacket.ts
213
219
  import { base64 } from "@scure/base";
220
+ import { gcm } from "@noble/ciphers/aes.js";
214
221
  import { secp256k1 } from "@noble/curves/secp256k1.js";
215
222
  import { hkdf } from "@noble/hashes/hkdf.js";
216
223
  import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
@@ -231,20 +238,7 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
231
238
  const sharedX = secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
232
239
  const key = hkdf(sha2562, sharedX, ephemeralPub, HKDF_INFO, 32);
233
240
  if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
234
- const aesKey = await crypto.subtle.importKey("raw", key, "AES-GCM", false, [
235
- "encrypt"
236
- ]);
237
- const sealed = new Uint8Array(
238
- await crypto.subtle.encrypt(
239
- {
240
- name: "AES-GCM",
241
- iv: nonce,
242
- additionalData: ephemeralPub
243
- },
244
- aesKey,
245
- input.preimage
246
- )
247
- );
241
+ const sealed = gcm(key, nonce, ephemeralPub).encrypt(input.preimage);
248
242
  const packet = new Uint8Array(33 + 12 + sealed.length);
249
243
  packet.set(ephemeralPub, 0);
250
244
  packet.set(nonce, 33);
@@ -318,19 +312,13 @@ import {
318
312
  RestArkProvider,
319
313
  VHTLC,
320
314
  getNetwork,
321
- resolveEmulatorPubkey
315
+ resolveEmulatorPubkey,
316
+ toXOnly
322
317
  } from "@arkade-os/sdk";
323
318
  import {
324
319
  provisionClaimSecret,
325
320
  provisionRefundKey
326
321
  } from "@arkade-os/sdk";
327
- var xOnly = (key, label) => {
328
- if (key.length === 32) return key;
329
- if (key.length !== 33 || key[0] !== 2 && key[0] !== 3) {
330
- throw new Error(`${label} is not a compressed or x-only public key`);
331
- }
332
- return key.slice(1);
333
- };
334
322
  var solverHex = (value, field) => {
335
323
  try {
336
324
  return hex3.decode(value);
@@ -675,15 +663,15 @@ async function requestLightningSend(wallet, arkServerUrl, transport, params) {
675
663
  `quote from_amount ${quote.from_amount} is below the invoice amount \u2014 a negative spread is not a quote`
676
664
  );
677
665
  }
678
- const serverPubkey = xOnly(hex3.decode(info.signerPubkey), "ark signer key");
666
+ const serverPubkey = toXOnly(hex3.decode(info.signerPubkey), "ark signer key");
679
667
  const network = getNetwork(info.network);
680
668
  const treeParams = {
681
- solverPubkey: xOnly(hex3.decode(quote.solver_pubkey), "solver key"),
669
+ solverPubkey: toXOnly(hex3.decode(quote.solver_pubkey), "solver key"),
682
670
  refundLocktime: quote.refund_locktime,
683
671
  serverPubkey,
684
672
  paymentHash: params.invoice.paymentHash,
685
673
  claimDelay: unilateralClaimDelay(Number(info.unilateralExitDelay)),
686
- emulatorPubkey: xOnly(
674
+ emulatorPubkey: toXOnly(
687
675
  hex3.decode(resolveEmulatorPubkey(network, params.emulatorPubkey)),
688
676
  "emulator signer key"
689
677
  ),
@@ -778,7 +766,7 @@ function deriveOnchainSend(input) {
778
766
  throw new Error("onchain-send quote is missing a binding field");
779
767
  }
780
768
  const script = lightningSendVtxoScript({
781
- solverPubkey: xOnly(hex3.decode(quote.solver_pubkey), "solver key"),
769
+ solverPubkey: toXOnly(hex3.decode(quote.solver_pubkey), "solver key"),
782
770
  refundLocktime,
783
771
  serverPubkey: input.serverPubkey,
784
772
  paymentHash: input.paymentHash,
@@ -793,7 +781,7 @@ function deriveOnchainSend(input) {
793
781
  const htlcParams = {
794
782
  paymentHash: input.paymentHash,
795
783
  claimKey: input.payoutPubkey,
796
- refundKey: xOnly(hex3.decode(htlcPubkey), "solver L1 htlc key"),
784
+ refundKey: toXOnly(hex3.decode(htlcPubkey), "solver L1 htlc key"),
797
785
  refundLocktime: htlcLocktime
798
786
  };
799
787
  const htlc = onchainHtlcScript(htlcParams, input.l1Network);
@@ -840,8 +828,8 @@ async function requestOnchainSend(wallet, arkServerUrl, transport, params) {
840
828
  quote,
841
829
  paymentHash,
842
830
  payoutPubkey: params.payoutPubkey,
843
- serverPubkey: xOnly(hex3.decode(info.signerPubkey), "ark signer key"),
844
- emulatorPubkey: xOnly(
831
+ serverPubkey: toXOnly(hex3.decode(info.signerPubkey), "ark signer key"),
832
+ emulatorPubkey: toXOnly(
845
833
  hex3.decode(resolveEmulatorPubkey(network, params.emulatorPubkey)),
846
834
  "emulator signer key"
847
835
  ),
@@ -984,7 +972,7 @@ function deriveLightningReceive(input) {
984
972
  throw new Error("lightning-receive quote is missing a binding field");
985
973
  }
986
974
  const treeParams = {
987
- solverPubkey: xOnly(hex3.decode(quote.solver_pubkey), "solver key"),
975
+ solverPubkey: toXOnly(hex3.decode(quote.solver_pubkey), "solver key"),
988
976
  refundLocktime,
989
977
  serverPubkey: input.serverPubkey,
990
978
  paymentHash: input.paymentHash,
@@ -1036,8 +1024,8 @@ async function requestLightningReceive(wallet, arkServerUrl, transport, params)
1036
1024
  paymentHash,
1037
1025
  payoutPubkey,
1038
1026
  payoutAddress,
1039
- serverPubkey: xOnly(hex3.decode(info.signerPubkey), "ark signer key"),
1040
- emulatorPubkey: xOnly(
1027
+ serverPubkey: toXOnly(hex3.decode(info.signerPubkey), "ark signer key"),
1028
+ emulatorPubkey: toXOnly(
1041
1029
  hex3.decode(resolveEmulatorPubkey(network, params.emulatorPubkey)),
1042
1030
  "emulator signer key"
1043
1031
  ),
@@ -1086,7 +1074,7 @@ function deriveOnchainReceive(input) {
1086
1074
  throw new Error("onchain-receive quote is missing a binding field");
1087
1075
  }
1088
1076
  const script = receiveVtxoScript({
1089
- solverPubkey: xOnly(hex3.decode(quote.solver_pubkey), "solver key"),
1077
+ solverPubkey: toXOnly(hex3.decode(quote.solver_pubkey), "solver key"),
1090
1078
  refundLocktime,
1091
1079
  serverPubkey: input.serverPubkey,
1092
1080
  paymentHash: input.paymentHash,
@@ -1101,7 +1089,7 @@ function deriveOnchainReceive(input) {
1101
1089
  const htlc = onchainHtlcScript(
1102
1090
  {
1103
1091
  paymentHash: input.paymentHash,
1104
- claimKey: xOnly(hex3.decode(claimPubkey), "solver L1 claim key"),
1092
+ claimKey: toXOnly(hex3.decode(claimPubkey), "solver L1 claim key"),
1105
1093
  refundKey: input.refundPubkey,
1106
1094
  refundLocktime: htlcLocktime
1107
1095
  },
@@ -1157,8 +1145,8 @@ async function requestOnchainReceive(wallet, arkServerUrl, transport, params) {
1157
1145
  payoutPubkey,
1158
1146
  payoutAddress,
1159
1147
  refundPubkey: params.refundPubkey,
1160
- serverPubkey: xOnly(hex3.decode(info.signerPubkey), "ark signer key"),
1161
- emulatorPubkey: xOnly(
1148
+ serverPubkey: toXOnly(hex3.decode(info.signerPubkey), "ark signer key"),
1149
+ emulatorPubkey: toXOnly(
1162
1150
  hex3.decode(resolveEmulatorPubkey(network, params.emulatorPubkey)),
1163
1151
  "emulator signer key"
1164
1152
  ),
@@ -1199,6 +1187,7 @@ export {
1199
1187
  ONCHAIN_ORDER_MARGIN_SECONDS,
1200
1188
  ONCHAIN_CLAIM_MARGIN_SECONDS,
1201
1189
  MAX_MIN_CONFIRMATIONS,
1190
+ LOCKTIME_THRESHOLD,
1202
1191
  ONCHAIN_SECONDS_PER_BLOCK,
1203
1192
  ONCHAIN_DUST_SATS,
1204
1193
  newPreimage,
package/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  LIGHTNING_BTC: () => LIGHTNING_BTC,
40
40
  LIGHTNING_RECEIVE_PAIR: () => LIGHTNING_RECEIVE_PAIR,
41
41
  LIGHTNING_SEND_PAIR: () => LIGHTNING_SEND_PAIR,
42
+ LOCKTIME_THRESHOLD: () => LOCKTIME_THRESHOLD,
42
43
  LockupAmountMismatchError: () => LockupAmountMismatchError,
43
44
  LockupContractMissing: () => LockupContractMissing,
44
45
  LockupNeedsRecoveryError: () => LockupNeedsRecoveryError,
@@ -1050,6 +1051,7 @@ var btc = __toESM(require("@scure/btc-signer"), 1);
1050
1051
  var ONCHAIN_ORDER_MARGIN_SECONDS = 2 * 60 * 60;
1051
1052
  var ONCHAIN_CLAIM_MARGIN_SECONDS = 90 * 60;
1052
1053
  var MAX_MIN_CONFIRMATIONS = 6;
1054
+ var LOCKTIME_THRESHOLD = 5e8;
1053
1055
  var ONCHAIN_SECONDS_PER_BLOCK = 600;
1054
1056
  var ONCHAIN_DUST_SATS = BigInt(330);
1055
1057
  var newPreimage = () => crypto.getRandomValues(new Uint8Array(32));
@@ -1069,6 +1071,11 @@ function onchainHtlcScript(params, network) {
1069
1071
  `refundLocktime must be a positive unix timestamp, got ${params.refundLocktime}`
1070
1072
  );
1071
1073
  }
1074
+ if (params.refundLocktime < LOCKTIME_THRESHOLD) {
1075
+ throw new Error(
1076
+ `refundLocktime ${params.refundLocktime} is below LOCKTIME_THRESHOLD (${LOCKTIME_THRESHOLD}) and would be interpreted as a block height`
1077
+ );
1078
+ }
1072
1079
  if (!Object.hasOwn(L1_NETWORKS, network)) {
1073
1080
  throw new Error(
1074
1081
  `unknown L1 network '${String(network)}' \u2014 expected one of ${Object.keys(L1_NETWORKS).join(", ")}`
@@ -1723,6 +1730,7 @@ var import_sdk10 = require("@arkade-os/sdk");
1723
1730
 
1724
1731
  // src/claimPacket.ts
1725
1732
  var import_base8 = require("@scure/base");
1733
+ var import_aes = require("@noble/ciphers/aes.js");
1726
1734
  var import_secp256k1 = require("@noble/curves/secp256k1.js");
1727
1735
  var import_hkdf = require("@noble/hashes/hkdf.js");
1728
1736
  var import_sha23 = require("@noble/hashes/sha2.js");
@@ -1743,20 +1751,7 @@ async function sealWithEntropy(input, ephemeralKey, nonce) {
1743
1751
  const sharedX = import_secp256k1.secp256k1.getSharedSecret(ephemeralKey, input.covclaimdPubkey, true).subarray(1);
1744
1752
  const key = (0, import_hkdf.hkdf)(import_sha23.sha256, sharedX, ephemeralPub, HKDF_INFO, 32);
1745
1753
  if (nonce.length !== 12) throw new Error("nonce must be 12 bytes");
1746
- const aesKey = await crypto.subtle.importKey("raw", key, "AES-GCM", false, [
1747
- "encrypt"
1748
- ]);
1749
- const sealed = new Uint8Array(
1750
- await crypto.subtle.encrypt(
1751
- {
1752
- name: "AES-GCM",
1753
- iv: nonce,
1754
- additionalData: ephemeralPub
1755
- },
1756
- aesKey,
1757
- input.preimage
1758
- )
1759
- );
1754
+ const sealed = (0, import_aes.gcm)(key, nonce, ephemeralPub).encrypt(input.preimage);
1760
1755
  const packet = new Uint8Array(33 + 12 + sealed.length);
1761
1756
  packet.set(ephemeralPub, 0);
1762
1757
  packet.set(nonce, 33);
@@ -1820,13 +1815,6 @@ async function lockupContractParams(contracts, lockupAddress) {
1820
1815
  }
1821
1816
 
1822
1817
  // src/rfq.ts
1823
- var xOnly = (key, label) => {
1824
- if (key.length === 32) return key;
1825
- if (key.length !== 33 || key[0] !== 2 && key[0] !== 3) {
1826
- throw new Error(`${label} is not a compressed or x-only public key`);
1827
- }
1828
- return key.slice(1);
1829
- };
1830
1818
  var solverHex = (value, field) => {
1831
1819
  try {
1832
1820
  return import_base10.hex.decode(value);
@@ -2171,15 +2159,15 @@ async function requestLightningSend(wallet, arkServerUrl, transport, params) {
2171
2159
  `quote from_amount ${quote.from_amount} is below the invoice amount \u2014 a negative spread is not a quote`
2172
2160
  );
2173
2161
  }
2174
- const serverPubkey = xOnly(import_base10.hex.decode(info.signerPubkey), "ark signer key");
2162
+ const serverPubkey = (0, import_sdk9.toXOnly)(import_base10.hex.decode(info.signerPubkey), "ark signer key");
2175
2163
  const network = (0, import_sdk9.getNetwork)(info.network);
2176
2164
  const treeParams = {
2177
- solverPubkey: xOnly(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2165
+ solverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2178
2166
  refundLocktime: quote.refund_locktime,
2179
2167
  serverPubkey,
2180
2168
  paymentHash: params.invoice.paymentHash,
2181
2169
  claimDelay: unilateralClaimDelay(Number(info.unilateralExitDelay)),
2182
- emulatorPubkey: xOnly(
2170
+ emulatorPubkey: (0, import_sdk9.toXOnly)(
2183
2171
  import_base10.hex.decode((0, import_sdk9.resolveEmulatorPubkey)(network, params.emulatorPubkey)),
2184
2172
  "emulator signer key"
2185
2173
  ),
@@ -2274,7 +2262,7 @@ function deriveOnchainSend(input) {
2274
2262
  throw new Error("onchain-send quote is missing a binding field");
2275
2263
  }
2276
2264
  const script = lightningSendVtxoScript({
2277
- solverPubkey: xOnly(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2265
+ solverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2278
2266
  refundLocktime,
2279
2267
  serverPubkey: input.serverPubkey,
2280
2268
  paymentHash: input.paymentHash,
@@ -2289,7 +2277,7 @@ function deriveOnchainSend(input) {
2289
2277
  const htlcParams = {
2290
2278
  paymentHash: input.paymentHash,
2291
2279
  claimKey: input.payoutPubkey,
2292
- refundKey: xOnly(import_base10.hex.decode(htlcPubkey), "solver L1 htlc key"),
2280
+ refundKey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(htlcPubkey), "solver L1 htlc key"),
2293
2281
  refundLocktime: htlcLocktime
2294
2282
  };
2295
2283
  const htlc = onchainHtlcScript(htlcParams, input.l1Network);
@@ -2336,8 +2324,8 @@ async function requestOnchainSend(wallet, arkServerUrl, transport, params) {
2336
2324
  quote,
2337
2325
  paymentHash,
2338
2326
  payoutPubkey: params.payoutPubkey,
2339
- serverPubkey: xOnly(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2340
- emulatorPubkey: xOnly(
2327
+ serverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2328
+ emulatorPubkey: (0, import_sdk9.toXOnly)(
2341
2329
  import_base10.hex.decode((0, import_sdk9.resolveEmulatorPubkey)(network, params.emulatorPubkey)),
2342
2330
  "emulator signer key"
2343
2331
  ),
@@ -2480,7 +2468,7 @@ function deriveLightningReceive(input) {
2480
2468
  throw new Error("lightning-receive quote is missing a binding field");
2481
2469
  }
2482
2470
  const treeParams = {
2483
- solverPubkey: xOnly(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2471
+ solverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2484
2472
  refundLocktime,
2485
2473
  serverPubkey: input.serverPubkey,
2486
2474
  paymentHash: input.paymentHash,
@@ -2532,8 +2520,8 @@ async function requestLightningReceive(wallet, arkServerUrl, transport, params)
2532
2520
  paymentHash,
2533
2521
  payoutPubkey,
2534
2522
  payoutAddress,
2535
- serverPubkey: xOnly(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2536
- emulatorPubkey: xOnly(
2523
+ serverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2524
+ emulatorPubkey: (0, import_sdk9.toXOnly)(
2537
2525
  import_base10.hex.decode((0, import_sdk9.resolveEmulatorPubkey)(network, params.emulatorPubkey)),
2538
2526
  "emulator signer key"
2539
2527
  ),
@@ -2582,7 +2570,7 @@ function deriveOnchainReceive(input) {
2582
2570
  throw new Error("onchain-receive quote is missing a binding field");
2583
2571
  }
2584
2572
  const script = receiveVtxoScript({
2585
- solverPubkey: xOnly(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2573
+ solverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(quote.solver_pubkey), "solver key"),
2586
2574
  refundLocktime,
2587
2575
  serverPubkey: input.serverPubkey,
2588
2576
  paymentHash: input.paymentHash,
@@ -2597,7 +2585,7 @@ function deriveOnchainReceive(input) {
2597
2585
  const htlc = onchainHtlcScript(
2598
2586
  {
2599
2587
  paymentHash: input.paymentHash,
2600
- claimKey: xOnly(import_base10.hex.decode(claimPubkey), "solver L1 claim key"),
2588
+ claimKey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(claimPubkey), "solver L1 claim key"),
2601
2589
  refundKey: input.refundPubkey,
2602
2590
  refundLocktime: htlcLocktime
2603
2591
  },
@@ -2653,8 +2641,8 @@ async function requestOnchainReceive(wallet, arkServerUrl, transport, params) {
2653
2641
  payoutPubkey,
2654
2642
  payoutAddress,
2655
2643
  refundPubkey: params.refundPubkey,
2656
- serverPubkey: xOnly(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2657
- emulatorPubkey: xOnly(
2644
+ serverPubkey: (0, import_sdk9.toXOnly)(import_base10.hex.decode(info.signerPubkey), "ark signer key"),
2645
+ emulatorPubkey: (0, import_sdk9.toXOnly)(
2658
2646
  import_base10.hex.decode((0, import_sdk9.resolveEmulatorPubkey)(network, params.emulatorPubkey)),
2659
2647
  "emulator signer key"
2660
2648
  ),
@@ -4182,6 +4170,7 @@ async function lockupTxids(indexer, record, wantFunding) {
4182
4170
  LIGHTNING_BTC,
4183
4171
  LIGHTNING_RECEIVE_PAIR,
4184
4172
  LIGHTNING_SEND_PAIR,
4173
+ LOCKTIME_THRESHOLD,
4185
4174
  LockupAmountMismatchError,
4186
4175
  LockupContractMissing,
4187
4176
  LockupNeedsRecoveryError,
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ProvisionedKey, ProvisionedClaimSecret, asset, IWallet, arkade, RestIndexerProvider, Transaction, IContractManager, VHTLC, Identity, ActivityResolver } from '@arkade-os/sdk';
2
- import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry, b as RefundArkProvider, c as RefundIndexer, L as LockupVtxo, d as RfqSwap, e as ArkadeRefundResult, f as LockupSpendIndexer, g as RfqSwapState } from './repository-Dso34L4D.cjs';
3
- export { h as AssetSwapStatus, i as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, j as LightningReceiveSwap, k as LightningSendSwap, l as LockupFate, m as LockupNeedsRecoveryError, n as LockupParams, o as LockupSpend, O as OnchainSendAction, p as OnchainSendSwap, P as PersistableRfqSwap, q as PreimageBlockedReason, r as PreimageNotRecoverableError, s as REFUND_MTP_LAG_SECONDS, t as RFQ_RESOLVED_STATES, u as RFQ_SWAP_RETENTION_SECONDS, v as RFQ_SWAP_TERMINAL_STATES, w as RefundOutcome, x as RfqRestoreFailure, y as RfqRestoreOptions, z as RfqRestoreResult, C as RfqSwapActionName, D as RfqSwapLockup, E as RfqSwapManager, F as RfqSwapManagerCallbacks, G as RfqSwapManagerConfig, H as RfqSwapManagerDeps, J as RfqSwapManagerEvents, K as RfqSwapOrigin, N as RfqSwapOriginRequired, Q as RfqSwapOutcome, T as RfqSwapRecordStore, U as SwapContractRegistry, V as addAssetSwap, W as awaitRfqResolution, X as createRfqSwapRecord, Y as findLockupVtxos, Z as getAssetSwaps, _ as getAssetSwapsOrThrow, $ as isRfqSwapTerminal, a0 as isRfqTerminal, a1 as nextOnchainAction, a2 as preimageForSwapRecord, a3 as pushRefundWithoutReceiver, a4 as readLockupFate, a5 as rebuildRfqSwap, a6 as refundIfUnresolved, a7 as rfqSwapOriginOf, a8 as shouldRetainRfqSwap, a9 as swapSecretsToRecord, aa as updateAssetSwap, ab as updateAssetSwapBestEffort, ac as updateRfqSwapRecord } from './repository-Dso34L4D.cjs';
2
+ import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry, b as RefundArkProvider, c as RefundIndexer, L as LockupVtxo, d as RfqSwap, e as ArkadeRefundResult, f as LockupSpendIndexer, g as RfqSwapState } from './repository-DEHLtD9l.cjs';
3
+ export { h as AssetSwapStatus, i as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, j as LightningReceiveSwap, k as LightningSendSwap, l as LockupFate, m as LockupNeedsRecoveryError, n as LockupParams, o as LockupSpend, O as OnchainSendAction, p as OnchainSendSwap, P as PersistableRfqSwap, q as PreimageBlockedReason, r as PreimageNotRecoverableError, s as REFUND_MTP_LAG_SECONDS, t as RFQ_RESOLVED_STATES, u as RFQ_SWAP_RETENTION_SECONDS, v as RFQ_SWAP_TERMINAL_STATES, w as RefundOutcome, x as RfqRestoreFailure, y as RfqRestoreOptions, z as RfqRestoreResult, C as RfqSwapActionName, D as RfqSwapLockup, E as RfqSwapManager, F as RfqSwapManagerCallbacks, G as RfqSwapManagerConfig, H as RfqSwapManagerDeps, J as RfqSwapManagerEvents, K as RfqSwapOrigin, N as RfqSwapOriginRequired, Q as RfqSwapOutcome, T as RfqSwapRecordStore, U as SwapContractRegistry, V as addAssetSwap, W as awaitRfqResolution, X as createRfqSwapRecord, Y as findLockupVtxos, Z as getAssetSwaps, _ as getAssetSwapsOrThrow, $ as isRfqSwapTerminal, a0 as isRfqTerminal, a1 as nextOnchainAction, a2 as preimageForSwapRecord, a3 as pushRefundWithoutReceiver, a4 as readLockupFate, a5 as rebuildRfqSwap, a6 as refundIfUnresolved, a7 as rfqSwapOriginOf, a8 as shouldRetainRfqSwap, a9 as swapSecretsToRecord, aa as updateAssetSwap, ab as updateAssetSwapBestEffort, ac as updateRfqSwapRecord } from './repository-DEHLtD9l.cjs';
4
4
  import { Network, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
5
- import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams } from './rfq-C-aq5LDJ.cjs';
6
- export { A as ARKADE_ASSET, c as ARKADE_BTC, d as AddressMismatch, C as ChainSource, e as ChainUtxo, H as HtlcUtxo, I as InvoiceFacts, L as LIGHTNING_BTC, f as LIGHTNING_RECEIVE_PAIR, g as LIGHTNING_SEND_PAIR, h as LightningReceiveTreeParams, i as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, j as MIN_CLAIM_WINDOW_SECONDS, k as MIN_HEADROOM_SECONDS, l as ONCHAIN_BTC, m as ONCHAIN_CLAIM_MARGIN_SECONDS, n as ONCHAIN_DUST_SATS, o as ONCHAIN_ORDER_MARGIN_SECONDS, p as ONCHAIN_RECEIVE_PAIR, q as ONCHAIN_SECONDS_PER_BLOCK, r as ONCHAIN_SEND_PAIR, s as OnchainHtlcPhase, R as RFQ_TERMINAL_STATES, t as RelaySocket, u as RfqQuote, v as RfqRefusalReason, w as RfqStatus, x as RfqTransport, S as SOLO_REFUND_HEADROOM_SECONDS, y as SwapRefusal, z as arkadeAssetLeg, B as arkadeSwapRequest, D as assertFundable, E as assertReceivable, F as awaitOnchainFill, G as buildHtlcClaim, J as buildHtlcRefund, K as claimOnchainFill, N as classifyOnchainHtlc, P as deriveLightningReceive, Q as deriveOnchainReceive, T as deriveOnchainSend, U as extractPreimage, V as httpTransport, W as lightningReceiveRequest, X as lightningSendRequest, Y as lightningSendVtxoScript, Z as newPreimage, _ as newRfqId, $ as offerTermsFromQuote, a0 as onchainHtlcScript, a1 as onchainReceiveRequest, a2 as onchainSendRequest, a3 as paymentHashOf, a4 as receiveVtxoScript, a5 as relayTransport, a6 as requestLightningReceive, a7 as requestLightningSend, a8 as requestOnchainReceive, a9 as requestOnchainSend, aa as rfqPair, ab as unilateralClaimDelay, ac as unilateralRefundDelay, ad as unilateralRefundWithoutReceiverDelay, ae as verifyLockupAddress, af as verifyReceiveInvoice } from './rfq-C-aq5LDJ.cjs';
5
+ import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams } from './rfq-hbzhTWHT.cjs';
6
+ export { A as ARKADE_ASSET, c as ARKADE_BTC, d as AddressMismatch, C as ChainSource, e as ChainUtxo, H as HtlcUtxo, I as InvoiceFacts, L as LIGHTNING_BTC, f as LIGHTNING_RECEIVE_PAIR, g as LIGHTNING_SEND_PAIR, h as LOCKTIME_THRESHOLD, i as LightningReceiveTreeParams, j as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, k as MIN_CLAIM_WINDOW_SECONDS, l as MIN_HEADROOM_SECONDS, m as ONCHAIN_BTC, n as ONCHAIN_CLAIM_MARGIN_SECONDS, o as ONCHAIN_DUST_SATS, p as ONCHAIN_ORDER_MARGIN_SECONDS, q as ONCHAIN_RECEIVE_PAIR, r as ONCHAIN_SECONDS_PER_BLOCK, s as ONCHAIN_SEND_PAIR, t as OnchainHtlcPhase, R as RFQ_TERMINAL_STATES, u as RelaySocket, v as RfqQuote, w as RfqRefusalReason, x as RfqStatus, y as RfqTransport, S as SOLO_REFUND_HEADROOM_SECONDS, z as SwapRefusal, B as arkadeAssetLeg, D as arkadeSwapRequest, E as assertFundable, F as assertReceivable, G as awaitOnchainFill, J as buildHtlcClaim, K as buildHtlcRefund, N as claimOnchainFill, P as classifyOnchainHtlc, Q as deriveLightningReceive, T as deriveOnchainReceive, U as deriveOnchainSend, V as extractPreimage, W as httpTransport, X as lightningReceiveRequest, Y as lightningSendRequest, Z as lightningSendVtxoScript, _ as newPreimage, $ as newRfqId, a0 as offerTermsFromQuote, a1 as onchainHtlcScript, a2 as onchainReceiveRequest, a3 as onchainSendRequest, a4 as paymentHashOf, a5 as receiveVtxoScript, a6 as relayTransport, a7 as requestLightningReceive, a8 as requestLightningSend, a9 as requestOnchainReceive, aa as requestOnchainSend, ab as rfqPair, ac as unilateralClaimDelay, ad as unilateralRefundDelay, ae as unilateralRefundWithoutReceiverDelay, af as verifyLockupAddress, ag as verifyReceiveInvoice } from './rfq-hbzhTWHT.cjs';
7
7
 
8
8
  /**
9
9
  * Which wallet key signs this leg. Stored at `profile.signer`.
@@ -633,7 +633,7 @@ interface ClaimPacketInput {
633
633
  covclaimdPubkey: Uint8Array;
634
634
  }
635
635
  /**
636
- * Seal a preimage to covclaimd. WebCrypto AES-GCM, hence async.
636
+ * Seal a preimage to covclaimd.
637
637
  *
638
638
  * The ephemeral key and nonce are generated here and CANNOT be supplied by a
639
639
  * caller. That is the point of this signature: AES-GCM under a repeated
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ProvisionedKey, ProvisionedClaimSecret, asset, IWallet, arkade, RestIndexerProvider, Transaction, IContractManager, VHTLC, Identity, ActivityResolver } from '@arkade-os/sdk';
2
- import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry, b as RefundArkProvider, c as RefundIndexer, L as LockupVtxo, d as RfqSwap, e as ArkadeRefundResult, f as LockupSpendIndexer, g as RfqSwapState } from './repository-BcZ9LXRP.js';
3
- export { h as AssetSwapStatus, i as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, j as LightningReceiveSwap, k as LightningSendSwap, l as LockupFate, m as LockupNeedsRecoveryError, n as LockupParams, o as LockupSpend, O as OnchainSendAction, p as OnchainSendSwap, P as PersistableRfqSwap, q as PreimageBlockedReason, r as PreimageNotRecoverableError, s as REFUND_MTP_LAG_SECONDS, t as RFQ_RESOLVED_STATES, u as RFQ_SWAP_RETENTION_SECONDS, v as RFQ_SWAP_TERMINAL_STATES, w as RefundOutcome, x as RfqRestoreFailure, y as RfqRestoreOptions, z as RfqRestoreResult, C as RfqSwapActionName, D as RfqSwapLockup, E as RfqSwapManager, F as RfqSwapManagerCallbacks, G as RfqSwapManagerConfig, H as RfqSwapManagerDeps, J as RfqSwapManagerEvents, K as RfqSwapOrigin, N as RfqSwapOriginRequired, Q as RfqSwapOutcome, T as RfqSwapRecordStore, U as SwapContractRegistry, V as addAssetSwap, W as awaitRfqResolution, X as createRfqSwapRecord, Y as findLockupVtxos, Z as getAssetSwaps, _ as getAssetSwapsOrThrow, $ as isRfqSwapTerminal, a0 as isRfqTerminal, a1 as nextOnchainAction, a2 as preimageForSwapRecord, a3 as pushRefundWithoutReceiver, a4 as readLockupFate, a5 as rebuildRfqSwap, a6 as refundIfUnresolved, a7 as rfqSwapOriginOf, a8 as shouldRetainRfqSwap, a9 as swapSecretsToRecord, aa as updateAssetSwap, ab as updateAssetSwapBestEffort, ac as updateRfqSwapRecord } from './repository-BcZ9LXRP.js';
2
+ import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry, b as RefundArkProvider, c as RefundIndexer, L as LockupVtxo, d as RfqSwap, e as ArkadeRefundResult, f as LockupSpendIndexer, g as RfqSwapState } from './repository-DIAr5XYk.js';
3
+ export { h as AssetSwapStatus, i as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, j as LightningReceiveSwap, k as LightningSendSwap, l as LockupFate, m as LockupNeedsRecoveryError, n as LockupParams, o as LockupSpend, O as OnchainSendAction, p as OnchainSendSwap, P as PersistableRfqSwap, q as PreimageBlockedReason, r as PreimageNotRecoverableError, s as REFUND_MTP_LAG_SECONDS, t as RFQ_RESOLVED_STATES, u as RFQ_SWAP_RETENTION_SECONDS, v as RFQ_SWAP_TERMINAL_STATES, w as RefundOutcome, x as RfqRestoreFailure, y as RfqRestoreOptions, z as RfqRestoreResult, C as RfqSwapActionName, D as RfqSwapLockup, E as RfqSwapManager, F as RfqSwapManagerCallbacks, G as RfqSwapManagerConfig, H as RfqSwapManagerDeps, J as RfqSwapManagerEvents, K as RfqSwapOrigin, N as RfqSwapOriginRequired, Q as RfqSwapOutcome, T as RfqSwapRecordStore, U as SwapContractRegistry, V as addAssetSwap, W as awaitRfqResolution, X as createRfqSwapRecord, Y as findLockupVtxos, Z as getAssetSwaps, _ as getAssetSwapsOrThrow, $ as isRfqSwapTerminal, a0 as isRfqTerminal, a1 as nextOnchainAction, a2 as preimageForSwapRecord, a3 as pushRefundWithoutReceiver, a4 as readLockupFate, a5 as rebuildRfqSwap, a6 as refundIfUnresolved, a7 as rfqSwapOriginOf, a8 as shouldRetainRfqSwap, a9 as swapSecretsToRecord, aa as updateAssetSwap, ab as updateAssetSwapBestEffort, ac as updateRfqSwapRecord } from './repository-DIAr5XYk.js';
4
4
  import { Network, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
5
- import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams } from './rfq-C-aq5LDJ.js';
6
- export { A as ARKADE_ASSET, c as ARKADE_BTC, d as AddressMismatch, C as ChainSource, e as ChainUtxo, H as HtlcUtxo, I as InvoiceFacts, L as LIGHTNING_BTC, f as LIGHTNING_RECEIVE_PAIR, g as LIGHTNING_SEND_PAIR, h as LightningReceiveTreeParams, i as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, j as MIN_CLAIM_WINDOW_SECONDS, k as MIN_HEADROOM_SECONDS, l as ONCHAIN_BTC, m as ONCHAIN_CLAIM_MARGIN_SECONDS, n as ONCHAIN_DUST_SATS, o as ONCHAIN_ORDER_MARGIN_SECONDS, p as ONCHAIN_RECEIVE_PAIR, q as ONCHAIN_SECONDS_PER_BLOCK, r as ONCHAIN_SEND_PAIR, s as OnchainHtlcPhase, R as RFQ_TERMINAL_STATES, t as RelaySocket, u as RfqQuote, v as RfqRefusalReason, w as RfqStatus, x as RfqTransport, S as SOLO_REFUND_HEADROOM_SECONDS, y as SwapRefusal, z as arkadeAssetLeg, B as arkadeSwapRequest, D as assertFundable, E as assertReceivable, F as awaitOnchainFill, G as buildHtlcClaim, J as buildHtlcRefund, K as claimOnchainFill, N as classifyOnchainHtlc, P as deriveLightningReceive, Q as deriveOnchainReceive, T as deriveOnchainSend, U as extractPreimage, V as httpTransport, W as lightningReceiveRequest, X as lightningSendRequest, Y as lightningSendVtxoScript, Z as newPreimage, _ as newRfqId, $ as offerTermsFromQuote, a0 as onchainHtlcScript, a1 as onchainReceiveRequest, a2 as onchainSendRequest, a3 as paymentHashOf, a4 as receiveVtxoScript, a5 as relayTransport, a6 as requestLightningReceive, a7 as requestLightningSend, a8 as requestOnchainReceive, a9 as requestOnchainSend, aa as rfqPair, ab as unilateralClaimDelay, ac as unilateralRefundDelay, ad as unilateralRefundWithoutReceiverDelay, ae as verifyLockupAddress, af as verifyReceiveInvoice } from './rfq-C-aq5LDJ.js';
5
+ import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams } from './rfq-hbzhTWHT.js';
6
+ export { A as ARKADE_ASSET, c as ARKADE_BTC, d as AddressMismatch, C as ChainSource, e as ChainUtxo, H as HtlcUtxo, I as InvoiceFacts, L as LIGHTNING_BTC, f as LIGHTNING_RECEIVE_PAIR, g as LIGHTNING_SEND_PAIR, h as LOCKTIME_THRESHOLD, i as LightningReceiveTreeParams, j as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, k as MIN_CLAIM_WINDOW_SECONDS, l as MIN_HEADROOM_SECONDS, m as ONCHAIN_BTC, n as ONCHAIN_CLAIM_MARGIN_SECONDS, o as ONCHAIN_DUST_SATS, p as ONCHAIN_ORDER_MARGIN_SECONDS, q as ONCHAIN_RECEIVE_PAIR, r as ONCHAIN_SECONDS_PER_BLOCK, s as ONCHAIN_SEND_PAIR, t as OnchainHtlcPhase, R as RFQ_TERMINAL_STATES, u as RelaySocket, v as RfqQuote, w as RfqRefusalReason, x as RfqStatus, y as RfqTransport, S as SOLO_REFUND_HEADROOM_SECONDS, z as SwapRefusal, B as arkadeAssetLeg, D as arkadeSwapRequest, E as assertFundable, F as assertReceivable, G as awaitOnchainFill, J as buildHtlcClaim, K as buildHtlcRefund, N as claimOnchainFill, P as classifyOnchainHtlc, Q as deriveLightningReceive, T as deriveOnchainReceive, U as deriveOnchainSend, V as extractPreimage, W as httpTransport, X as lightningReceiveRequest, Y as lightningSendRequest, Z as lightningSendVtxoScript, _ as newPreimage, $ as newRfqId, a0 as offerTermsFromQuote, a1 as onchainHtlcScript, a2 as onchainReceiveRequest, a3 as onchainSendRequest, a4 as paymentHashOf, a5 as receiveVtxoScript, a6 as relayTransport, a7 as requestLightningReceive, a8 as requestLightningSend, a9 as requestOnchainReceive, aa as requestOnchainSend, ab as rfqPair, ac as unilateralClaimDelay, ad as unilateralRefundDelay, ae as unilateralRefundWithoutReceiverDelay, af as verifyLockupAddress, ag as verifyReceiveInvoice } from './rfq-hbzhTWHT.js';
7
7
 
8
8
  /**
9
9
  * Which wallet key signs this leg. Stored at `profile.signer`.
@@ -633,7 +633,7 @@ interface ClaimPacketInput {
633
633
  covclaimdPubkey: Uint8Array;
634
634
  }
635
635
  /**
636
- * Seal a preimage to covclaimd. WebCrypto AES-GCM, hence async.
636
+ * Seal a preimage to covclaimd.
637
637
  *
638
638
  * The ephemeral key and nonce are generated here and CANNOT be supplied by a
639
639
  * caller. That is the point of this signature: AES-GCM under a repeated
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  LIGHTNING_BTC,
6
6
  LIGHTNING_RECEIVE_PAIR,
7
7
  LIGHTNING_SEND_PAIR,
8
+ LOCKTIME_THRESHOLD,
8
9
  LockupContractMissing,
9
10
  LockupRegistrationFailed,
10
11
  MAX_MIN_CONFIRMATIONS,
@@ -62,7 +63,7 @@ import {
62
63
  unilateralRefundWithoutReceiverDelay,
63
64
  verifyLockupAddress,
64
65
  verifyReceiveInvoice
65
- } from "./chunk-TU4NGZDP.js";
66
+ } from "./chunk-2FEMUOIH.js";
66
67
  import {
67
68
  InMemoryAssetSwapRepository,
68
69
  marketsCacheKey
@@ -2899,6 +2900,7 @@ export {
2899
2900
  LIGHTNING_BTC,
2900
2901
  LIGHTNING_RECEIVE_PAIR,
2901
2902
  LIGHTNING_SEND_PAIR,
2903
+ LOCKTIME_THRESHOLD,
2902
2904
  LockupAmountMismatchError,
2903
2905
  LockupContractMissing,
2904
2906
  LockupNeedsRecoveryError,
package/dist/nostr.cjs CHANGED
@@ -62,6 +62,7 @@ var import_sdk3 = require("@arkade-os/sdk");
62
62
 
63
63
  // src/claimPacket.ts
64
64
  var import_base2 = require("@scure/base");
65
+ var import_aes = require("@noble/ciphers/aes.js");
65
66
  var import_secp256k1 = require("@noble/curves/secp256k1.js");
66
67
  var import_hkdf = require("@noble/hashes/hkdf.js");
67
68
  var import_sha22 = require("@noble/hashes/sha2.js");
package/dist/nostr.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { x as RfqTransport } from './rfq-C-aq5LDJ.cjs';
1
+ import { y as RfqTransport } from './rfq-hbzhTWHT.cjs';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
4
 
package/dist/nostr.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { x as RfqTransport } from './rfq-C-aq5LDJ.js';
1
+ import { y as RfqTransport } from './rfq-hbzhTWHT.js';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
4
 
package/dist/nostr.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  expectQuote,
3
3
  pairOf
4
- } from "./chunk-TU4NGZDP.js";
4
+ } from "./chunk-2FEMUOIH.js";
5
5
 
6
6
  // src/nostr.ts
7
7
  import {
@@ -1,8 +1,8 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-Dso34L4D.cjs';
2
+ import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-DEHLtD9l.cjs';
3
3
  import '@arkade-os/solver-discovery';
4
4
  import '@arkade-os/sdk';
5
- import '../../rfq-C-aq5LDJ.cjs';
5
+ import '../../rfq-hbzhTWHT.cjs';
6
6
 
7
7
  /**
8
8
  * Realm backend for React Native.
@@ -1,8 +1,8 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-BcZ9LXRP.js';
2
+ import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-DIAr5XYk.js';
3
3
  import '@arkade-os/solver-discovery';
4
4
  import '@arkade-os/sdk';
5
- import '../../rfq-C-aq5LDJ.js';
5
+ import '../../rfq-hbzhTWHT.js';
6
6
 
7
7
  /**
8
8
  * Realm backend for React Native.
@@ -1,8 +1,8 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-Dso34L4D.cjs';
2
+ import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-DEHLtD9l.cjs';
3
3
  import '@arkade-os/solver-discovery';
4
4
  import '@arkade-os/sdk';
5
- import '../../rfq-C-aq5LDJ.cjs';
5
+ import '../../rfq-hbzhTWHT.cjs';
6
6
 
7
7
  /**
8
8
  * SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in
@@ -1,8 +1,8 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-BcZ9LXRP.js';
2
+ import { A as AssetSwapRepository, a as AssetSwap, R as RfqSwapRecord, M as MarketsCacheEntry } from '../../repository-DIAr5XYk.js';
3
3
  import '@arkade-os/solver-discovery';
4
4
  import '@arkade-os/sdk';
5
- import '../../rfq-C-aq5LDJ.js';
5
+ import '../../rfq-hbzhTWHT.js';
6
6
 
7
7
  /**
8
8
  * SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in
@@ -1,6 +1,6 @@
1
1
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
2
2
  import { IWallet, ProvisionedKey, ProvisionedClaimSecret, RestArkProvider, RestIndexerProvider, VHTLC, Identity, IContractManager } from '@arkade-os/sdk';
3
- import { w as RfqStatus, x as RfqTransport, a as OnchainHtlc, e as ChainUtxo, C as ChainSource, s as OnchainHtlcPhase } from './rfq-C-aq5LDJ.cjs';
3
+ import { x as RfqStatus, y as RfqTransport, a as OnchainHtlc, e as ChainUtxo, C as ChainSource, t as OnchainHtlcPhase } from './rfq-hbzhTWHT.cjs';
4
4
 
5
5
  type AssetSwapStatus = "pending" | "cancelling" | "fulfilled" | "cancelled" | "recoverable" | "awaiting_fill" | "claimable" | "claimed" | "refunded_l1";
6
6
  /** The sentinel asset id for BTC itself, as opposed to a 68-hex asset id.
@@ -1,6 +1,6 @@
1
1
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
2
2
  import { IWallet, ProvisionedKey, ProvisionedClaimSecret, RestArkProvider, RestIndexerProvider, VHTLC, Identity, IContractManager } from '@arkade-os/sdk';
3
- import { w as RfqStatus, x as RfqTransport, a as OnchainHtlc, e as ChainUtxo, C as ChainSource, s as OnchainHtlcPhase } from './rfq-C-aq5LDJ.js';
3
+ import { x as RfqStatus, y as RfqTransport, a as OnchainHtlc, e as ChainUtxo, C as ChainSource, t as OnchainHtlcPhase } from './rfq-hbzhTWHT.js';
4
4
 
5
5
  type AssetSwapStatus = "pending" | "cancelling" | "fulfilled" | "cancelled" | "recoverable" | "awaiting_fill" | "claimable" | "claimed" | "refunded_l1";
6
6
  /** The sentinel asset id for BTC itself, as opposed to a 68-hex asset id.
@@ -9,6 +9,13 @@ declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
9
9
  declare const ONCHAIN_CLAIM_MARGIN_SECONDS: number;
10
10
  /** Bounds on the confirmation depth a quote may demand. */
11
11
  declare const MAX_MIN_CONFIRMATIONS = 6;
12
+ /**
13
+ * BIP65's boundary between the two things an absolute locktime can mean.
14
+ * Below it consensus reads the value as a block height; at or above it, as a
15
+ * unix timestamp. 500,000,000 itself is 1985-07-05 and is a timestamp, so the
16
+ * comparison against it is strict.
17
+ */
18
+ declare const LOCKTIME_THRESHOLD = 500000000;
12
19
  /** Conservative block interval for converting depths into wall-clock time. */
13
20
  declare const ONCHAIN_SECONDS_PER_BLOCK = 600;
14
21
  /**
@@ -239,7 +246,7 @@ declare const ONCHAIN_SEND_PAIR: string;
239
246
  /** On-board: a Bitcoin-L1 HTLC in, Arkade sats out. */
240
247
  declare const ONCHAIN_RECEIVE_PAIR: string;
241
248
  /** The closed refusal set. Treat any unknown reason as a generic decline. */
242
- type RfqRefusalReason = "unsupported_pair" | "unsupported_payload" | "amount_out_of_range" | "exposure_cap" | "invoice_expired" | "quote_conflict" | "pricing_unavailable";
249
+ type RfqRefusalReason = "unsupported_pair" | "unsupported_payload" | "amount_out_of_range" | "exposure_cap" | "invoice_expired" | "quote_conflict" | "pricing_unavailable" | "rate_limited";
243
250
  /** Lifecycle vocabulary; states after which nothing more will happen. */
244
251
  declare const RFQ_TERMINAL_STATES: readonly ["settled", "refused", "expired", "refunded", "stuck"];
245
252
  /** A refusal from the solver, carrying its closed-set reason. */
@@ -993,4 +1000,4 @@ declare function requestOnchainReceive(wallet: IWallet, arkServerUrl: string, tr
993
1000
  secrets: ProvisionedClaimSecret;
994
1001
  }>;
995
1002
 
996
- export { offerTermsFromQuote as $, ARKADE_ASSET as A, arkadeSwapRequest as B, type ChainSource as C, assertFundable as D, assertReceivable as E, awaitOnchainFill as F, buildHtlcClaim as G, type HtlcUtxo as H, type InvoiceFacts as I, buildHtlcRefund as J, claimOnchainFill as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, classifyOnchainHtlc as N, type OnchainNetwork as O, deriveLightningReceive as P, deriveOnchainReceive as Q, RFQ_TERMINAL_STATES as R, SOLO_REFUND_HEADROOM_SECONDS as S, deriveOnchainSend as T, extractPreimage as U, httpTransport as V, lightningReceiveRequest as W, lightningSendRequest as X, lightningSendVtxoScript as Y, newPreimage as Z, newRfqId as _, type OnchainHtlc as a, onchainHtlcScript as a0, onchainReceiveRequest as a1, onchainSendRequest as a2, paymentHashOf as a3, receiveVtxoScript as a4, relayTransport as a5, requestLightningReceive as a6, requestLightningSend as a7, requestOnchainReceive as a8, requestOnchainSend as a9, rfqPair as aa, unilateralClaimDelay as ab, unilateralRefundDelay as ac, unilateralRefundWithoutReceiverDelay as ad, verifyLockupAddress as ae, verifyReceiveInvoice as af, type OnchainHtlcParams as b, ARKADE_BTC as c, AddressMismatch as d, type ChainUtxo as e, LIGHTNING_RECEIVE_PAIR as f, LIGHTNING_SEND_PAIR as g, type LightningReceiveTreeParams as h, type LightningSendTreeParams as i, MIN_CLAIM_WINDOW_SECONDS as j, MIN_HEADROOM_SECONDS as k, ONCHAIN_BTC as l, ONCHAIN_CLAIM_MARGIN_SECONDS as m, ONCHAIN_DUST_SATS as n, ONCHAIN_ORDER_MARGIN_SECONDS as o, ONCHAIN_RECEIVE_PAIR as p, ONCHAIN_SECONDS_PER_BLOCK as q, ONCHAIN_SEND_PAIR as r, type OnchainHtlcPhase as s, type RelaySocket as t, type RfqQuote as u, type RfqRefusalReason as v, type RfqStatus as w, type RfqTransport as x, SwapRefusal as y, arkadeAssetLeg as z };
1003
+ export { newRfqId as $, ARKADE_ASSET as A, arkadeAssetLeg as B, type ChainSource as C, arkadeSwapRequest as D, assertFundable as E, assertReceivable as F, awaitOnchainFill as G, type HtlcUtxo as H, type InvoiceFacts as I, buildHtlcClaim as J, buildHtlcRefund as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, claimOnchainFill as N, type OnchainNetwork as O, classifyOnchainHtlc as P, deriveLightningReceive as Q, RFQ_TERMINAL_STATES as R, SOLO_REFUND_HEADROOM_SECONDS as S, deriveOnchainReceive as T, deriveOnchainSend as U, extractPreimage as V, httpTransport as W, lightningReceiveRequest as X, lightningSendRequest as Y, lightningSendVtxoScript as Z, newPreimage as _, type OnchainHtlc as a, offerTermsFromQuote as a0, onchainHtlcScript as a1, onchainReceiveRequest as a2, onchainSendRequest as a3, paymentHashOf as a4, receiveVtxoScript as a5, relayTransport as a6, requestLightningReceive as a7, requestLightningSend as a8, requestOnchainReceive as a9, requestOnchainSend as aa, rfqPair as ab, unilateralClaimDelay as ac, unilateralRefundDelay as ad, unilateralRefundWithoutReceiverDelay as ae, verifyLockupAddress as af, verifyReceiveInvoice as ag, type OnchainHtlcParams as b, ARKADE_BTC as c, AddressMismatch as d, type ChainUtxo as e, LIGHTNING_RECEIVE_PAIR as f, LIGHTNING_SEND_PAIR as g, LOCKTIME_THRESHOLD as h, type LightningReceiveTreeParams as i, type LightningSendTreeParams as j, MIN_CLAIM_WINDOW_SECONDS as k, MIN_HEADROOM_SECONDS as l, ONCHAIN_BTC as m, ONCHAIN_CLAIM_MARGIN_SECONDS as n, ONCHAIN_DUST_SATS as o, ONCHAIN_ORDER_MARGIN_SECONDS as p, ONCHAIN_RECEIVE_PAIR as q, ONCHAIN_SECONDS_PER_BLOCK as r, ONCHAIN_SEND_PAIR as s, type OnchainHtlcPhase as t, type RelaySocket as u, type RfqQuote as v, type RfqRefusalReason as w, type RfqStatus as x, type RfqTransport as y, SwapRefusal as z };
@@ -9,6 +9,13 @@ declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
9
9
  declare const ONCHAIN_CLAIM_MARGIN_SECONDS: number;
10
10
  /** Bounds on the confirmation depth a quote may demand. */
11
11
  declare const MAX_MIN_CONFIRMATIONS = 6;
12
+ /**
13
+ * BIP65's boundary between the two things an absolute locktime can mean.
14
+ * Below it consensus reads the value as a block height; at or above it, as a
15
+ * unix timestamp. 500,000,000 itself is 1985-07-05 and is a timestamp, so the
16
+ * comparison against it is strict.
17
+ */
18
+ declare const LOCKTIME_THRESHOLD = 500000000;
12
19
  /** Conservative block interval for converting depths into wall-clock time. */
13
20
  declare const ONCHAIN_SECONDS_PER_BLOCK = 600;
14
21
  /**
@@ -239,7 +246,7 @@ declare const ONCHAIN_SEND_PAIR: string;
239
246
  /** On-board: a Bitcoin-L1 HTLC in, Arkade sats out. */
240
247
  declare const ONCHAIN_RECEIVE_PAIR: string;
241
248
  /** The closed refusal set. Treat any unknown reason as a generic decline. */
242
- type RfqRefusalReason = "unsupported_pair" | "unsupported_payload" | "amount_out_of_range" | "exposure_cap" | "invoice_expired" | "quote_conflict" | "pricing_unavailable";
249
+ type RfqRefusalReason = "unsupported_pair" | "unsupported_payload" | "amount_out_of_range" | "exposure_cap" | "invoice_expired" | "quote_conflict" | "pricing_unavailable" | "rate_limited";
243
250
  /** Lifecycle vocabulary; states after which nothing more will happen. */
244
251
  declare const RFQ_TERMINAL_STATES: readonly ["settled", "refused", "expired", "refunded", "stuck"];
245
252
  /** A refusal from the solver, carrying its closed-set reason. */
@@ -993,4 +1000,4 @@ declare function requestOnchainReceive(wallet: IWallet, arkServerUrl: string, tr
993
1000
  secrets: ProvisionedClaimSecret;
994
1001
  }>;
995
1002
 
996
- export { offerTermsFromQuote as $, ARKADE_ASSET as A, arkadeSwapRequest as B, type ChainSource as C, assertFundable as D, assertReceivable as E, awaitOnchainFill as F, buildHtlcClaim as G, type HtlcUtxo as H, type InvoiceFacts as I, buildHtlcRefund as J, claimOnchainFill as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, classifyOnchainHtlc as N, type OnchainNetwork as O, deriveLightningReceive as P, deriveOnchainReceive as Q, RFQ_TERMINAL_STATES as R, SOLO_REFUND_HEADROOM_SECONDS as S, deriveOnchainSend as T, extractPreimage as U, httpTransport as V, lightningReceiveRequest as W, lightningSendRequest as X, lightningSendVtxoScript as Y, newPreimage as Z, newRfqId as _, type OnchainHtlc as a, onchainHtlcScript as a0, onchainReceiveRequest as a1, onchainSendRequest as a2, paymentHashOf as a3, receiveVtxoScript as a4, relayTransport as a5, requestLightningReceive as a6, requestLightningSend as a7, requestOnchainReceive as a8, requestOnchainSend as a9, rfqPair as aa, unilateralClaimDelay as ab, unilateralRefundDelay as ac, unilateralRefundWithoutReceiverDelay as ad, verifyLockupAddress as ae, verifyReceiveInvoice as af, type OnchainHtlcParams as b, ARKADE_BTC as c, AddressMismatch as d, type ChainUtxo as e, LIGHTNING_RECEIVE_PAIR as f, LIGHTNING_SEND_PAIR as g, type LightningReceiveTreeParams as h, type LightningSendTreeParams as i, MIN_CLAIM_WINDOW_SECONDS as j, MIN_HEADROOM_SECONDS as k, ONCHAIN_BTC as l, ONCHAIN_CLAIM_MARGIN_SECONDS as m, ONCHAIN_DUST_SATS as n, ONCHAIN_ORDER_MARGIN_SECONDS as o, ONCHAIN_RECEIVE_PAIR as p, ONCHAIN_SECONDS_PER_BLOCK as q, ONCHAIN_SEND_PAIR as r, type OnchainHtlcPhase as s, type RelaySocket as t, type RfqQuote as u, type RfqRefusalReason as v, type RfqStatus as w, type RfqTransport as x, SwapRefusal as y, arkadeAssetLeg as z };
1003
+ export { newRfqId as $, ARKADE_ASSET as A, arkadeAssetLeg as B, type ChainSource as C, arkadeSwapRequest as D, assertFundable as E, assertReceivable as F, awaitOnchainFill as G, type HtlcUtxo as H, type InvoiceFacts as I, buildHtlcClaim as J, buildHtlcRefund as K, LIGHTNING_BTC as L, MAX_MIN_CONFIRMATIONS as M, claimOnchainFill as N, type OnchainNetwork as O, classifyOnchainHtlc as P, deriveLightningReceive as Q, RFQ_TERMINAL_STATES as R, SOLO_REFUND_HEADROOM_SECONDS as S, deriveOnchainReceive as T, deriveOnchainSend as U, extractPreimage as V, httpTransport as W, lightningReceiveRequest as X, lightningSendRequest as Y, lightningSendVtxoScript as Z, newPreimage as _, type OnchainHtlc as a, offerTermsFromQuote as a0, onchainHtlcScript as a1, onchainReceiveRequest as a2, onchainSendRequest as a3, paymentHashOf as a4, receiveVtxoScript as a5, relayTransport as a6, requestLightningReceive as a7, requestLightningSend as a8, requestOnchainReceive as a9, requestOnchainSend as aa, rfqPair as ab, unilateralClaimDelay as ac, unilateralRefundDelay as ad, unilateralRefundWithoutReceiverDelay as ae, verifyLockupAddress as af, verifyReceiveInvoice as ag, type OnchainHtlcParams as b, ARKADE_BTC as c, AddressMismatch as d, type ChainUtxo as e, LIGHTNING_RECEIVE_PAIR as f, LIGHTNING_SEND_PAIR as g, LOCKTIME_THRESHOLD as h, type LightningReceiveTreeParams as i, type LightningSendTreeParams as j, MIN_CLAIM_WINDOW_SECONDS as k, MIN_HEADROOM_SECONDS as l, ONCHAIN_BTC as m, ONCHAIN_CLAIM_MARGIN_SECONDS as n, ONCHAIN_DUST_SATS as o, ONCHAIN_ORDER_MARGIN_SECONDS as p, ONCHAIN_RECEIVE_PAIR as q, ONCHAIN_SECONDS_PER_BLOCK as r, ONCHAIN_SEND_PAIR as s, type OnchainHtlcPhase as t, type RelaySocket as u, type RfqQuote as v, type RfqRefusalReason as w, type RfqStatus as x, type RfqTransport as y, SwapRefusal as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/swap",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "description": "Client-side Arkade Intents asset swaps: discover markets, quote, create/track/cancel offers, restore from chain.",
6
6
  "repository": {
@@ -65,11 +65,12 @@
65
65
  "license": "MIT",
66
66
  "dependencies": {
67
67
  "@arkade-os/solver-discovery": "0.2.3",
68
+ "@noble/ciphers": "2.1.1",
68
69
  "@noble/curves": "2.0.1",
69
70
  "@noble/hashes": "2.0.1",
70
71
  "@scure/base": "2.0.0",
71
72
  "@scure/btc-signer": "2.0.1",
72
- "@arkade-os/sdk": "0.4.65"
73
+ "@arkade-os/sdk": "0.4.66"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "nostr-tools": "^2.12.0"