@arkade-os/swap 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -24
- package/dist/{chunk-6ZUS47GA.js → chunk-PJF4DWD7.js} +31 -0
- package/dist/index.cjs +262 -46
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +235 -48
- package/dist/repositories/realm/index.cjs +43 -0
- package/dist/repositories/realm/index.d.cts +3 -1
- package/dist/repositories/realm/index.d.ts +3 -1
- package/dist/repositories/realm/index.js +33 -1
- package/dist/repositories/sqlite/index.cjs +39 -0
- package/dist/repositories/sqlite/index.d.cts +3 -1
- package/dist/repositories/sqlite/index.d.ts +3 -1
- package/dist/repositories/sqlite/index.js +29 -1
- package/dist/{repository-PNlTFdsj.d.ts → repository-BT33JsPT.d.ts} +47 -28
- package/dist/{repository-CZYc8Y38.d.cts → repository-CSBh-0NH.d.cts} +47 -28
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -65,6 +65,8 @@ __export(index_exports, {
|
|
|
65
65
|
REFUND_MTP_LAG_SECONDS: () => REFUND_MTP_LAG_SECONDS,
|
|
66
66
|
RFQ_REFUSAL_ERROR_CODES: () => RFQ_REFUSAL_ERROR_CODES,
|
|
67
67
|
RFQ_RESOLVED_STATES: () => RFQ_RESOLVED_STATES,
|
|
68
|
+
RFQ_SWAP_ACTIVE_STATES: () => RFQ_SWAP_ACTIVE_STATES,
|
|
69
|
+
RFQ_SWAP_MAX_PAGE_SIZE: () => RFQ_SWAP_MAX_PAGE_SIZE,
|
|
68
70
|
RFQ_SWAP_RETENTION_SECONDS: () => RFQ_SWAP_RETENTION_SECONDS,
|
|
69
71
|
RFQ_SWAP_TERMINAL_STATES: () => RFQ_SWAP_TERMINAL_STATES,
|
|
70
72
|
RFQ_TERMINAL_STATES: () => RFQ_TERMINAL_STATES,
|
|
@@ -169,6 +171,8 @@ __export(index_exports, {
|
|
|
169
171
|
rfqSecretsProfile: () => rfqSecretsProfile,
|
|
170
172
|
rfqSignerOf: () => rfqSignerOf,
|
|
171
173
|
rfqSwapActivityInputs: () => rfqSwapActivityInputs,
|
|
174
|
+
rfqSwapActivityInputsPage: () => rfqSwapActivityInputsPage,
|
|
175
|
+
rfqSwapActivityInputsSincePage: () => rfqSwapActivityInputsSincePage,
|
|
172
176
|
rfqSwapOriginOf: () => rfqSwapOriginOf,
|
|
173
177
|
sealClaimPacket: () => sealClaimPacket,
|
|
174
178
|
senderIdentityForSwapRecord: () => senderIdentityForSwapRecord,
|
|
@@ -1147,6 +1151,19 @@ var validatePlan = (plan, giveBalance, dust) => {
|
|
|
1147
1151
|
};
|
|
1148
1152
|
|
|
1149
1153
|
// src/repository.ts
|
|
1154
|
+
var RFQ_SWAP_MAX_PAGE_SIZE = 500;
|
|
1155
|
+
function assertRfqSwapPageLimit(limit) {
|
|
1156
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > RFQ_SWAP_MAX_PAGE_SIZE) {
|
|
1157
|
+
throw new RangeError(
|
|
1158
|
+
`RFQ swap page limit must be an integer from 1 to ${RFQ_SWAP_MAX_PAGE_SIZE}`
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function assertRfqSwapSince(since) {
|
|
1163
|
+
if (!Number.isSafeInteger(since) || since < 0) {
|
|
1164
|
+
throw new RangeError("RFQ history since must be a non-negative Unix timestamp in seconds");
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1150
1167
|
var marketsCacheKey = (network, registry) => `arkade-intents-markets-${network}-${registry}`;
|
|
1151
1168
|
var InMemoryAssetSwapRepository = class {
|
|
1152
1169
|
version = 4;
|
|
@@ -1169,6 +1186,21 @@ var InMemoryAssetSwapRepository = class {
|
|
|
1169
1186
|
async getAllRfqSwaps() {
|
|
1170
1187
|
return [...this.rfqSwaps.values()];
|
|
1171
1188
|
}
|
|
1189
|
+
async getRfqSwapsPage(state, afterId, limit) {
|
|
1190
|
+
assertRfqSwapPageLimit(limit);
|
|
1191
|
+
return [...this.rfqSwaps.values()].filter(
|
|
1192
|
+
(record) => record.state === state && (afterId === void 0 || record.rfqId > afterId)
|
|
1193
|
+
).sort((a, b) => a.rfqId < b.rfqId ? -1 : a.rfqId > b.rfqId ? 1 : 0).slice(0, limit);
|
|
1194
|
+
}
|
|
1195
|
+
async getRfqSwapsUpdatedPage(state, since, after, limit) {
|
|
1196
|
+
assertRfqSwapPageLimit(limit);
|
|
1197
|
+
assertRfqSwapSince(since);
|
|
1198
|
+
return [...this.rfqSwaps.values()].filter(
|
|
1199
|
+
(record) => record.state === state && record.updatedAt >= since && (!after || record.updatedAt > after.updatedAt || record.updatedAt === after.updatedAt && record.rfqId > after.rfqId)
|
|
1200
|
+
).sort(
|
|
1201
|
+
(a, b) => a.updatedAt - b.updatedAt || (a.rfqId < b.rfqId ? -1 : a.rfqId > b.rfqId ? 1 : 0)
|
|
1202
|
+
).slice(0, limit);
|
|
1203
|
+
}
|
|
1172
1204
|
async removeRfqSwap(rfqId) {
|
|
1173
1205
|
this.rfqSwaps.delete(rfqId);
|
|
1174
1206
|
}
|
|
@@ -1197,11 +1229,13 @@ var InMemoryAssetSwapRepository = class {
|
|
|
1197
1229
|
// src/indexedDbRepository.ts
|
|
1198
1230
|
var import_sdk4 = require("@arkade-os/sdk");
|
|
1199
1231
|
var DEFAULT_DB_NAME = "arkade-intents";
|
|
1200
|
-
var DB_VERSION =
|
|
1232
|
+
var DB_VERSION = 3;
|
|
1201
1233
|
var STORE_SWAPS = "swaps";
|
|
1202
1234
|
var STORE_RFQ_SWAPS = "rfqSwaps";
|
|
1203
1235
|
var STORE_SCANNED = "scannedTxids";
|
|
1204
1236
|
var STORE_MARKETS = "markets";
|
|
1237
|
+
var HISTORY_INDEX = "byStateUpdatedAtAndRfqId";
|
|
1238
|
+
var PAGE_INDEX = "byStateAndRfqId";
|
|
1205
1239
|
var STORES = [
|
|
1206
1240
|
[STORE_SWAPS, { keyPath: "id" }],
|
|
1207
1241
|
// v2. Separate from `swaps` rather than sharing it: the two record types
|
|
@@ -1212,10 +1246,16 @@ var STORES = [
|
|
|
1212
1246
|
];
|
|
1213
1247
|
function initDatabase(db, oldVersion, transaction) {
|
|
1214
1248
|
void oldVersion;
|
|
1215
|
-
void transaction;
|
|
1216
1249
|
for (const [name, options] of STORES) {
|
|
1217
1250
|
if (!db.objectStoreNames.contains(name)) db.createObjectStore(name, options);
|
|
1218
1251
|
}
|
|
1252
|
+
const rfq = transaction?.objectStore(STORE_RFQ_SWAPS);
|
|
1253
|
+
if (rfq && !rfq.indexNames.contains(HISTORY_INDEX)) {
|
|
1254
|
+
rfq.createIndex(HISTORY_INDEX, ["state", "updatedAt", "rfqId"]);
|
|
1255
|
+
}
|
|
1256
|
+
if (rfq && !rfq.indexNames.contains(PAGE_INDEX)) {
|
|
1257
|
+
rfq.createIndex(PAGE_INDEX, ["state", "rfqId"]);
|
|
1258
|
+
}
|
|
1219
1259
|
}
|
|
1220
1260
|
var IndexedDbAssetSwapRepository = class {
|
|
1221
1261
|
version = 4;
|
|
@@ -1257,6 +1297,28 @@ var IndexedDbAssetSwapRepository = class {
|
|
|
1257
1297
|
async getAllRfqSwaps() {
|
|
1258
1298
|
return (0, import_sdk4.promisifyRequest)((await this.readStore(STORE_RFQ_SWAPS)).getAll());
|
|
1259
1299
|
}
|
|
1300
|
+
async getRfqSwapsPage(state, afterId, limit) {
|
|
1301
|
+
assertRfqSwapPageLimit(limit);
|
|
1302
|
+
const range = IDBKeyRange.bound(
|
|
1303
|
+
[state, afterId ?? ""],
|
|
1304
|
+
[state, "\uFFFF"],
|
|
1305
|
+
afterId !== void 0
|
|
1306
|
+
);
|
|
1307
|
+
const index = (await this.readStore(STORE_RFQ_SWAPS)).index(PAGE_INDEX);
|
|
1308
|
+
return (0, import_sdk4.promisifyRequest)(index.getAll(range, limit));
|
|
1309
|
+
}
|
|
1310
|
+
async getRfqSwapsUpdatedPage(state, since, after, limit) {
|
|
1311
|
+
assertRfqSwapPageLimit(limit);
|
|
1312
|
+
assertRfqSwapSince(since);
|
|
1313
|
+
const useCursor = after !== void 0 && after.updatedAt >= since;
|
|
1314
|
+
const range = IDBKeyRange.bound(
|
|
1315
|
+
useCursor ? [state, after.updatedAt, after.rfqId] : [state, since, ""],
|
|
1316
|
+
[state, Number.MAX_SAFE_INTEGER, "\uFFFF"],
|
|
1317
|
+
useCursor
|
|
1318
|
+
);
|
|
1319
|
+
const index = (await this.readStore(STORE_RFQ_SWAPS)).index(HISTORY_INDEX);
|
|
1320
|
+
return (0, import_sdk4.promisifyRequest)(index.getAll(range, limit));
|
|
1321
|
+
}
|
|
1260
1322
|
async removeRfqSwap(rfqId) {
|
|
1261
1323
|
await this.write(STORE_RFQ_SWAPS, (store) => {
|
|
1262
1324
|
store.delete(rfqId);
|
|
@@ -2070,6 +2132,12 @@ var import_base6 = require("@scure/base");
|
|
|
2070
2132
|
|
|
2071
2133
|
// src/rfqSwapState.ts
|
|
2072
2134
|
var RFQ_SWAP_TERMINAL_STATES = ["settled", "refunded", "failed"];
|
|
2135
|
+
var RFQ_SWAP_ACTIVE_STATES = [
|
|
2136
|
+
"pending",
|
|
2137
|
+
"claimable",
|
|
2138
|
+
"claimed",
|
|
2139
|
+
"needs_counterparty"
|
|
2140
|
+
];
|
|
2073
2141
|
var isRfqSwapTerminal = (state) => RFQ_SWAP_TERMINAL_STATES.includes(state);
|
|
2074
2142
|
|
|
2075
2143
|
// src/rfqRecord.ts
|
|
@@ -4212,7 +4280,7 @@ async function findLockupVtxos(contracts, swapPkScript) {
|
|
|
4212
4280
|
const out = [];
|
|
4213
4281
|
for (const vtxo of row?.vtxos ?? []) {
|
|
4214
4282
|
if (vtxo.isUnrolled) continue;
|
|
4215
|
-
if ((0, import_sdk16.
|
|
4283
|
+
if ((0, import_sdk16.isVtxoSpent)(vtxo)) continue;
|
|
4216
4284
|
const key = `${vtxo.txid}:${vtxo.vout}`;
|
|
4217
4285
|
if (seen.has(key)) continue;
|
|
4218
4286
|
seen.add(key);
|
|
@@ -4236,7 +4304,7 @@ async function readLockupFate(indexer, input) {
|
|
|
4236
4304
|
const { vtxos } = await indexer.getVtxos({ scripts: [import_base14.hex.encode(input.swapPkScript)] });
|
|
4237
4305
|
const all = vtxos ?? [];
|
|
4238
4306
|
if (all.length === 0) return { fate: "unknown" };
|
|
4239
|
-
const exited = all.filter((vtxo) => vtxo.isUnrolled && !(0, import_sdk16.
|
|
4307
|
+
const exited = all.filter((vtxo) => vtxo.isUnrolled && !(0, import_sdk16.isVtxoSpent)(vtxo));
|
|
4240
4308
|
if (exited.length > 0) {
|
|
4241
4309
|
return {
|
|
4242
4310
|
fate: "exited",
|
|
@@ -4246,7 +4314,7 @@ async function readLockupFate(indexer, input) {
|
|
|
4246
4314
|
const spentBy = /* @__PURE__ */ new Map();
|
|
4247
4315
|
let everySpendNamed = true;
|
|
4248
4316
|
for (const vtxo of all) {
|
|
4249
|
-
if (!(0, import_sdk16.
|
|
4317
|
+
if (!(0, import_sdk16.isVtxoSpent)(vtxo)) return { fate: "open" };
|
|
4250
4318
|
if (vtxo.spentBy)
|
|
4251
4319
|
spentBy.set(vtxo.spentBy, {
|
|
4252
4320
|
checkpointTxid: vtxo.spentBy,
|
|
@@ -4580,7 +4648,8 @@ var notify = (listeners, call) => {
|
|
|
4580
4648
|
}
|
|
4581
4649
|
}
|
|
4582
4650
|
};
|
|
4583
|
-
var RfqSwapManager = class {
|
|
4651
|
+
var RfqSwapManager = class _RfqSwapManager {
|
|
4652
|
+
static POLL_CONCURRENCY = 16;
|
|
4584
4653
|
deps;
|
|
4585
4654
|
config;
|
|
4586
4655
|
callbacks = null;
|
|
@@ -4645,9 +4714,12 @@ var RfqSwapManager = class {
|
|
|
4645
4714
|
claimedOutpoints = /* @__PURE__ */ new Map();
|
|
4646
4715
|
/** Live `onContractEvent` subscription, held so `stop()` can drop it. */
|
|
4647
4716
|
unsubscribeContracts = null;
|
|
4648
|
-
/**
|
|
4649
|
-
* answers instead of throwing "not found". Cleared by {@link removeSwap}. */
|
|
4717
|
+
/** Recent terminal swaps; older durable outcomes are read from the record store on demand. */
|
|
4650
4718
|
finished = /* @__PURE__ */ new Map();
|
|
4719
|
+
/** Explicit removals stay suppressed for this manager lifetime; normal completions never enter this set.
|
|
4720
|
+
* Each maps to its removal sequence, so restore can tell a removal made during its rebuild. */
|
|
4721
|
+
removed = /* @__PURE__ */ new Map();
|
|
4722
|
+
removalSeq = 0;
|
|
4651
4723
|
waiters = /* @__PURE__ */ new Map();
|
|
4652
4724
|
/**
|
|
4653
4725
|
* The request-time origin of each swap the manager may have to CREATE a
|
|
@@ -4666,6 +4738,8 @@ var RfqSwapManager = class {
|
|
|
4666
4738
|
dirty = /* @__PURE__ */ new Set();
|
|
4667
4739
|
/** Race guard: one action at a time per swap. */
|
|
4668
4740
|
inProgress = /* @__PURE__ */ new Set();
|
|
4741
|
+
activePolls = 0;
|
|
4742
|
+
pollWaiters = /* @__PURE__ */ new Set();
|
|
4669
4743
|
timer = null;
|
|
4670
4744
|
running = false;
|
|
4671
4745
|
constructor(deps, config = {}) {
|
|
@@ -4710,8 +4784,7 @@ var RfqSwapManager = class {
|
|
|
4710
4784
|
* Rebuild every stored swap and take over monitoring them.
|
|
4711
4785
|
*
|
|
4712
4786
|
* The composition a consumer otherwise writes by hand, and the one place
|
|
4713
|
-
*
|
|
4714
|
-
* (`shouldRetainRfqSwap`), the lockup's contract row supplies the covenant
|
|
4787
|
+
* three pieces meet: the lockup's contract row supplies the covenant
|
|
4715
4788
|
* (`lockupContractParams`), `rebuildRfqSwap` turns a record back into a
|
|
4716
4789
|
* live swap, and each rebuilt swap arrives with its own origin, so nothing
|
|
4717
4790
|
* is asked of the caller.
|
|
@@ -4721,9 +4794,10 @@ var RfqSwapManager = class {
|
|
|
4721
4794
|
* forced to start driving money to do it. Call this first and `start()`
|
|
4722
4795
|
* after; a manager already running polls the restored swaps at once.
|
|
4723
4796
|
*
|
|
4724
|
-
*
|
|
4725
|
-
*
|
|
4726
|
-
*
|
|
4797
|
+
* The default loads only active states through bounded pages when the
|
|
4798
|
+
* repository supports them. Terminal history stays durable and a late
|
|
4799
|
+
* completion lookup reads one record by key. `includeTerminal` opts into
|
|
4800
|
+
* the previous all-record result when a caller needs it.
|
|
4727
4801
|
*
|
|
4728
4802
|
* **A record that cannot be rebuilt is reported, never swallowed and never
|
|
4729
4803
|
* fatal.** `rebuildRfqSwap` throws by design when the covenant params do
|
|
@@ -4735,13 +4809,12 @@ var RfqSwapManager = class {
|
|
|
4735
4809
|
async restoreFromRepository(options = {}) {
|
|
4736
4810
|
const repository = this.requireRepository("restoreFromRepository");
|
|
4737
4811
|
const params = options.params ?? this.paramsFromContracts();
|
|
4738
|
-
const records = await repository.getAllRfqSwaps();
|
|
4739
|
-
const pruned = await this.dropRetired(repository, records);
|
|
4740
|
-
const retired = new Set(pruned);
|
|
4741
4812
|
const restored = [];
|
|
4742
4813
|
const failed = [];
|
|
4743
|
-
|
|
4744
|
-
if (
|
|
4814
|
+
const restore = async (record) => {
|
|
4815
|
+
if (!options.includeTerminal && isRfqSwapTerminal(record.state)) return;
|
|
4816
|
+
if (this.monitored.has(record.rfqId)) return;
|
|
4817
|
+
const removedAt = this.removed.get(record.rfqId);
|
|
4745
4818
|
let swap;
|
|
4746
4819
|
try {
|
|
4747
4820
|
swap = rebuildRfqSwap(record, await params(record));
|
|
@@ -4750,19 +4823,50 @@ var RfqSwapManager = class {
|
|
|
4750
4823
|
rfqId: record.rfqId,
|
|
4751
4824
|
error: error instanceof Error ? error : new Error(errorMessage(error))
|
|
4752
4825
|
});
|
|
4753
|
-
|
|
4826
|
+
return;
|
|
4827
|
+
}
|
|
4828
|
+
if (this.monitored.has(record.rfqId)) return;
|
|
4829
|
+
if (this.removed.get(record.rfqId) !== removedAt) return;
|
|
4830
|
+
this.removed.delete(record.rfqId);
|
|
4831
|
+
if (isRfqSwapTerminal(swap.state)) this.rememberFinished(swap, true);
|
|
4832
|
+
else {
|
|
4833
|
+
this.origins.set(record.rfqId, rfqSwapOriginOf(record));
|
|
4834
|
+
this.track(swap);
|
|
4754
4835
|
}
|
|
4755
|
-
this.origins.set(record.rfqId, rfqSwapOriginOf(record));
|
|
4756
|
-
if (isRfqSwapTerminal(swap.state)) this.finished.set(swap.rfqId, swap);
|
|
4757
|
-
else this.track(swap);
|
|
4758
4836
|
restored.push(swap);
|
|
4837
|
+
};
|
|
4838
|
+
if (repository.getRfqSwapsPage && !options.includeTerminal) {
|
|
4839
|
+
for (const state of RFQ_SWAP_ACTIVE_STATES) {
|
|
4840
|
+
let afterId;
|
|
4841
|
+
for (; ; ) {
|
|
4842
|
+
const page = await repository.getRfqSwapsPage(state, afterId, 256);
|
|
4843
|
+
if (page.length === 0) break;
|
|
4844
|
+
if (page.length > 256)
|
|
4845
|
+
throw new Error("getRfqSwapsPage exceeded its requested limit");
|
|
4846
|
+
let cursor = afterId ?? "";
|
|
4847
|
+
for (const record of page) {
|
|
4848
|
+
if (record.state !== state || record.rfqId <= cursor) {
|
|
4849
|
+
throw new Error(
|
|
4850
|
+
"getRfqSwapsPage returned an unordered or mismatched page"
|
|
4851
|
+
);
|
|
4852
|
+
}
|
|
4853
|
+
cursor = record.rfqId;
|
|
4854
|
+
await restore(record);
|
|
4855
|
+
}
|
|
4856
|
+
afterId = cursor;
|
|
4857
|
+
if (page.length < 256) break;
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
} else {
|
|
4861
|
+
const records = await repository.getAllRfqSwaps();
|
|
4862
|
+
for (const record of records) {
|
|
4863
|
+
await restore(record);
|
|
4864
|
+
}
|
|
4759
4865
|
}
|
|
4760
4866
|
if (this.running) {
|
|
4761
|
-
await
|
|
4762
|
-
restored.filter((swap) => this.monitored.has(swap.rfqId)).map((swap) => this.pollSwap(swap))
|
|
4763
|
-
);
|
|
4867
|
+
await this.pollMany(restored.filter((swap) => this.monitored.has(swap.rfqId)));
|
|
4764
4868
|
}
|
|
4765
|
-
return { restored, failed, pruned };
|
|
4869
|
+
return { restored, failed, pruned: [] };
|
|
4766
4870
|
}
|
|
4767
4871
|
/**
|
|
4768
4872
|
* Drop stored records that are terminal and past
|
|
@@ -4773,10 +4877,8 @@ var RfqSwapManager = class {
|
|
|
4773
4877
|
* lives in `shouldRetainRfqSwap`, which this defers to rather than
|
|
4774
4878
|
* restating.
|
|
4775
4879
|
*
|
|
4776
|
-
*
|
|
4777
|
-
*
|
|
4778
|
-
* at boot. {@link restoreFromRepository} runs it first, so the boot path
|
|
4779
|
-
* needs no separate call.
|
|
4880
|
+
* This legacy deletion API is explicit; normal restore preserves history.
|
|
4881
|
+
* It loads every stored record: no backend offers indexed deletion for it.
|
|
4780
4882
|
*/
|
|
4781
4883
|
async pruneRetiredSwaps() {
|
|
4782
4884
|
const repository = this.deps.repository;
|
|
@@ -4789,12 +4891,15 @@ var RfqSwapManager = class {
|
|
|
4789
4891
|
for (const record of records) {
|
|
4790
4892
|
if (shouldRetainRfqSwap(record, now)) continue;
|
|
4791
4893
|
await repository.removeRfqSwap(record.rfqId);
|
|
4792
|
-
this.
|
|
4793
|
-
if (!this.monitored.has(record.rfqId)) this.origins.delete(record.rfqId);
|
|
4894
|
+
this.forgetRetired(record.rfqId);
|
|
4794
4895
|
dropped.push(record.rfqId);
|
|
4795
4896
|
}
|
|
4796
4897
|
return dropped;
|
|
4797
4898
|
}
|
|
4899
|
+
forgetRetired(rfqId) {
|
|
4900
|
+
this.finished.delete(rfqId);
|
|
4901
|
+
if (!this.monitored.has(rfqId)) this.origins.delete(rfqId);
|
|
4902
|
+
}
|
|
4798
4903
|
requireRepository(method) {
|
|
4799
4904
|
const repository = this.deps.repository;
|
|
4800
4905
|
if (!repository) {
|
|
@@ -4819,8 +4924,7 @@ var RfqSwapManager = class {
|
|
|
4819
4924
|
/**
|
|
4820
4925
|
* Load records and begin monitoring. Runs one pass immediately — a caller
|
|
4821
4926
|
* resuming after a restart may be well past a deadline already — then
|
|
4822
|
-
* every `pollIntervalMs`.
|
|
4823
|
-
* so {@link waitForSwapCompletion} can answer for them.
|
|
4927
|
+
* every `pollIntervalMs`. Terminal outcomes in a repository are read on demand.
|
|
4824
4928
|
*
|
|
4825
4929
|
* Calling it again while running loads the records and returns rather than
|
|
4826
4930
|
* re-arming — dropping them silently would strand a funded swap on a
|
|
@@ -4837,8 +4941,11 @@ var RfqSwapManager = class {
|
|
|
4837
4941
|
async start(swaps = []) {
|
|
4838
4942
|
for (const swap of swaps) await this.admit(swap);
|
|
4839
4943
|
for (const swap of swaps) {
|
|
4840
|
-
|
|
4841
|
-
|
|
4944
|
+
this.removed.delete(swap.rfqId);
|
|
4945
|
+
if (isRfqSwapTerminal(swap.state)) {
|
|
4946
|
+
this.rememberFinished(swap);
|
|
4947
|
+
this.origins.delete(swap.rfqId);
|
|
4948
|
+
} else this.track(swap);
|
|
4842
4949
|
}
|
|
4843
4950
|
if (this.running) return;
|
|
4844
4951
|
this.running = true;
|
|
@@ -4883,8 +4990,10 @@ var RfqSwapManager = class {
|
|
|
4883
4990
|
*/
|
|
4884
4991
|
async addSwap(swap, origin) {
|
|
4885
4992
|
await this.admit(swap, origin);
|
|
4993
|
+
this.removed.delete(swap.rfqId);
|
|
4886
4994
|
if (isRfqSwapTerminal(swap.state)) {
|
|
4887
|
-
this.
|
|
4995
|
+
this.rememberFinished(swap);
|
|
4996
|
+
this.origins.delete(swap.rfqId);
|
|
4888
4997
|
return;
|
|
4889
4998
|
}
|
|
4890
4999
|
this.track(swap);
|
|
@@ -4920,6 +5029,7 @@ var RfqSwapManager = class {
|
|
|
4920
5029
|
* manager stops driving the swap. Retiring the row is reserved for a swap
|
|
4921
5030
|
* that reached a terminal state, where the lockup is provably done. */
|
|
4922
5031
|
async removeSwap(rfqId) {
|
|
5032
|
+
this.removed.set(rfqId, ++this.removalSeq);
|
|
4923
5033
|
this.untrack(rfqId);
|
|
4924
5034
|
this.finished.delete(rfqId);
|
|
4925
5035
|
this.registered.delete(rfqId);
|
|
@@ -4943,6 +5053,7 @@ var RfqSwapManager = class {
|
|
|
4943
5053
|
async isProcessing(rfqId) {
|
|
4944
5054
|
return this.inProgress.has(rfqId);
|
|
4945
5055
|
}
|
|
5056
|
+
/** `finishedSwaps` counts terminal swaps cached in memory, not those only in the repository. */
|
|
4946
5057
|
async getStats() {
|
|
4947
5058
|
return {
|
|
4948
5059
|
isRunning: this.running,
|
|
@@ -4962,7 +5073,30 @@ var RfqSwapManager = class {
|
|
|
4962
5073
|
* no-op for any swap already being worked on.
|
|
4963
5074
|
*/
|
|
4964
5075
|
async poll() {
|
|
4965
|
-
await
|
|
5076
|
+
await this.pollMany([...this.monitored.values()]);
|
|
5077
|
+
}
|
|
5078
|
+
async pollMany(swaps) {
|
|
5079
|
+
for (let i = 0; i < swaps.length; i += _RfqSwapManager.POLL_CONCURRENCY) {
|
|
5080
|
+
await Promise.allSettled(
|
|
5081
|
+
swaps.slice(i, i + _RfqSwapManager.POLL_CONCURRENCY).map((swap) => this.pollSwap(swap))
|
|
5082
|
+
);
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
async acquirePollSlot() {
|
|
5086
|
+
if (this.activePolls < _RfqSwapManager.POLL_CONCURRENCY) {
|
|
5087
|
+
this.activePolls++;
|
|
5088
|
+
} else {
|
|
5089
|
+
await new Promise((resolve) => this.pollWaiters.add(resolve));
|
|
5090
|
+
}
|
|
5091
|
+
return () => {
|
|
5092
|
+
const next = this.pollWaiters.values().next().value;
|
|
5093
|
+
if (next) {
|
|
5094
|
+
this.pollWaiters.delete(next);
|
|
5095
|
+
next();
|
|
5096
|
+
} else {
|
|
5097
|
+
this.activePolls--;
|
|
5098
|
+
}
|
|
5099
|
+
};
|
|
4966
5100
|
}
|
|
4967
5101
|
/**
|
|
4968
5102
|
* Resolve once this swap's PAYOUT is decided — which for onchain-send is
|
|
@@ -4981,6 +5115,15 @@ var RfqSwapManager = class {
|
|
|
4981
5115
|
*/
|
|
4982
5116
|
async waitForSwapCompletion(rfqId) {
|
|
4983
5117
|
const swap = this.monitored.get(rfqId) ?? this.finished.get(rfqId);
|
|
5118
|
+
if (!swap && !this.removed.has(rfqId) && this.deps.repository) {
|
|
5119
|
+
const record = await this.deps.repository.getRfqSwap(rfqId);
|
|
5120
|
+
if (record && !this.removed.has(rfqId) && isRfqSwapTerminal(record.state)) {
|
|
5121
|
+
if (record.state === "failed") {
|
|
5122
|
+
throw new Error(record.failure ?? `swap ${rfqId} failed`);
|
|
5123
|
+
}
|
|
5124
|
+
return outcomeOfRecord(record);
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
4984
5127
|
if (!swap) throw new Error(`swap ${rfqId} is not monitored`);
|
|
4985
5128
|
if (swap.state === "failed") throw new Error(swap.failure ?? `swap ${rfqId} failed`);
|
|
4986
5129
|
if (isPayoutDecided(swap)) return outcomeOf(swap);
|
|
@@ -5123,16 +5266,21 @@ var RfqSwapManager = class {
|
|
|
5123
5266
|
if (this.inProgress.has(swap.rfqId)) return;
|
|
5124
5267
|
if (!this.monitored.has(swap.rfqId)) return;
|
|
5125
5268
|
this.inProgress.add(swap.rfqId);
|
|
5269
|
+
const release = await this.acquirePollSlot();
|
|
5126
5270
|
try {
|
|
5127
|
-
await this.runPass(swap);
|
|
5271
|
+
if (this.monitored.has(swap.rfqId)) await this.runPass(swap);
|
|
5128
5272
|
} finally {
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5273
|
+
try {
|
|
5274
|
+
const persisted = this.dirty.has(swap.rfqId) ? await this.save(swap) : true;
|
|
5275
|
+
if (persisted) {
|
|
5276
|
+
this.dirty.delete(swap.rfqId);
|
|
5277
|
+
this.settleWaiters(swap);
|
|
5278
|
+
if (isRfqSwapTerminal(swap.state)) this.finalize(swap);
|
|
5279
|
+
}
|
|
5280
|
+
} finally {
|
|
5281
|
+
this.inProgress.delete(swap.rfqId);
|
|
5282
|
+
release();
|
|
5134
5283
|
}
|
|
5135
|
-
this.inProgress.delete(swap.rfqId);
|
|
5136
5284
|
}
|
|
5137
5285
|
}
|
|
5138
5286
|
async runPass(swap) {
|
|
@@ -5559,8 +5707,10 @@ var RfqSwapManager = class {
|
|
|
5559
5707
|
finalize(swap) {
|
|
5560
5708
|
if (!this.monitored.has(swap.rfqId)) return;
|
|
5561
5709
|
this.untrack(swap.rfqId);
|
|
5562
|
-
this.
|
|
5710
|
+
this.rememberFinished(swap, true);
|
|
5563
5711
|
this.retireContract(swap);
|
|
5712
|
+
this.registered.delete(swap.rfqId);
|
|
5713
|
+
this.origins.delete(swap.rfqId);
|
|
5564
5714
|
if (swap.state === "failed") {
|
|
5565
5715
|
notify(
|
|
5566
5716
|
this.swapFailedListeners,
|
|
@@ -5570,6 +5720,10 @@ var RfqSwapManager = class {
|
|
|
5570
5720
|
}
|
|
5571
5721
|
notify(this.swapCompletedListeners, (listener) => listener(swap));
|
|
5572
5722
|
}
|
|
5723
|
+
rememberFinished(swap, durable = false) {
|
|
5724
|
+
if (durable && this.deps.repository) this.finished.delete(swap.rfqId);
|
|
5725
|
+
else this.finished.set(swap.rfqId, swap);
|
|
5726
|
+
}
|
|
5573
5727
|
settleWaiters(swap) {
|
|
5574
5728
|
const waiting = this.waiters.get(swap.rfqId);
|
|
5575
5729
|
if (!waiting) return;
|
|
@@ -5603,6 +5757,14 @@ var outcomeOf = (swap) => {
|
|
|
5603
5757
|
txid: lostReceive ? swap.refundArkTxid : traderClaimTxid(swap) ?? swap.refundArkTxid
|
|
5604
5758
|
};
|
|
5605
5759
|
};
|
|
5760
|
+
var outcomeOfRecord = (record) => {
|
|
5761
|
+
const profileClaim = record.kind === "onchain_send" ? record.profile.claimTxid : record.kind === "lightning_receive" ? record.profile.claimArkTxid : void 0;
|
|
5762
|
+
const claimTxid = typeof profileClaim === "string" ? profileClaim : void 0;
|
|
5763
|
+
return {
|
|
5764
|
+
state: record.state,
|
|
5765
|
+
txid: record.kind === "lightning_receive" && record.state === "refunded" ? record.refundArkTxid : claimTxid ?? record.refundArkTxid
|
|
5766
|
+
};
|
|
5767
|
+
};
|
|
5606
5768
|
var errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
5607
5769
|
var outpointKey = (vtxo) => `${vtxo.txid}:${vtxo.vout}`;
|
|
5608
5770
|
|
|
@@ -5665,6 +5827,56 @@ async function rfqSwapActivityInputs(deps) {
|
|
|
5665
5827
|
const records = await deps.repository.getAllRfqSwaps();
|
|
5666
5828
|
return Promise.all(records.map((record) => activityInputOf(record, deps.indexer)));
|
|
5667
5829
|
}
|
|
5830
|
+
async function rfqSwapActivityInputsPage(deps, state, afterId, limit) {
|
|
5831
|
+
assertRfqSwapPageLimit(limit);
|
|
5832
|
+
const page = deps.repository.getRfqSwapsPage;
|
|
5833
|
+
if (!page) throw new Error("repository does not support paged RFQ activity reads");
|
|
5834
|
+
const records = await page.call(deps.repository, state, afterId, limit);
|
|
5835
|
+
if (records.length > limit) throw new Error("getRfqSwapsPage exceeded its requested limit");
|
|
5836
|
+
let cursor = afterId ?? "";
|
|
5837
|
+
for (const record of records) {
|
|
5838
|
+
if (record.state !== state || record.rfqId <= cursor) {
|
|
5839
|
+
throw new Error("getRfqSwapsPage returned an unordered or mismatched page");
|
|
5840
|
+
}
|
|
5841
|
+
cursor = record.rfqId;
|
|
5842
|
+
}
|
|
5843
|
+
const inputs = await projectActivityInputs(records, deps.indexer);
|
|
5844
|
+
return {
|
|
5845
|
+
inputs,
|
|
5846
|
+
...records.length === limit && records.length > 0 ? { nextCursor: cursor } : {}
|
|
5847
|
+
};
|
|
5848
|
+
}
|
|
5849
|
+
async function rfqSwapActivityInputsSincePage(deps, state, since, after, limit) {
|
|
5850
|
+
assertRfqSwapPageLimit(limit);
|
|
5851
|
+
assertRfqSwapSince(since);
|
|
5852
|
+
const page = deps.repository.getRfqSwapsUpdatedPage;
|
|
5853
|
+
if (!page) throw new Error("repository does not support date-filtered RFQ history pages");
|
|
5854
|
+
const records = await page.call(deps.repository, state, since, after, limit);
|
|
5855
|
+
if (records.length > limit)
|
|
5856
|
+
throw new Error("getRfqSwapsUpdatedPage exceeded its requested limit");
|
|
5857
|
+
let cursor = after;
|
|
5858
|
+
for (const record of records) {
|
|
5859
|
+
if (record.state !== state || record.updatedAt < since || cursor && (record.updatedAt < cursor.updatedAt || record.updatedAt === cursor.updatedAt && record.rfqId <= cursor.rfqId)) {
|
|
5860
|
+
throw new Error("getRfqSwapsUpdatedPage returned an unordered or mismatched page");
|
|
5861
|
+
}
|
|
5862
|
+
cursor = { updatedAt: record.updatedAt, rfqId: record.rfqId };
|
|
5863
|
+
}
|
|
5864
|
+
return {
|
|
5865
|
+
inputs: await projectActivityInputs(records, deps.indexer),
|
|
5866
|
+
...records.length === limit && cursor ? { nextCursor: cursor } : {}
|
|
5867
|
+
};
|
|
5868
|
+
}
|
|
5869
|
+
async function projectActivityInputs(records, indexer) {
|
|
5870
|
+
const inputs = [];
|
|
5871
|
+
for (let i = 0; i < records.length; i += 16) {
|
|
5872
|
+
inputs.push(
|
|
5873
|
+
...await Promise.all(
|
|
5874
|
+
records.slice(i, i + 16).map((record) => activityInputOf(record, indexer))
|
|
5875
|
+
)
|
|
5876
|
+
);
|
|
5877
|
+
}
|
|
5878
|
+
return inputs;
|
|
5879
|
+
}
|
|
5668
5880
|
async function activityInputOf(record, indexer) {
|
|
5669
5881
|
const txids = /* @__PURE__ */ new Set();
|
|
5670
5882
|
if (record.fundingArkTxid) txids.add(record.fundingArkTxid);
|
|
@@ -5736,6 +5948,8 @@ async function lockupTxids(indexer, record, wantFunding) {
|
|
|
5736
5948
|
REFUND_MTP_LAG_SECONDS,
|
|
5737
5949
|
RFQ_REFUSAL_ERROR_CODES,
|
|
5738
5950
|
RFQ_RESOLVED_STATES,
|
|
5951
|
+
RFQ_SWAP_ACTIVE_STATES,
|
|
5952
|
+
RFQ_SWAP_MAX_PAGE_SIZE,
|
|
5739
5953
|
RFQ_SWAP_RETENTION_SECONDS,
|
|
5740
5954
|
RFQ_SWAP_TERMINAL_STATES,
|
|
5741
5955
|
RFQ_TERMINAL_STATES,
|
|
@@ -5840,6 +6054,8 @@ async function lockupTxids(indexer, record, wantFunding) {
|
|
|
5840
6054
|
rfqSecretsProfile,
|
|
5841
6055
|
rfqSignerOf,
|
|
5842
6056
|
rfqSwapActivityInputs,
|
|
6057
|
+
rfqSwapActivityInputsPage,
|
|
6058
|
+
rfqSwapActivityInputsSincePage,
|
|
5843
6059
|
rfqSwapOriginOf,
|
|
5844
6060
|
sealClaimPacket,
|
|
5845
6061
|
senderIdentityForSwapRecord,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProvisionedKey, ProvisionedClaimSecret, ArkTxInput, asset, RelativeTimelock, IWallet, EmulatorProvider, arkade, RestIndexerProvider, Transaction, IContractManager, OnchainProvider, PaymentRail, Asset, VHTLC, Identity, ActivityResolver } from '@arkade-os/sdk';
|
|
2
|
-
import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, M as MarketsCacheEntry,
|
|
3
|
-
export {
|
|
2
|
+
import { S as SwapSecretsProjection, R as RfqSwapRecord, A as AssetSwapRepository, a as AssetSwap, b as RfqSwapState, c as RfqHistoryCursor, M as MarketsCacheEntry, d as RefundArkProvider, L as LockupContractSource, e as LockupVtxo, f as RfqSwap, g as ArkadeRefundResult, h as LockupSpendIndexer } from './repository-CSBh-0NH.cjs';
|
|
3
|
+
export { i as AssetSwapStatus, j as AvailableRfqSwapManagerCallbacks, B as BTC_ASSET_ID, I as InMemoryAssetSwapRepository, k as LightningReceiveSwap, l as LightningSendSwap, m as LockupFate, n as LockupNeedsRecoveryError, o as LockupParams, p as LockupSpend, O as OnchainSendAction, q as OnchainSendSwap, P as PersistableRfqSwap, r as PreimageBlockedReason, s as PreimageNotRecoverableError, t as REFUND_MTP_LAG_SECONDS, u as RFQ_RESOLVED_STATES, v as RFQ_SWAP_ACTIVE_STATES, w as RFQ_SWAP_MAX_PAGE_SIZE, x as RFQ_SWAP_RETENTION_SECONDS, y as RFQ_SWAP_TERMINAL_STATES, z as RefundOutcome, C as RfqRestoreFailure, D as RfqRestoreOptions, E as RfqRestoreResult, F as RfqSwapActionName, G as RfqSwapLockup, H as RfqSwapManager, J as RfqSwapManagerCallbacks, K as RfqSwapManagerConfig, N as RfqSwapManagerDeps, Q as RfqSwapManagerEvents, T as RfqSwapOrigin, U as RfqSwapOriginRequired, V as RfqSwapOutcome, W as RfqSwapRecordStore, X as SwapContractRegistry, Y as addAssetSwap, Z as awaitRfqResolution, _ as createRfqSwapRecord, $ as findLockupVtxos, a0 as getAssetSwaps, a1 as getAssetSwapsOrThrow, a2 as isRfqSwapTerminal, a3 as isRfqTerminal, a4 as nextOnchainAction, a5 as preimageForSwapRecord, a6 as pushRefundWithoutReceiver, a7 as readLockupFate, a8 as rebuildRfqSwap, a9 as refundIfUnresolved, aa as rfqSwapOriginOf, ab as shouldRetainRfqSwap, ac as swapSecretsToRecord, ad as updateAssetSwap, ae as updateAssetSwapBestEffort, af as updateRfqSwapRecord } from './repository-CSBh-0NH.cjs';
|
|
4
4
|
import { Network, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
5
5
|
import { O as OnchainNetwork, a as OnchainHtlc, b as OnchainHtlcParams, C as ChainSource, R as RfqTransport, r as requestOnchainSend, I as InvoiceFacts, c as requestLightningSend } from './rfq-B95nPfaa.cjs';
|
|
6
6
|
export { A as ARKADE_ASSET, d as ARKADE_BTC, e as AddressMismatch, f as ChainUtxo, H as HtlcUtxo, L as LIGHTNING_BTC, g as LIGHTNING_RECEIVE_PAIR, h as LIGHTNING_SEND_PAIR, i as LOCKTIME_THRESHOLD, j as LightningReceiveTreeParams, k as LightningSendTreeParams, M as MAX_MIN_CONFIRMATIONS, l as MIN_CLAIM_WINDOW_SECONDS, m as MIN_HEADROOM_SECONDS, n as ONCHAIN_BTC, o as ONCHAIN_CLAIM_MARGIN_SECONDS, p as ONCHAIN_DUST_SATS, q as ONCHAIN_ORDER_MARGIN_SECONDS, s as ONCHAIN_RECEIVE_PAIR, t as ONCHAIN_SECONDS_PER_BLOCK, u as ONCHAIN_SEND_PAIR, v as OnchainHtlcPhase, w as RFQ_REFUSAL_ERROR_CODES, x as RFQ_TERMINAL_STATES, y as RelaySocket, z as RfqQuote, B as RfqRefusalDetail, D as RfqRefusalErrorCode, E as RfqRefusalReason, F as RfqRefusalUnit, G as RfqStatus, S as SOLO_REFUND_HEADROOM_SECONDS, J as SwapRefusal, K as arkadeAssetLeg, N as arkadeSwapRequest, P as assertArkadeFundable, Q as assertFundable, T as assertReceivable, U as awaitOnchainFill, V as buildHtlcClaim, W as buildHtlcRefund, X as canonicalAssetAmount, Y as claimOnchainFill, Z as classifyOnchainHtlc, _ as deriveLightningReceive, $ as deriveOnchainReceive, a0 as deriveOnchainSend, a1 as extractPreimage, a2 as httpTransport, a3 as isRfqRefusalErrorCode, a4 as l1ScriptForAddress, a5 as lightningReceiveRequest, a6 as lightningSendRequest, a7 as lightningSendVtxoScript, a8 as newPreimage, a9 as newRfqId, aa as normalizeMakerPkScript, ab as normalizeMakerPublicKey, ac as offerTermsFromQuote, ad as onchainHtlcScript, ae as onchainReceiveRequest, af as onchainSendRequest, ag as paymentHashOf, ah as receiveVtxoScript, ai as relayTransport, aj as requestArkadeSwap, ak as requestLightningReceive, al as requestOnchainReceive, am as rfqPair, an as unilateralClaimDelay, ao as unilateralRefundDelay, ap as unilateralRefundWithoutReceiverDelay, aq as verifyLockupAddress, ar as verifyOfferAddress, as as verifyReceiveInvoice } from './rfq-B95nPfaa.cjs';
|
|
@@ -577,6 +577,8 @@ declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
|
|
|
577
577
|
saveRfqSwap(record: RfqSwapRecord): Promise<void>;
|
|
578
578
|
getRfqSwap(rfqId: string): Promise<RfqSwapRecord | undefined>;
|
|
579
579
|
getAllRfqSwaps(): Promise<RfqSwapRecord[]>;
|
|
580
|
+
getRfqSwapsPage(state: RfqSwapState, afterId: string | undefined, limit: number): Promise<RfqSwapRecord[]>;
|
|
581
|
+
getRfqSwapsUpdatedPage(state: RfqSwapState, since: number, after: RfqHistoryCursor | undefined, limit: number): Promise<RfqSwapRecord[]>;
|
|
580
582
|
removeRfqSwap(rfqId: string): Promise<void>;
|
|
581
583
|
getScannedTxids(): Promise<Set<string>>;
|
|
582
584
|
markTxidsScanned(txids: Iterable<string>): Promise<void>;
|
|
@@ -1479,7 +1481,7 @@ declare function swapActivityResolver(deps: {
|
|
|
1479
1481
|
listSwaps(): Promise<readonly SwapActivityInput[]>;
|
|
1480
1482
|
}): ActivityResolver;
|
|
1481
1483
|
interface RfqSwapActivityDeps {
|
|
1482
|
-
repository: Pick<AssetSwapRepository, "getAllRfqSwaps">;
|
|
1484
|
+
repository: Pick<AssetSwapRepository, "getAllRfqSwaps" | "getRfqSwapsPage" | "getRfqSwapsUpdatedPage">;
|
|
1483
1485
|
/**
|
|
1484
1486
|
* Consulted only for what a record cannot answer: a record written before
|
|
1485
1487
|
* `fundingArkTxid` existed, and the counterparty's spend on a swap that
|
|
@@ -1505,5 +1507,15 @@ interface RfqSwapActivityDeps {
|
|
|
1505
1507
|
* what they already are.
|
|
1506
1508
|
*/
|
|
1507
1509
|
declare function rfqSwapActivityInputs(deps: RfqSwapActivityDeps): Promise<SwapActivityInput[]>;
|
|
1510
|
+
interface RfqSwapActivityPage {
|
|
1511
|
+
inputs: SwapActivityInput[];
|
|
1512
|
+
nextCursor?: string;
|
|
1513
|
+
}
|
|
1514
|
+
declare function rfqSwapActivityInputsPage(deps: RfqSwapActivityDeps, state: RfqSwapState, afterId: string | undefined, limit: number): Promise<RfqSwapActivityPage>;
|
|
1515
|
+
interface RfqSwapDatedActivityPage {
|
|
1516
|
+
inputs: SwapActivityInput[];
|
|
1517
|
+
nextCursor?: RfqHistoryCursor;
|
|
1518
|
+
}
|
|
1519
|
+
declare function rfqSwapActivityInputsSincePage(deps: RfqSwapActivityDeps, state: RfqSwapState, since: number, after: RfqHistoryCursor | undefined, limit: number): Promise<RfqSwapDatedActivityPage>;
|
|
1508
1520
|
|
|
1509
|
-
export { ASSET_CARRIER_SATS, ArkadeRefundResult, type ArkadeRefunderDeps, AssetSwap, AssetSwapRepository, type AssetSwapRestoreChange, CLAIM_PACKET_TYPE, CROSS_ASSET_RAIL, ChainSource, type ClaimArkProvider, type ClaimPacketInput, type ClaimPacketShape, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type FillFunding, IndexedDbAssetSwapRepository, InvoiceFacts, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractMissing, type LockupContractReader, LockupContractSource, type LockupContractWriter, LockupRegistrationFailed, LockupSpendIndexer, LockupVtxo, MARKET_CORRIDORS, type MarketCorridor, type MarketLike, MarketsCacheEntry, OFFER_PACKET_TYPE, type Offer, type OfferContractRetirer, type OfferSwapWatcher, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, RefundArkProvider, type RefundBlockedReason, RefundNotLocallyPossibleError, type RegisterAssetSwapRestoreOptions, type RestoreAssetSwapRepositoryOptions, type RestoreAssetSwapRepositoryResult, type RestoreIndexer, type RevealParams, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqSwapState, RfqTransport, SEALED_CIPHERTEXT_LENGTH, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, SWAP_LOCKUP_CONTRACT_KIND, SWAP_LOCKUP_CONTRACT_LABEL, SWAP_LOCKUP_CONTRACT_TYPE, type SealedClaimPacket, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, type WatchOfferSwapsParams, appendArkadeScript, arkadeRefunder, awaitLockupFunding, cancelOffer, chainSourceFrom, claimPacketShape, claimReceiveLockup, classifyDepositSpend, classifySpend, covclaimdClient, createOffer, crossAssetRail, decodeOffer, discoverMarkets, encodeOffer, fillOffer, findMarket, isRfqMarket, lockupContractParams, makeCachedFeedFetch, marketAssetId, marketCorridor, marketPairLabel, offerVtxoScript, onchainSendProfile, pushClaim, registerAssetSwapRestore, registerLockupContract, requestLightningSend, requestOnchainSend, restoreAssetSwapRepository, restoreAssetSwaps, restoreOfferCoverage, retireSettledOfferContracts, revealClaimPacket, revealFieldsFromScript, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, sealClaimPacket, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, spendUpdate, swapActivityResolver, swapPrograms, validatePlan, watchOfferSwaps };
|
|
1521
|
+
export { ASSET_CARRIER_SATS, ArkadeRefundResult, type ArkadeRefunderDeps, AssetSwap, AssetSwapRepository, type AssetSwapRestoreChange, CLAIM_PACKET_TYPE, CROSS_ASSET_RAIL, ChainSource, type ClaimArkProvider, type ClaimPacketInput, type ClaimPacketShape, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type FillFunding, IndexedDbAssetSwapRepository, InvoiceFacts, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractMissing, type LockupContractReader, LockupContractSource, type LockupContractWriter, LockupRegistrationFailed, LockupSpendIndexer, LockupVtxo, MARKET_CORRIDORS, type MarketCorridor, type MarketLike, MarketsCacheEntry, OFFER_PACKET_TYPE, type Offer, type OfferContractRetirer, type OfferSwapWatcher, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, RefundArkProvider, type RefundBlockedReason, RefundNotLocallyPossibleError, type RegisterAssetSwapRestoreOptions, type RestoreAssetSwapRepositoryOptions, type RestoreAssetSwapRepositoryResult, type RestoreIndexer, type RevealParams, type RfqClaimSecretProjection, type RfqHashlockProjection, RfqHistoryCursor, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, type RfqSwapActivityPage, type RfqSwapDatedActivityPage, RfqSwapRecord, RfqSwapState, RfqTransport, SEALED_CIPHERTEXT_LENGTH, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, SWAP_LOCKUP_CONTRACT_KIND, SWAP_LOCKUP_CONTRACT_LABEL, SWAP_LOCKUP_CONTRACT_TYPE, type SealedClaimPacket, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, type WatchOfferSwapsParams, appendArkadeScript, arkadeRefunder, awaitLockupFunding, cancelOffer, chainSourceFrom, claimPacketShape, claimReceiveLockup, classifyDepositSpend, classifySpend, covclaimdClient, createOffer, crossAssetRail, decodeOffer, discoverMarkets, encodeOffer, fillOffer, findMarket, isRfqMarket, lockupContractParams, makeCachedFeedFetch, marketAssetId, marketCorridor, marketPairLabel, offerVtxoScript, onchainSendProfile, pushClaim, registerAssetSwapRestore, registerLockupContract, requestLightningSend, requestOnchainSend, restoreAssetSwapRepository, restoreAssetSwaps, restoreOfferCoverage, retireSettledOfferContracts, revealClaimPacket, revealFieldsFromScript, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, rfqSwapActivityInputsPage, rfqSwapActivityInputsSincePage, sealClaimPacket, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, spendUpdate, swapActivityResolver, swapPrograms, validatePlan, watchOfferSwaps };
|