@arkade-os/swap 0.1.0-rc.27 → 0.1.0-rc.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +276 -100
- package/dist/advanced.d.cts +7 -6
- package/dist/advanced.d.ts +7 -6
- package/dist/advanced.js +4 -2
- package/dist/{chunk-BWUC2LDD.js → chunk-DGHBRLCF.js} +15 -10
- package/dist/{chunk-VFZJNU27.js → chunk-ZF57EAJQ.js} +25 -6
- package/dist/index.cjs +274 -100
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2 -2
- package/dist/{lockupContract-DZaNiqP-.d.cts → lockupContract-BE_tSx8i.d.cts} +1 -1
- package/dist/{lockupContract-CAjvaCVw.d.ts → lockupContract-CYSMMrv4.d.ts} +1 -1
- package/dist/nostr.cjs +237 -86
- package/dist/nostr.d.cts +33 -1
- package/dist/nostr.d.ts +33 -1
- package/dist/nostr.js +226 -79
- package/dist/{offer-BwUhEawd.d.cts → offer-C_rgJU7J.d.cts} +1 -1
- package/dist/{offer-v7vBCPmQ.d.ts → offer-Cr7AaLt-.d.ts} +1 -1
- package/dist/{offerFillPlan-BYw1EWEj.d.cts → offerFillPlan-B88PzcLr.d.cts} +12 -16
- package/dist/{offerFillPlan-BGeAXIna.d.ts → offerFillPlan-DFMl7D3Q.d.ts} +12 -16
- package/dist/protocol.cjs +261 -91
- package/dist/protocol.d.cts +6 -6
- package/dist/protocol.d.ts +6 -6
- package/dist/protocol.js +1 -1
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{repository-YEQaxJro.d.ts → repository-CFNZUy2y.d.ts} +4 -5
- package/dist/{repository-D2emdY6f.d.cts → repository-Cs60kDRs.d.cts} +4 -5
- package/dist/{watch-BwbZkceT.d.cts → watch-BEgoHfHu.d.cts} +1 -1
- package/dist/{watch-CjEsO0Qh.d.ts → watch-C7zGV8zh.d.ts} +1 -1
- package/package.json +4 -4
package/dist/advanced.cjs
CHANGED
|
@@ -2325,30 +2325,153 @@ var init_closeOnceWebSocket = __esm({
|
|
|
2325
2325
|
}
|
|
2326
2326
|
});
|
|
2327
2327
|
|
|
2328
|
+
// src/nostrPool.ts
|
|
2329
|
+
var import_nostr_tools, import_utils3, shared, IDLE_CLOSE_MS, NEVER_IDLE_MS, PUBLISH_TIMED_OUT, POOL_DESTROYED, urlKey, SharedPool, createNostrPool, sharedNostrPool, closeSharedNostrPool;
|
|
2330
|
+
var init_nostrPool = __esm({
|
|
2331
|
+
"src/nostrPool.ts"() {
|
|
2332
|
+
"use strict";
|
|
2333
|
+
import_nostr_tools = require("nostr-tools");
|
|
2334
|
+
import_utils3 = require("nostr-tools/utils");
|
|
2335
|
+
init_closeOnceWebSocket();
|
|
2336
|
+
IDLE_CLOSE_MS = 3e4;
|
|
2337
|
+
NEVER_IDLE_MS = 2 ** 31 - 1;
|
|
2338
|
+
PUBLISH_TIMED_OUT = "publish timed out";
|
|
2339
|
+
POOL_DESTROYED = "nostr pool destroyed";
|
|
2340
|
+
urlKey = (url) => {
|
|
2341
|
+
try {
|
|
2342
|
+
return (0, import_utils3.normalizeURL)(url);
|
|
2343
|
+
} catch {
|
|
2344
|
+
return url;
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
SharedPool = class extends import_nostr_tools.SimplePool {
|
|
2348
|
+
#users = /* @__PURE__ */ new Map();
|
|
2349
|
+
#idle = /* @__PURE__ */ new Map();
|
|
2350
|
+
#destroyed = false;
|
|
2351
|
+
/** Count one user on each relay; the returned release is idempotent. */
|
|
2352
|
+
#hold(urls) {
|
|
2353
|
+
const held = [...new Set(urls.map(urlKey))];
|
|
2354
|
+
for (const url of held) {
|
|
2355
|
+
clearTimeout(this.#idle.get(url));
|
|
2356
|
+
this.#idle.delete(url);
|
|
2357
|
+
this.#users.set(url, (this.#users.get(url) ?? 0) + 1);
|
|
2358
|
+
}
|
|
2359
|
+
let released = false;
|
|
2360
|
+
return () => {
|
|
2361
|
+
if (released) return;
|
|
2362
|
+
released = true;
|
|
2363
|
+
for (const url of held) {
|
|
2364
|
+
const left = (this.#users.get(url) ?? 1) - 1;
|
|
2365
|
+
if (left > 0) {
|
|
2366
|
+
this.#users.set(url, left);
|
|
2367
|
+
continue;
|
|
2368
|
+
}
|
|
2369
|
+
this.#users.delete(url);
|
|
2370
|
+
const timer = setTimeout(() => {
|
|
2371
|
+
this.#idle.delete(url);
|
|
2372
|
+
if (!this.#users.has(url)) this.close([url]);
|
|
2373
|
+
}, IDLE_CLOSE_MS);
|
|
2374
|
+
timer.unref?.();
|
|
2375
|
+
this.#idle.set(url, timer);
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* A destroyed pool would otherwise reconnect for anyone still holding it (a transport that
|
|
2381
|
+
* outlived closeSharedNostrPool()), opening a socket no one can close. Refused here, a
|
|
2382
|
+
* subscription reports every relay lost and a publish a connection failure.
|
|
2383
|
+
*/
|
|
2384
|
+
async ensureRelay(...args) {
|
|
2385
|
+
if (this.#destroyed) throw new Error(POOL_DESTROYED);
|
|
2386
|
+
return super.ensureRelay(...args);
|
|
2387
|
+
}
|
|
2388
|
+
subscribeMap(...[requests, params]) {
|
|
2389
|
+
const release = this.#hold(requests.map((request) => request.url));
|
|
2390
|
+
const closer = super.subscribeMap(requests, {
|
|
2391
|
+
...params,
|
|
2392
|
+
// Every relay dropped it: nothing is left to hold the sockets for.
|
|
2393
|
+
onclose: (reasons) => {
|
|
2394
|
+
release();
|
|
2395
|
+
params.onclose?.(reasons);
|
|
2396
|
+
}
|
|
2397
|
+
});
|
|
2398
|
+
let closed = false;
|
|
2399
|
+
return {
|
|
2400
|
+
close: (reason) => {
|
|
2401
|
+
if (closed) return;
|
|
2402
|
+
closed = true;
|
|
2403
|
+
release();
|
|
2404
|
+
closer.close(reason);
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
publish(...[relays, event, params]) {
|
|
2409
|
+
const release = this.#hold(relays);
|
|
2410
|
+
const sent = super.publish(relays, event, params);
|
|
2411
|
+
sent.forEach((publish, i) => {
|
|
2412
|
+
publish.catch((error) => {
|
|
2413
|
+
if (error instanceof Error && error.message === PUBLISH_TIMED_OUT)
|
|
2414
|
+
this.close([relays[i]]);
|
|
2415
|
+
});
|
|
2416
|
+
});
|
|
2417
|
+
void Promise.allSettled(sent).then(release);
|
|
2418
|
+
return sent;
|
|
2419
|
+
}
|
|
2420
|
+
destroy() {
|
|
2421
|
+
this.#destroyed = true;
|
|
2422
|
+
for (const timer of this.#idle.values()) clearTimeout(timer);
|
|
2423
|
+
this.#idle.clear();
|
|
2424
|
+
this.#users.clear();
|
|
2425
|
+
super.destroy();
|
|
2426
|
+
}
|
|
2427
|
+
};
|
|
2428
|
+
createNostrPool = () => (
|
|
2429
|
+
// SimplePool forwards every option at runtime; its declared options just omit most of them.
|
|
2430
|
+
new SharedPool({
|
|
2431
|
+
enablePing: true,
|
|
2432
|
+
idleTimeout: NEVER_IDLE_MS,
|
|
2433
|
+
...CloseOnceWebSocket ? { websocketImplementation: CloseOnceWebSocket } : {}
|
|
2434
|
+
})
|
|
2435
|
+
);
|
|
2436
|
+
sharedNostrPool = () => shared ??= createNostrPool();
|
|
2437
|
+
closeSharedNostrPool = () => {
|
|
2438
|
+
const pool = shared;
|
|
2439
|
+
shared = void 0;
|
|
2440
|
+
if (!pool) return;
|
|
2441
|
+
try {
|
|
2442
|
+
pool.destroy();
|
|
2443
|
+
} catch {
|
|
2444
|
+
}
|
|
2445
|
+
};
|
|
2446
|
+
}
|
|
2447
|
+
});
|
|
2448
|
+
|
|
2328
2449
|
// src/nostr.ts
|
|
2329
2450
|
var nostr_exports = {};
|
|
2330
2451
|
__export(nostr_exports, {
|
|
2331
2452
|
RFQ_DIRECTED_KIND: () => RFQ_DIRECTED_KIND,
|
|
2332
2453
|
RelayUnavailable: () => RelayUnavailable,
|
|
2333
2454
|
TransportClosed: () => TransportClosed,
|
|
2455
|
+
closeSharedNostrPool: () => closeSharedNostrPool,
|
|
2456
|
+
createNostrPool: () => createNostrPool,
|
|
2334
2457
|
nostrCardFetcher: () => nostrCardFetcher,
|
|
2335
|
-
nostrRfqTransport: () => nostrRfqTransport
|
|
2458
|
+
nostrRfqTransport: () => nostrRfqTransport,
|
|
2459
|
+
sharedNostrPool: () => sharedNostrPool
|
|
2336
2460
|
});
|
|
2337
|
-
var import_solver_discovery7, import_sdk19,
|
|
2461
|
+
var import_solver_discovery7, import_sdk19, import_nostr_tools2, RFQ_DIRECTED_KIND, DEFAULT_TIMEOUT_MS, CONNECTION_FAILURE, CARD_FETCH_TIMEOUT_MS, RelayUnavailable, TransportClosed, closeReasons, nostrRfqTransport, isNewer, nostrCardFetcher;
|
|
2338
2462
|
var init_nostr = __esm({
|
|
2339
2463
|
"src/nostr.ts"() {
|
|
2340
2464
|
"use strict";
|
|
2341
2465
|
import_solver_discovery7 = require("@arkade-os/solver-discovery");
|
|
2342
2466
|
init_rfq();
|
|
2343
|
-
|
|
2467
|
+
init_nostrPool();
|
|
2344
2468
|
import_sdk19 = require("@arkade-os/sdk");
|
|
2345
|
-
|
|
2469
|
+
import_nostr_tools2 = require("nostr-tools");
|
|
2470
|
+
init_nostrPool();
|
|
2346
2471
|
RFQ_DIRECTED_KIND = 24859;
|
|
2347
2472
|
DEFAULT_TIMEOUT_MS = 3e4;
|
|
2473
|
+
CONNECTION_FAILURE = "connection failure";
|
|
2348
2474
|
CARD_FETCH_TIMEOUT_MS = 5e3;
|
|
2349
|
-
newPool = () => new import_nostr_tools.SimplePool(
|
|
2350
|
-
CloseOnceWebSocket ? { websocketImplementation: CloseOnceWebSocket } : void 0
|
|
2351
|
-
);
|
|
2352
2475
|
RelayUnavailable = class extends Error {
|
|
2353
2476
|
reasons;
|
|
2354
2477
|
constructor(reasons) {
|
|
@@ -2372,13 +2495,13 @@ var init_nostr = __esm({
|
|
|
2372
2495
|
(0, import_sdk19.assertTimerMs)("timeoutMs", options.timeoutMs);
|
|
2373
2496
|
const relays = options.relays;
|
|
2374
2497
|
const solverPubkey = options.solverPubkey;
|
|
2375
|
-
const secretKey = options.secretKey ?? (0,
|
|
2376
|
-
const pubkey = (0,
|
|
2377
|
-
const pool = options.pool ??
|
|
2378
|
-
const ownsPool = !options.pool;
|
|
2498
|
+
const secretKey = options.secretKey ?? (0, import_nostr_tools2.generateSecretKey)();
|
|
2499
|
+
const pubkey = (0, import_nostr_tools2.getPublicKey)(secretKey);
|
|
2500
|
+
const pool = options.pool ?? sharedNostrPool();
|
|
2379
2501
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
2380
|
-
const conversationKey =
|
|
2502
|
+
const conversationKey = import_nostr_tools2.nip44.v2.utils.getConversationKey(secretKey, solverPubkey);
|
|
2381
2503
|
let closed = false;
|
|
2504
|
+
let lost;
|
|
2382
2505
|
const waiters = /* @__PURE__ */ new Map();
|
|
2383
2506
|
const subscription = pool.subscribeMany(
|
|
2384
2507
|
relays,
|
|
@@ -2387,7 +2510,7 @@ var init_nostr = __esm({
|
|
|
2387
2510
|
onevent(event) {
|
|
2388
2511
|
let payload;
|
|
2389
2512
|
try {
|
|
2390
|
-
payload = JSON.parse(
|
|
2513
|
+
payload = JSON.parse(import_nostr_tools2.nip44.v2.decrypt(event.content, conversationKey));
|
|
2391
2514
|
} catch {
|
|
2392
2515
|
return;
|
|
2393
2516
|
}
|
|
@@ -2399,64 +2522,83 @@ var init_nostr = __esm({
|
|
|
2399
2522
|
onclose(reasons) {
|
|
2400
2523
|
if (closed) return;
|
|
2401
2524
|
const error = new RelayUnavailable(closeReasons(reasons));
|
|
2525
|
+
lost = error;
|
|
2402
2526
|
for (const waiter of waiters.values()) waiter.reject(error);
|
|
2403
2527
|
waiters.clear();
|
|
2404
2528
|
}
|
|
2405
2529
|
}
|
|
2406
2530
|
);
|
|
2407
2531
|
const send = async (payload) => {
|
|
2408
|
-
const event = (0,
|
|
2532
|
+
const event = (0, import_nostr_tools2.finalizeEvent)(
|
|
2409
2533
|
{
|
|
2410
2534
|
kind: RFQ_DIRECTED_KIND,
|
|
2411
2535
|
created_at: Math.floor(Date.now() / 1e3),
|
|
2412
2536
|
tags: [["p", solverPubkey]],
|
|
2413
|
-
content:
|
|
2537
|
+
content: import_nostr_tools2.nip44.v2.encrypt(JSON.stringify(payload), conversationKey)
|
|
2414
2538
|
},
|
|
2415
2539
|
secretKey
|
|
2416
2540
|
);
|
|
2417
2541
|
const results = await Promise.allSettled(pool.publish(relays, event));
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2542
|
+
const reasons = results.map(
|
|
2543
|
+
(r) => r.status === "rejected" ? String(r.reason) : String(r.value)
|
|
2544
|
+
);
|
|
2545
|
+
const accepted = results.some(
|
|
2546
|
+
(r) => r.status === "fulfilled" && !String(r.value).startsWith(CONNECTION_FAILURE)
|
|
2547
|
+
);
|
|
2548
|
+
if (!accepted) throw new Error(`no relay accepted the RFQ message: ${reasons.join("; ")}`);
|
|
2421
2549
|
};
|
|
2422
|
-
const awaitReply = (rfqId) =>
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2425
|
-
reject(new Error(`no solver reply within ${timeoutMs}ms`));
|
|
2426
|
-
}, timeoutMs);
|
|
2427
|
-
waiters.set(rfqId, {
|
|
2428
|
-
resolve: (payload) => {
|
|
2429
|
-
clearTimeout(timer);
|
|
2430
|
-
waiters.delete(rfqId);
|
|
2431
|
-
resolve(payload);
|
|
2432
|
-
},
|
|
2433
|
-
reject: (error) => {
|
|
2434
|
-
clearTimeout(timer);
|
|
2550
|
+
const awaitReply = (rfqId) => {
|
|
2551
|
+
const reply = new Promise((resolve, reject) => {
|
|
2552
|
+
const timer = setTimeout(() => {
|
|
2435
2553
|
waiters.delete(rfqId);
|
|
2436
|
-
reject(
|
|
2437
|
-
}
|
|
2554
|
+
reject(new Error(`no solver reply within ${timeoutMs}ms`));
|
|
2555
|
+
}, timeoutMs);
|
|
2556
|
+
waiters.set(rfqId, {
|
|
2557
|
+
resolve: (payload) => {
|
|
2558
|
+
clearTimeout(timer);
|
|
2559
|
+
waiters.delete(rfqId);
|
|
2560
|
+
resolve(payload);
|
|
2561
|
+
},
|
|
2562
|
+
reject: (error) => {
|
|
2563
|
+
clearTimeout(timer);
|
|
2564
|
+
waiters.delete(rfqId);
|
|
2565
|
+
reject(error);
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2438
2568
|
});
|
|
2439
|
-
|
|
2569
|
+
reply.catch(() => {
|
|
2570
|
+
});
|
|
2571
|
+
return reply;
|
|
2572
|
+
};
|
|
2573
|
+
const ask = async (rfqId, payload) => {
|
|
2574
|
+
if (closed) throw new TransportClosed();
|
|
2575
|
+
if (lost) throw lost;
|
|
2576
|
+
const reply = awaitReply(rfqId);
|
|
2577
|
+
try {
|
|
2578
|
+
await send(payload);
|
|
2579
|
+
} catch (error) {
|
|
2580
|
+
waiters.get(rfqId)?.reject(error);
|
|
2581
|
+
throw error;
|
|
2582
|
+
}
|
|
2583
|
+
return reply;
|
|
2584
|
+
};
|
|
2440
2585
|
return {
|
|
2441
2586
|
async requestQuote(payload) {
|
|
2442
2587
|
const rfqId = String(payload.rfq_id);
|
|
2443
|
-
|
|
2444
|
-
await send(payload);
|
|
2445
|
-
return expectQuote(await reply, rfqId, pairOf(payload));
|
|
2588
|
+
return expectQuote(await ask(rfqId, payload), rfqId, pairOf(payload));
|
|
2446
2589
|
},
|
|
2447
2590
|
async status(rfqId) {
|
|
2448
|
-
const reply =
|
|
2449
|
-
await send({ v: 1, type: "rfq_status_request", rfq_id: rfqId });
|
|
2591
|
+
const reply = ask(rfqId, { v: 1, type: "rfq_status_request", rfq_id: rfqId });
|
|
2450
2592
|
const payload = await reply;
|
|
2451
2593
|
if (payload?.type !== "rfq_status") return null;
|
|
2452
2594
|
return payload;
|
|
2453
2595
|
},
|
|
2454
2596
|
async close() {
|
|
2597
|
+
if (closed) return;
|
|
2455
2598
|
closed = true;
|
|
2456
2599
|
for (const waiter of waiters.values()) waiter.reject(new TransportClosed());
|
|
2457
2600
|
waiters.clear();
|
|
2458
|
-
|
|
2459
|
-
else subscription.close();
|
|
2601
|
+
subscription.close();
|
|
2460
2602
|
}
|
|
2461
2603
|
};
|
|
2462
2604
|
};
|
|
@@ -2465,6 +2607,7 @@ var init_nostr = __esm({
|
|
|
2465
2607
|
(0, import_sdk19.assertTimerMs)("timeoutMs", options.timeoutMs);
|
|
2466
2608
|
if (options.timeoutMs === 0) throw new Error("timeoutMs must be positive");
|
|
2467
2609
|
const seen = /* @__PURE__ */ new Map();
|
|
2610
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
2468
2611
|
return {
|
|
2469
2612
|
async fetch(solvers, network) {
|
|
2470
2613
|
const asked = new Set(solvers.map((solver) => solver.discovery_pubkey));
|
|
@@ -2473,55 +2616,65 @@ var init_nostr = __esm({
|
|
|
2473
2616
|
...new Set(solvers.flatMap((solver) => solver.transports?.nostr?.relays ?? []))
|
|
2474
2617
|
];
|
|
2475
2618
|
if (authors.length === 0 || relays.length === 0) return [];
|
|
2476
|
-
const
|
|
2477
|
-
const
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
relays,
|
|
2486
|
-
{ kinds: [import_solver_discovery7.SOLVER_CARD_KIND], authors, "#d": [network] },
|
|
2487
|
-
{
|
|
2488
|
-
// Relays are untrusted: re-check the filter and the signature, so a stray
|
|
2489
|
-
// or forged later event cannot shadow the real card.
|
|
2490
|
-
onevent(event) {
|
|
2491
|
-
if (event.kind !== import_solver_discovery7.SOLVER_CARD_KIND || !asked.has(event.pubkey))
|
|
2492
|
-
return;
|
|
2493
|
-
if (!(0, import_nostr_tools.verifyEvent)(event)) return;
|
|
2494
|
-
if (event.tags.find((tag) => tag[0] === "d")?.[1] !== network)
|
|
2495
|
-
return;
|
|
2496
|
-
if (isNewer(event, latest.get(event.pubkey)))
|
|
2497
|
-
latest.set(event.pubkey, event);
|
|
2498
|
-
},
|
|
2499
|
-
oneose: () => resolve(),
|
|
2500
|
-
onclose: () => resolve()
|
|
2501
|
-
}
|
|
2502
|
-
);
|
|
2503
|
-
});
|
|
2504
|
-
} finally {
|
|
2505
|
-
clearTimeout(timer);
|
|
2506
|
-
if (options.pool) subscription?.close();
|
|
2507
|
-
else pool.close(relays);
|
|
2508
|
-
}
|
|
2509
|
-
for (const author of authors) {
|
|
2510
|
-
const key = `${network}:${author}`;
|
|
2511
|
-
const event = latest.get(author);
|
|
2512
|
-
if (event && isNewer(event, seen.get(key))) seen.set(key, event);
|
|
2513
|
-
const best = seen.get(key);
|
|
2514
|
-
if (best) latest.set(author, best);
|
|
2515
|
-
}
|
|
2516
|
-
const cards = [];
|
|
2517
|
-
for (const event of latest.values()) {
|
|
2619
|
+
const key = `${network}:${[...asked].sort().join(",")}@${[...relays].sort().join(",")}`;
|
|
2620
|
+
const pending = inflight.get(key);
|
|
2621
|
+
if (pending) return pending;
|
|
2622
|
+
const task = (async () => {
|
|
2623
|
+
const timeoutMs = options.timeoutMs ?? CARD_FETCH_TIMEOUT_MS;
|
|
2624
|
+
const pool = options.pool ?? sharedNostrPool();
|
|
2625
|
+
const latest = /* @__PURE__ */ new Map();
|
|
2626
|
+
let subscription;
|
|
2627
|
+
let timer;
|
|
2518
2628
|
try {
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2629
|
+
await new Promise((resolve) => {
|
|
2630
|
+
timer = setTimeout(resolve, timeoutMs);
|
|
2631
|
+
subscription = pool.subscribeMany(
|
|
2632
|
+
relays,
|
|
2633
|
+
{ kinds: [import_solver_discovery7.SOLVER_CARD_KIND], authors, "#d": [network] },
|
|
2634
|
+
{
|
|
2635
|
+
// Relays are untrusted: re-check the filter and the signature, so a stray
|
|
2636
|
+
// or forged later event cannot shadow the real card.
|
|
2637
|
+
onevent(event) {
|
|
2638
|
+
if (event.kind !== import_solver_discovery7.SOLVER_CARD_KIND || !asked.has(event.pubkey))
|
|
2639
|
+
return;
|
|
2640
|
+
if (!(0, import_nostr_tools2.verifyEvent)(event)) return;
|
|
2641
|
+
if (event.tags.find((tag) => tag[0] === "d")?.[1] !== network)
|
|
2642
|
+
return;
|
|
2643
|
+
if (isNewer(event, latest.get(event.pubkey)))
|
|
2644
|
+
latest.set(event.pubkey, event);
|
|
2645
|
+
},
|
|
2646
|
+
oneose: () => resolve(),
|
|
2647
|
+
onclose: () => resolve()
|
|
2648
|
+
}
|
|
2649
|
+
);
|
|
2650
|
+
});
|
|
2651
|
+
} finally {
|
|
2652
|
+
clearTimeout(timer);
|
|
2653
|
+
subscription?.close();
|
|
2654
|
+
}
|
|
2655
|
+
for (const author of authors) {
|
|
2656
|
+
const seenKey = `${network}:${author}`;
|
|
2657
|
+
const event = latest.get(author);
|
|
2658
|
+
if (event && isNewer(event, seen.get(seenKey))) seen.set(seenKey, event);
|
|
2659
|
+
const best = seen.get(seenKey);
|
|
2660
|
+
if (best) latest.set(author, best);
|
|
2522
2661
|
}
|
|
2662
|
+
const cards = [];
|
|
2663
|
+
for (const event of latest.values()) {
|
|
2664
|
+
try {
|
|
2665
|
+
const card = JSON.parse(event.content);
|
|
2666
|
+
cards.push({ pubkey: event.pubkey, createdAt: event.created_at, card });
|
|
2667
|
+
} catch {
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
return cards;
|
|
2671
|
+
})();
|
|
2672
|
+
inflight.set(key, task);
|
|
2673
|
+
try {
|
|
2674
|
+
return await task;
|
|
2675
|
+
} finally {
|
|
2676
|
+
if (inflight.get(key) === task) inflight.delete(key);
|
|
2523
2677
|
}
|
|
2524
|
-
return cards;
|
|
2525
2678
|
}
|
|
2526
2679
|
};
|
|
2527
2680
|
};
|
|
@@ -2601,6 +2754,7 @@ __export(advanced_exports, {
|
|
|
2601
2754
|
corridorRecordStore: () => corridorRecordStore,
|
|
2602
2755
|
corridorSet: () => corridorSet,
|
|
2603
2756
|
covclaimdClient: () => covclaimdClient,
|
|
2757
|
+
createNostrTransportFactory: () => createNostrTransportFactory,
|
|
2604
2758
|
createSwapClient: () => createSwapClient,
|
|
2605
2759
|
createSwapDrive: () => createSwapDrive,
|
|
2606
2760
|
decodeBolt11: () => decodeBolt11,
|
|
@@ -4625,6 +4779,19 @@ var candidateWitnessItems = (tx, inputIndex) => [
|
|
|
4625
4779
|
...(0, import_sdk14.getArkPsbtFields)(tx, inputIndex, import_sdk14.ConditionWitness).flat(),
|
|
4626
4780
|
...tx.getInput(inputIndex).finalScriptWitness ?? []
|
|
4627
4781
|
];
|
|
4782
|
+
var spendsRefundLeaf = (tx, inputIndex) => {
|
|
4783
|
+
const input = tx.getInput(inputIndex);
|
|
4784
|
+
const witness = input.finalScriptWitness;
|
|
4785
|
+
const leaves = input.tapLeafScript ?? [];
|
|
4786
|
+
const script = witness && witness.length >= 2 ? witness[witness.length - 2] : leaves.length === 1 ? (0, import_sdk14.scriptFromTapLeafScript)(leaves[0]) : void 0;
|
|
4787
|
+
if (!script) return false;
|
|
4788
|
+
try {
|
|
4789
|
+
const { type } = (0, import_sdk14.decodeTapscript)(script);
|
|
4790
|
+
return type === "multisig" || type === "csv-multisig" || type === "cltv-multisig";
|
|
4791
|
+
} catch {
|
|
4792
|
+
return false;
|
|
4793
|
+
}
|
|
4794
|
+
};
|
|
4628
4795
|
async function readLockupFate(indexer, input) {
|
|
4629
4796
|
const { vtxos } = await indexer.getVtxos({ scripts: [import_base10.hex.encode(input.swapPkScript)] });
|
|
4630
4797
|
const all = vtxos ?? [];
|
|
@@ -4654,7 +4821,7 @@ async function readLockupFate(indexer, input) {
|
|
|
4654
4821
|
}
|
|
4655
4822
|
const spends = [...spentBy.values()];
|
|
4656
4823
|
const { txs } = await indexer.getVirtualTxs([...spentBy.keys()]);
|
|
4657
|
-
const
|
|
4824
|
+
const refunded = /* @__PURE__ */ new Set();
|
|
4658
4825
|
for (const raw of txs) {
|
|
4659
4826
|
let tx;
|
|
4660
4827
|
try {
|
|
@@ -4662,21 +4829,25 @@ async function readLockupFate(indexer, input) {
|
|
|
4662
4829
|
} catch {
|
|
4663
4830
|
continue;
|
|
4664
4831
|
}
|
|
4665
|
-
if (spentBy.has(tx.id))
|
|
4832
|
+
if (!spentBy.has(tx.id)) continue;
|
|
4666
4833
|
for (let i = 0; i < tx.inputsLength; i++) {
|
|
4667
4834
|
const spent = tx.getInput(i);
|
|
4668
4835
|
if (!spent.txid) continue;
|
|
4669
4836
|
const txid = import_base10.hex.encode(spent.txid);
|
|
4670
|
-
|
|
4837
|
+
const vtxo = all.find(
|
|
4838
|
+
(vtxo2) => vtxo2.txid === txid && vtxo2.vout === spent.index && vtxo2.spentBy === tx.id
|
|
4839
|
+
);
|
|
4840
|
+
if (!vtxo) continue;
|
|
4671
4841
|
for (const candidate of candidateWitnessItems(tx, i)) {
|
|
4672
4842
|
if (hashesTo(candidate, input.paymentHash)) {
|
|
4673
4843
|
return { fate: "claimed", preimage: candidate, spends };
|
|
4674
4844
|
}
|
|
4675
4845
|
}
|
|
4846
|
+
if (spendsRefundLeaf(tx, i)) refunded.add(`${vtxo.txid}:${vtxo.vout}`);
|
|
4676
4847
|
}
|
|
4677
4848
|
}
|
|
4678
4849
|
if (sweptLeft) return { fate: "open" };
|
|
4679
|
-
return everySpendNamed &&
|
|
4850
|
+
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends } : { fate: "unknown" };
|
|
4680
4851
|
}
|
|
4681
4852
|
var assertNoneSwept = (vtxos, contract) => {
|
|
4682
4853
|
const swept = vtxos.filter((vtxo) => vtxo.recoverable);
|
|
@@ -9687,16 +9858,20 @@ var exchange = async (deps, options) => settle(
|
|
|
9687
9858
|
|
|
9688
9859
|
// src/client/transport.ts
|
|
9689
9860
|
var attesting = (transport, responder) => Object.assign(transport, { attestedResponder: responder });
|
|
9690
|
-
var
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9861
|
+
var createNostrTransportFactory = (pool) => {
|
|
9862
|
+
return async (rendezvous) => {
|
|
9863
|
+
const { nostrRfqTransport: nostrRfqTransport2 } = await Promise.resolve().then(() => (init_nostr(), nostr_exports));
|
|
9864
|
+
return attesting(
|
|
9865
|
+
nostrRfqTransport2({
|
|
9866
|
+
relays: [...rendezvous.relays],
|
|
9867
|
+
solverPubkey: rendezvous.solverPubkey,
|
|
9868
|
+
...pool === void 0 ? {} : { pool }
|
|
9869
|
+
}),
|
|
9870
|
+
rendezvous.solverPubkey
|
|
9871
|
+
);
|
|
9872
|
+
};
|
|
9699
9873
|
};
|
|
9874
|
+
var nostrTransportFactory = createNostrTransportFactory();
|
|
9700
9875
|
|
|
9701
9876
|
// src/client/client.ts
|
|
9702
9877
|
var PREPARATIONS_HELD = 64;
|
|
@@ -10520,6 +10695,7 @@ var readCommonProfile = (profile, paymentHash, chainId) => {
|
|
|
10520
10695
|
corridorRecordStore,
|
|
10521
10696
|
corridorSet,
|
|
10522
10697
|
covclaimdClient,
|
|
10698
|
+
createNostrTransportFactory,
|
|
10523
10699
|
createSwapClient,
|
|
10524
10700
|
createSwapDrive,
|
|
10525
10701
|
decodeBolt11,
|
package/dist/advanced.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-B88PzcLr.cjs';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-B88PzcLr.cjs';
|
|
3
3
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
4
|
+
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-Cs60kDRs.cjs';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-Cs60kDRs.cjs';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-CRiAHBBH.cjs';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-CRiAHBBH.cjs';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-BEgoHfHu.cjs';
|
|
11
|
+
import './offer-C_rgJU7J.cjs';
|
|
12
|
+
import 'nostr-tools';
|
|
12
13
|
|
|
13
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
14
15
|
declare const EVM_CHAIN = "ethereum";
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-DFMl7D3Q.js';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MaxFeeExceeded, a3 as MissingCorridorDep, a4 as NotCancellable, a5 as OFFER_FILL_OWNERS, a6 as OFFER_FILL_TEMPLATE, a7 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a8 as ObservationSeam, a9 as OfferPreparation, aa as OnchainClaim, ab as OnchainRefund, ac as OperatorUnreachable, ad as ParsedRfqQuote, ae as PayOptions, af as PayResult, ag as QuoteCheck, ah as QuoteExpired, ai as QuotePreparation, aj as QuoteVerificationFailed, ak as REGISTRY_URL, al as ReceiveArtifact, am as ReceiveOptions, an as ReceiveRequest, ao as RecoveryResult, ap as RegisteredAsset, aq as RfqAuctionPolicy, ar as RfqPreparation, as as RfqQuoteInput, at as RfqRendezvous, au as RfqTransportFactory, av as RouteSide, aw as SWAP_ERROR_NAMES, ax as SwapClient, ay as SwapClientConfig, az as SwapDrive, aA as SwapDriveConfig, aB as SwapDriveRefusedError, aC as SwapError, aD as SwapErrorName, aE as SwapFilter, aF as UnsupportedRoute, aG as VerbDeps, aH as acceptQuote, aI as attesting, aJ as buildOfferFillPlan, aK as cancelSwap, aL as canonicalAssetId, aM as cardMarketOf, aN as chooseMarket, aO as conflictingFields, aP as corridorSet, aQ as createNostrTransportFactory, aR as createSwapClient, aS as createSwapDrive, aT as deepFreeze, aU as digestJointGraph, aV as discoveryIndex, aW as eligibleMarkets, aX as enforceFeeCeiling, aY as exchange, aZ as feedFetch, a_ as feedSpread, a$ as isAddressable, b0 as isCardMarket, b1 as isIndexedNetwork, b2 as isSwapError, b3 as isUsableCard, b4 as liveArkadeInfo, b5 as marketBackendOf, b6 as marketKeyOf, b7 as marketRefOf, b8 as nostrTransportFactory, b9 as parseRfqQuote, ba as pay, bb as quoteFromFeed, bc as quoteViaRfq, bd as readableRecord, be as receive, bf as resolveCorridorBase, bg as resolveCorridorDeps, bh as rfqLeg, bi as rfqPairFor, bj as swapRecordOf, bk as toDiscoveryLeg, bl as unsignedPsbtBytes, bm as usableMarkets, bn as verifyJointGraph, bo as verifyOfferFillPlan, bp as verifyPlanLegs, bq as withCanonicalAmount } from './offerFillPlan-DFMl7D3Q.js';
|
|
3
3
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
4
|
+
import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-CFNZUy2y.js';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-CFNZUy2y.js';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-CRiAHBBH.js';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-CRiAHBBH.js';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-C7zGV8zh.js';
|
|
11
|
+
import './offer-Cr7AaLt-.js';
|
|
12
|
+
import 'nostr-tools';
|
|
12
13
|
|
|
13
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
14
15
|
declare const EVM_CHAIN = "ethereum";
|
package/dist/advanced.js
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
corridorOfRail,
|
|
53
53
|
corridorRecordStore,
|
|
54
54
|
corridorSet,
|
|
55
|
+
createNostrTransportFactory,
|
|
55
56
|
createSwapClient,
|
|
56
57
|
createSwapDrive,
|
|
57
58
|
decodeBolt11,
|
|
@@ -135,7 +136,7 @@ import {
|
|
|
135
136
|
withCanonicalAmount,
|
|
136
137
|
withDepositFate,
|
|
137
138
|
withRfqState
|
|
138
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-DGHBRLCF.js";
|
|
139
140
|
import {
|
|
140
141
|
ACTIVITY_TOKEN,
|
|
141
142
|
Amount,
|
|
@@ -170,7 +171,7 @@ import {
|
|
|
170
171
|
recordOutcome,
|
|
171
172
|
swapOf,
|
|
172
173
|
toAtomicDecimal
|
|
173
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-ZF57EAJQ.js";
|
|
174
175
|
import {
|
|
175
176
|
ARKADE_BTC,
|
|
176
177
|
SwapRefusal,
|
|
@@ -599,6 +600,7 @@ export {
|
|
|
599
600
|
corridorRecordStore,
|
|
600
601
|
corridorSet,
|
|
601
602
|
covclaimdClient,
|
|
603
|
+
createNostrTransportFactory,
|
|
602
604
|
createSwapClient,
|
|
603
605
|
createSwapDrive,
|
|
604
606
|
decodeBolt11,
|