@arkade-os/swap 0.1.0-rc.15 → 0.1.0-rc.16
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 +2 -2
- package/dist/advanced.cjs +155 -53
- package/dist/advanced.d.cts +10 -8
- package/dist/advanced.d.ts +10 -8
- package/dist/advanced.js +9 -1
- package/dist/{chunk-4WPDXLXH.js → chunk-3RSH73P4.js} +136 -31
- package/dist/{errors-BcOgFV-F.d.ts → errors-DYGuDb4G.d.ts} +2 -2
- package/dist/{errors-n6IHTG-Z.d.cts → errors-O-27mWDX.d.cts} +2 -2
- package/dist/index.cjs +181 -81
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -1
- package/dist/{lockupContract-B_jNbjrG.d.ts → lockupContract-Bz8T0pYL.d.ts} +2 -2
- package/dist/{lockupContract-ZsftgqMc.d.cts → lockupContract-C-4zimb4.d.cts} +2 -2
- package/dist/{offer--1zVkNsV.d.ts → offer-CJzNPS5H.d.ts} +1 -1
- package/dist/{offer-DsP1q6GE.d.cts → offer-DCaE0YNp.d.cts} +1 -1
- package/dist/protocol.cjs +1 -1
- package/dist/protocol.d.cts +5 -5
- package/dist/protocol.d.ts +5 -5
- 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-C32GKpR5.d.cts → repository-S2OS6Yl-.d.cts} +30 -3
- package/dist/{repository-BY6GUQiW.d.ts → repository-V98jQmTD.d.ts} +30 -3
- package/dist/{watch-D8uzWrHc.d.ts → watch-3pNJbc4T.d.ts} +1 -1
- package/dist/{watch-Cejw5cNQ.d.cts → watch-BFMXLQV-.d.cts} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Each is one `quote` → `accept` chain. `quote` returns binding, verified terms
|
|
|
27
27
|
durable; `accept` writes the record, then funds.
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
const BTC = btcOn("arkade", "bitcoin"); // arkade:bitcoin/slip44:0
|
|
30
|
+
const BTC = btcOn("arkade", "bitcoin"); // arkade:bitcoin/slip44:0 (slip44:1 on test networks)
|
|
31
31
|
const USDT = "arkade:bitcoin/asset:…";
|
|
32
32
|
|
|
33
33
|
// arkade -> lightning: pay an invoice. The amount is the invoice's.
|
|
@@ -98,7 +98,7 @@ Asset ids are CAIP-19 with the rail as the CAIP-2 namespace, `<rail>:<network>/<
|
|
|
98
98
|
```ts
|
|
99
99
|
const asset = canonicalAssetId("BTC", {
|
|
100
100
|
network: "regtest",
|
|
101
|
-
assets: [{ ticker: "BTC", id: "arkade:regtest/slip44:
|
|
101
|
+
assets: [{ ticker: "BTC", id: "arkade:regtest/slip44:1" }],
|
|
102
102
|
});
|
|
103
103
|
```
|
|
104
104
|
|
package/dist/advanced.cjs
CHANGED
|
@@ -1837,6 +1837,7 @@ __export(advanced_exports, {
|
|
|
1837
1837
|
assetSwapIdOf: () => assetSwapIdOf,
|
|
1838
1838
|
attesting: () => attesting,
|
|
1839
1839
|
bitcoinNetworkOf: () => bitcoinNetworkOf,
|
|
1840
|
+
btcAssetPart: () => btcAssetPart,
|
|
1840
1841
|
btcOn: () => btcOn,
|
|
1841
1842
|
cancelSwap: () => cancelSwap,
|
|
1842
1843
|
canonicalAssetId: () => canonicalAssetId,
|
|
@@ -1872,6 +1873,8 @@ __export(advanced_exports, {
|
|
|
1872
1873
|
isAddressable: () => isAddressable,
|
|
1873
1874
|
isAssetId: () => isAssetId,
|
|
1874
1875
|
isAtomicDecimal: () => isAtomicDecimal,
|
|
1876
|
+
isBtcAsset: () => isBtcAsset,
|
|
1877
|
+
isBtcAssetLenient: () => isBtcAssetLenient,
|
|
1875
1878
|
isCardMarket: () => isCardMarket,
|
|
1876
1879
|
isIndexedNetwork: () => isIndexedNetwork,
|
|
1877
1880
|
isNetworkRef: () => isNetworkRef,
|
|
@@ -1890,6 +1893,7 @@ __export(advanced_exports, {
|
|
|
1890
1893
|
offerOutcome: () => offerOutcome,
|
|
1891
1894
|
offerRecordSource: () => offerRecordSource,
|
|
1892
1895
|
onchainCorridor: () => onchainCorridor,
|
|
1896
|
+
pageRfqRecords: () => pageRfqRecords,
|
|
1893
1897
|
parseAssetId: () => parseAssetId,
|
|
1894
1898
|
parseRfqQuote: () => parseRfqQuote,
|
|
1895
1899
|
pay: () => pay,
|
|
@@ -2324,10 +2328,20 @@ var sameAsset = (a, b) => {
|
|
|
2324
2328
|
const right = parseAssetId(b);
|
|
2325
2329
|
return left.reference === right.reference && left.assetNamespace === right.assetNamespace && left.assetReference === right.assetReference;
|
|
2326
2330
|
};
|
|
2331
|
+
var btcAssetPart = (network) => network === "bitcoin" ? "slip44:0" : "slip44:1";
|
|
2327
2332
|
var btcOn = (rail, network) => (
|
|
2328
2333
|
// TS won't resolve the conditional against an unbound `R`; the cast stays in this expression.
|
|
2329
|
-
`${rail}:${network}/${
|
|
2334
|
+
`${rail}:${network}/${btcAssetPart(network)}`
|
|
2330
2335
|
);
|
|
2336
|
+
var isBtcAsset = (id) => {
|
|
2337
|
+
const { rail, reference, assetNamespace, assetReference } = parseAssetId(id);
|
|
2338
|
+
return rail !== "eip155" && `${assetNamespace}:${assetReference}` === btcAssetPart(reference);
|
|
2339
|
+
};
|
|
2340
|
+
var isBtcAssetLenient = (id) => {
|
|
2341
|
+
if (isBtcAsset(id)) return true;
|
|
2342
|
+
const { rail, assetNamespace, assetReference } = parseAssetId(id);
|
|
2343
|
+
return rail !== "eip155" && assetNamespace === "slip44" && assetReference === "0";
|
|
2344
|
+
};
|
|
2331
2345
|
var arkadeAsset = (network, id) => `arkade:${network}/${ARKADE_ASSET_NAMESPACE}:${id.toString()}`;
|
|
2332
2346
|
var issuanceOf = (id) => {
|
|
2333
2347
|
const { assetNamespace, assetReference } = parseAssetId(id);
|
|
@@ -2519,24 +2533,26 @@ function isSwapError(e, name) {
|
|
|
2519
2533
|
|
|
2520
2534
|
// src/client/aliases.ts
|
|
2521
2535
|
var toDiscoveryLeg = (id) => {
|
|
2522
|
-
const { rail, assetNamespace, assetReference } = parseAssetId(id);
|
|
2536
|
+
const { rail, reference, assetNamespace, assetReference } = parseAssetId(id);
|
|
2523
2537
|
const asset7 = `${assetNamespace}:${assetReference}`;
|
|
2538
|
+
const isBtc = isBtcAsset(id);
|
|
2539
|
+
if (!isBtc && rail !== "eip155" && (asset7 === "slip44:0" || asset7 === "slip44:1")) {
|
|
2540
|
+
const expected = btcOn(rail, reference);
|
|
2541
|
+
throw new UnsupportedRoute(`${id} is not BTC on ${reference}: BTC there is ${expected}`);
|
|
2542
|
+
}
|
|
2524
2543
|
if (rail === "arkade") {
|
|
2525
|
-
if (
|
|
2526
|
-
return { corridor: "arkade", assetId: BTC_ASSET_ID, marketId: id };
|
|
2544
|
+
if (isBtc) return { corridor: "arkade", assetId: BTC_ASSET_ID, marketId: id };
|
|
2527
2545
|
if (assetNamespace === ARKADE_ASSET_NAMESPACE) {
|
|
2528
2546
|
return { corridor: "arkade", assetId: assetReference, marketId: id };
|
|
2529
2547
|
}
|
|
2530
2548
|
throw new UnsupportedRoute(`the arkade corridor has no ${asset7}`);
|
|
2531
2549
|
}
|
|
2532
2550
|
if (rail === "bolt11") {
|
|
2533
|
-
if (
|
|
2534
|
-
return { corridor: "lightning", assetId: BTC_ASSET_ID, marketId: id };
|
|
2551
|
+
if (isBtc) return { corridor: "lightning", assetId: BTC_ASSET_ID, marketId: id };
|
|
2535
2552
|
throw new UnsupportedRoute(`the lightning corridor carries BTC only, not ${asset7}`);
|
|
2536
2553
|
}
|
|
2537
2554
|
if (rail === "bitcoin") {
|
|
2538
|
-
if (
|
|
2539
|
-
return { corridor: "onchain", assetId: BTC_ASSET_ID, marketId: id };
|
|
2555
|
+
if (isBtc) return { corridor: "onchain", assetId: BTC_ASSET_ID, marketId: id };
|
|
2540
2556
|
throw new UnsupportedRoute(`the onchain corridor carries BTC only, not ${asset7}`);
|
|
2541
2557
|
}
|
|
2542
2558
|
throw new UnsupportedRoute(`no corridor serves ${id}`);
|
|
@@ -3085,7 +3101,7 @@ var marketSourceOf = (market) => market.kind === "card" ? market.source : void 0
|
|
|
3085
3101
|
var assertFundable2 = async (wallet, quote) => {
|
|
3086
3102
|
const give = quote.give;
|
|
3087
3103
|
const balance = await wallet.getBalance();
|
|
3088
|
-
const available =
|
|
3104
|
+
const available = isBtcAsset(give.asset) ? BigInt(balance.available) : balance.availableAssets.find((a) => give.asset.endsWith(a.assetId))?.amount ?? 0n;
|
|
3089
3105
|
if (available < give.amount) {
|
|
3090
3106
|
throw new InsufficientFunds(give.asset, give.amount, available);
|
|
3091
3107
|
}
|
|
@@ -3242,7 +3258,7 @@ var fund = async (input, record) => {
|
|
|
3242
3258
|
const { wallet } = input;
|
|
3243
3259
|
if (record.family === "offer") {
|
|
3244
3260
|
const amount = fromAtomicDecimal(record.give.amount);
|
|
3245
|
-
const depositIsBtc =
|
|
3261
|
+
const depositIsBtc = isBtcAssetLenient(record.route.give.asset);
|
|
3246
3262
|
return wallet.send({
|
|
3247
3263
|
address: record.swapAddress,
|
|
3248
3264
|
// An asset deposit rides a dust-sat carrier: the solver's published one when the record
|
|
@@ -3278,7 +3294,7 @@ var reconcileFunding = async (input, record) => {
|
|
|
3278
3294
|
};
|
|
3279
3295
|
var depositMatches = (vtxo, record, expected) => {
|
|
3280
3296
|
const giveAsset = record.route.give.asset;
|
|
3281
|
-
if (
|
|
3297
|
+
if (isBtcAssetLenient(giveAsset)) {
|
|
3282
3298
|
return BigInt(vtxo.value) === expected;
|
|
3283
3299
|
}
|
|
3284
3300
|
return (vtxo.assets ?? []).some(
|
|
@@ -4273,6 +4289,17 @@ var withRfqState = (record, state) => {
|
|
|
4273
4289
|
...mutableHalfOf(state)
|
|
4274
4290
|
};
|
|
4275
4291
|
};
|
|
4292
|
+
var pageRfqRecords = (records, filter, page) => {
|
|
4293
|
+
const rows = records.filter(
|
|
4294
|
+
(record) => (filter.state === void 0 || record.state === filter.state) && (filter.since === void 0 || record.updatedAt >= filter.since) && (!page.after || record.updatedAt > page.after.updatedAt || record.updatedAt === page.after.updatedAt && record.rfqId > page.after.rfqId)
|
|
4295
|
+
).sort(
|
|
4296
|
+
(a, b) => a.updatedAt - b.updatedAt || (a.rfqId < b.rfqId ? -1 : a.rfqId > b.rfqId ? 1 : 0)
|
|
4297
|
+
).slice(0, page.limit + 1);
|
|
4298
|
+
return (0, import_sdk18.pageResult)(rows, page.limit, (record) => ({
|
|
4299
|
+
updatedAt: record.updatedAt,
|
|
4300
|
+
rfqId: record.rfqId
|
|
4301
|
+
}));
|
|
4302
|
+
};
|
|
4276
4303
|
var corridorRecordStore = (repository, onRecord = () => {
|
|
4277
4304
|
}, admits = () => true) => {
|
|
4278
4305
|
const byRfqId = /* @__PURE__ */ new Map();
|
|
@@ -4298,15 +4325,7 @@ var corridorRecordStore = (repository, onRecord = () => {
|
|
|
4298
4325
|
assertRfqSwapPageFilter(filter);
|
|
4299
4326
|
const { corridor } = splitRecords(await collectSwapRecords(repository));
|
|
4300
4327
|
for (const record of corridor) index(record);
|
|
4301
|
-
|
|
4302
|
-
(record) => (filter.state === void 0 || record.state === filter.state) && (filter.since === void 0 || record.updatedAt >= filter.since) && (!page.after || record.updatedAt > page.after.updatedAt || record.updatedAt === page.after.updatedAt && record.rfqId > page.after.rfqId)
|
|
4303
|
-
).sort(
|
|
4304
|
-
(a, b) => a.updatedAt - b.updatedAt || (a.rfqId < b.rfqId ? -1 : a.rfqId > b.rfqId ? 1 : 0)
|
|
4305
|
-
).slice(0, page.limit + 1);
|
|
4306
|
-
return (0, import_sdk18.pageResult)(rows, page.limit, (record) => ({
|
|
4307
|
-
updatedAt: record.updatedAt,
|
|
4308
|
-
rfqId: record.rfqId
|
|
4309
|
-
}));
|
|
4328
|
+
return pageRfqRecords(corridor.filter(admits).map(rfqRecordOf), filter, page);
|
|
4310
4329
|
},
|
|
4311
4330
|
async getRfqSwap(rfqId) {
|
|
4312
4331
|
const record = await recordFor(rfqId);
|
|
@@ -4541,7 +4560,7 @@ var retireOfferScripts = async (wallet, repository, record) => {
|
|
|
4541
4560
|
};
|
|
4542
4561
|
|
|
4543
4562
|
// src/client/drive.ts
|
|
4544
|
-
var
|
|
4563
|
+
var import_sdk28 = require("@arkade-os/sdk");
|
|
4545
4564
|
var import_base17 = require("@scure/base");
|
|
4546
4565
|
|
|
4547
4566
|
// src/claim.ts
|
|
@@ -5893,6 +5912,70 @@ async function watchOfferSwaps({
|
|
|
5893
5912
|
};
|
|
5894
5913
|
}
|
|
5895
5914
|
|
|
5915
|
+
// src/client/legacyRecords.ts
|
|
5916
|
+
var import_sdk27 = require("@arkade-os/sdk");
|
|
5917
|
+
init_repository();
|
|
5918
|
+
var readLegacyRfqSwaps = async (repository, filter = {}) => {
|
|
5919
|
+
try {
|
|
5920
|
+
return await collectRfqSwaps(repository, filter);
|
|
5921
|
+
} catch (error) {
|
|
5922
|
+
console.warn("[swap] the v1 rfq swaps could not be read", error);
|
|
5923
|
+
return [];
|
|
5924
|
+
}
|
|
5925
|
+
};
|
|
5926
|
+
var legacyLiveRfqSwaps = async (repository) => (await readLegacyRfqSwaps(repository)).filter((record) => !isRfqSwapTerminal(record.state));
|
|
5927
|
+
var withLegacyRfqSwaps = (bridge, repository, admits) => {
|
|
5928
|
+
const legacy = /* @__PURE__ */ new Set();
|
|
5929
|
+
return {
|
|
5930
|
+
index: bridge.index,
|
|
5931
|
+
quoteIdOf: bridge.quoteIdOf,
|
|
5932
|
+
async getRfqSwapsPage(filter, page) {
|
|
5933
|
+
(0, import_sdk27.assertPageRequest)(page);
|
|
5934
|
+
assertRfqSwapPageFilter(filter);
|
|
5935
|
+
const v2 = await collectRfqSwaps(bridge, filter);
|
|
5936
|
+
const held = new Set(
|
|
5937
|
+
splitRecords(await collectSwapRecords(repository)).corridor.map((r) => r.rfqId)
|
|
5938
|
+
);
|
|
5939
|
+
const v1 = (await readLegacyRfqSwaps(repository, filter)).filter(
|
|
5940
|
+
(record) => !held.has(record.rfqId) && admits(record)
|
|
5941
|
+
);
|
|
5942
|
+
for (const record of v1) legacy.add(record.rfqId);
|
|
5943
|
+
return pageRfqRecords([...v2, ...v1], filter, page);
|
|
5944
|
+
},
|
|
5945
|
+
async getRfqSwap(rfqId) {
|
|
5946
|
+
if (!legacy.has(rfqId)) {
|
|
5947
|
+
const record2 = await bridge.getRfqSwap(rfqId);
|
|
5948
|
+
if (record2 !== void 0) return record2;
|
|
5949
|
+
}
|
|
5950
|
+
const record = await repository.getRfqSwap(rfqId);
|
|
5951
|
+
if (record !== void 0) legacy.add(rfqId);
|
|
5952
|
+
return record;
|
|
5953
|
+
},
|
|
5954
|
+
async saveRfqSwap(record) {
|
|
5955
|
+
if (legacy.has(record.rfqId)) await repository.saveRfqSwap(record);
|
|
5956
|
+
else await bridge.saveRfqSwap(record);
|
|
5957
|
+
},
|
|
5958
|
+
removeRfqSwap: (rfqId) => bridge.removeRfqSwap(rfqId)
|
|
5959
|
+
};
|
|
5960
|
+
};
|
|
5961
|
+
var readLegacyAssetSwaps = async (repository) => {
|
|
5962
|
+
try {
|
|
5963
|
+
return await collectAssetSwaps(repository);
|
|
5964
|
+
} catch (error) {
|
|
5965
|
+
console.warn("[swap] the v1 swaps could not be read", error);
|
|
5966
|
+
return [];
|
|
5967
|
+
}
|
|
5968
|
+
};
|
|
5969
|
+
var legacyOfferDepositsToReopen = async (repository) => {
|
|
5970
|
+
const live = (await readLegacyAssetSwaps(repository)).filter(
|
|
5971
|
+
(swap) => !!swap.offerHex && !!swap.fundingTxid && (swap.status === "pending" || swap.status === "cancelling" || swap.status === "recoverable")
|
|
5972
|
+
);
|
|
5973
|
+
if (live.length === 0) return /* @__PURE__ */ new Set();
|
|
5974
|
+
const { offer } = splitRecords(await collectSwapRecords(repository));
|
|
5975
|
+
const adopted = new Set(offer.map((record) => record.fundingTxid));
|
|
5976
|
+
return new Set(live.map((swap) => swap.fundingTxid).filter((txid) => !adopted.has(txid)));
|
|
5977
|
+
};
|
|
5978
|
+
|
|
5896
5979
|
// src/client/drive.ts
|
|
5897
5980
|
var SwapDriveRefusedError = class extends Error {
|
|
5898
5981
|
constructor(reason, detail, swapId) {
|
|
@@ -5959,14 +6042,23 @@ var createSwapDrive = (config) => {
|
|
|
5959
6042
|
return repository;
|
|
5960
6043
|
};
|
|
5961
6044
|
const undrivable = /* @__PURE__ */ new Set();
|
|
6045
|
+
const undrivableLegacy = /* @__PURE__ */ new Set();
|
|
5962
6046
|
let bridge;
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6047
|
+
let readThrough;
|
|
6048
|
+
const corridorStore = () => (
|
|
6049
|
+
// LEGACY(v1): unwrap to `bridge` alone once the read-through goes.
|
|
6050
|
+
readThrough ??= withLegacyRfqSwaps(
|
|
6051
|
+
bridge ??= corridorRecordStore(
|
|
6052
|
+
storage(),
|
|
6053
|
+
remember,
|
|
6054
|
+
// Terminal records stay readable but are excluded from the manager's read, sparing
|
|
6055
|
+
// a rebuild per record just to file it `finished`. The index still learns their
|
|
6056
|
+
// `rfqId` (see `getRfqSwapsPage`).
|
|
6057
|
+
(r) => !undrivable.has(r.id) && !isRfqSwapTerminal(r.state)
|
|
6058
|
+
),
|
|
6059
|
+
storage(),
|
|
6060
|
+
(r) => !undrivableLegacy.has(r.rfqId) && !isRfqSwapTerminal(r.state)
|
|
6061
|
+
)
|
|
5970
6062
|
);
|
|
5971
6063
|
const effectiveState = (swap) => {
|
|
5972
6064
|
if (mode === "auto") return swap.state;
|
|
@@ -6061,7 +6153,7 @@ var createSwapDrive = (config) => {
|
|
|
6061
6153
|
const secret = rfqClaimSecretOf(record);
|
|
6062
6154
|
if (!secret) throw new Error(`rfq swap ${swap.rfqId} carries no claim secret`);
|
|
6063
6155
|
const preimage = await preimageForSwapRecord(wallet, secret);
|
|
6064
|
-
const signer = await (0,
|
|
6156
|
+
const signer = await (0, import_sdk28.contractSigner)(wallet, await (0, import_sdk28.identityDescriptor)(wallet.identity));
|
|
6065
6157
|
const claimKey = record.profile.claimKey;
|
|
6066
6158
|
if (typeof claimKey === "string") {
|
|
6067
6159
|
const held = import_base17.hex.encode(await signer.xOnlyPublicKey());
|
|
@@ -6105,7 +6197,7 @@ var createSwapDrive = (config) => {
|
|
|
6105
6197
|
}
|
|
6106
6198
|
};
|
|
6107
6199
|
const drivable = async (record) => !readsChain(record.kind) || await resolveOnchain();
|
|
6108
|
-
const pinnedNetwork = async () => (0,
|
|
6200
|
+
const pinnedNetwork = async () => (0, import_sdk28.getNetwork)(await config.network());
|
|
6109
6201
|
const claimLockup = async (swap, vtxos, { partiallyClaimed }) => {
|
|
6110
6202
|
const record = await corridorStore().getRfqSwap(swap.rfqId);
|
|
6111
6203
|
if (!record) throw new Error(`rfq swap ${swap.rfqId} has no stored record to claim from`);
|
|
@@ -6120,10 +6212,10 @@ var createSwapDrive = (config) => {
|
|
|
6120
6212
|
return track(
|
|
6121
6213
|
pushClaim(operator, {
|
|
6122
6214
|
contract: script,
|
|
6123
|
-
receiver: await (0,
|
|
6215
|
+
receiver: await (0, import_sdk28.contractSigner)(wallet, secret.signingDescriptor),
|
|
6124
6216
|
preimage: await preimageForSwapRecord(wallet, secret),
|
|
6125
6217
|
vtxos,
|
|
6126
|
-
destinationPkScript:
|
|
6218
|
+
destinationPkScript: import_sdk28.ArkAddress.decode(payoutAddress).pkScript,
|
|
6127
6219
|
// Passed through: `pushClaim`'s own value check decides whether `P` is published.
|
|
6128
6220
|
expectedAmount: swap.expectedAmount,
|
|
6129
6221
|
partiallyClaimed,
|
|
@@ -6190,8 +6282,10 @@ var createSwapDrive = (config) => {
|
|
|
6190
6282
|
config.network()
|
|
6191
6283
|
]);
|
|
6192
6284
|
const txs = history.map(toRestoreTx);
|
|
6193
|
-
const { hrp, serverPubKey: operatorPubkey } =
|
|
6194
|
-
const
|
|
6285
|
+
const { hrp, serverPubKey: operatorPubkey } = import_sdk28.ArkAddress.decode(address);
|
|
6286
|
+
const reopened = await legacyOfferDepositsToReopen(store);
|
|
6287
|
+
if (reopen !== void 0) reopened.add(reopen);
|
|
6288
|
+
const cursor = reopened.size === 0 ? scanned : new Set([...scanned].filter((txid) => !reopened.has(txid)));
|
|
6195
6289
|
const { restored, scannedTxids } = await restoreAssetSwaps(indexer, txs, /* @__PURE__ */ new Set(), {
|
|
6196
6290
|
operatorPubkey,
|
|
6197
6291
|
scanned: cursor,
|
|
@@ -6293,12 +6387,16 @@ var createSwapDrive = (config) => {
|
|
|
6293
6387
|
const liveCorridor = corridor.filter((record) => !isRfqSwapTerminal(record.state));
|
|
6294
6388
|
const store = corridorStore();
|
|
6295
6389
|
for (const record of liveCorridor) store.index(record);
|
|
6296
|
-
|
|
6390
|
+
const liveLegacy = await legacyLiveRfqSwaps(repository);
|
|
6391
|
+
if (liveCorridor.length > 0 || liveLegacy.length > 0) {
|
|
6297
6392
|
try {
|
|
6298
6393
|
await contractsOf();
|
|
6299
6394
|
for (const record of liveCorridor) {
|
|
6300
6395
|
if (!await drivable(record)) undrivable.add(record.id);
|
|
6301
6396
|
}
|
|
6397
|
+
for (const record of liveLegacy) {
|
|
6398
|
+
if (!await drivable(record)) undrivableLegacy.add(record.rfqId);
|
|
6399
|
+
}
|
|
6302
6400
|
managerDeps.repository = store;
|
|
6303
6401
|
const result = await manager.restoreFromRepository();
|
|
6304
6402
|
for (const swap of result.restored) {
|
|
@@ -6951,7 +7049,7 @@ var feedSpread = (plan, take, carrierSats = 0n) => {
|
|
|
6951
7049
|
const spread = fair - payout;
|
|
6952
7050
|
return spread > 0n ? spread : 0n;
|
|
6953
7051
|
};
|
|
6954
|
-
var sellsAssetForBtc = (endpoints) =>
|
|
7052
|
+
var sellsAssetForBtc = (endpoints) => !isBtcAsset(endpoints.give.asset) && isBtcAsset(endpoints.take.asset);
|
|
6955
7053
|
var feedExpiry = (card, feed, now) => {
|
|
6956
7054
|
const readAt = card.price_feed === void 0 ? void 0 : feed.fetchedAt(card.price_feed);
|
|
6957
7055
|
const from = readAt === void 0 ? now : Math.floor(readAt / 1e3);
|
|
@@ -6972,7 +7070,7 @@ var verifyPlanLegs = (plan, legs, give) => {
|
|
|
6972
7070
|
|
|
6973
7071
|
// src/client/quoteRfq.ts
|
|
6974
7072
|
var import_base18 = require("@scure/base");
|
|
6975
|
-
var
|
|
7073
|
+
var import_sdk31 = require("@arkade-os/sdk");
|
|
6976
7074
|
var import_solver_discovery9 = require("@arkade-os/solver-discovery");
|
|
6977
7075
|
init_claimPacket();
|
|
6978
7076
|
init_offer();
|
|
@@ -6981,11 +7079,11 @@ init_onchainHtlc();
|
|
|
6981
7079
|
init_onchainHtlc();
|
|
6982
7080
|
|
|
6983
7081
|
// src/payment/onchainSwap.ts
|
|
6984
|
-
var
|
|
7082
|
+
var import_sdk30 = require("@arkade-os/sdk");
|
|
6985
7083
|
init_onchainHtlc();
|
|
6986
7084
|
|
|
6987
7085
|
// src/payment/swapRail.ts
|
|
6988
|
-
var
|
|
7086
|
+
var import_sdk29 = require("@arkade-os/sdk");
|
|
6989
7087
|
|
|
6990
7088
|
// src/client/sats.ts
|
|
6991
7089
|
var satsOf = (value, field) => {
|
|
@@ -7042,13 +7140,13 @@ var lockupOf = (derived) => ({
|
|
|
7042
7140
|
pkScript: derived.swapPkScript
|
|
7043
7141
|
});
|
|
7044
7142
|
var covenantInputs = (input) => {
|
|
7045
|
-
const network = (0,
|
|
7143
|
+
const network = (0, import_sdk31.networkFromArkadeInfo)(input.info);
|
|
7046
7144
|
const arkade2 = input.corridors.get("arkade").deps;
|
|
7047
7145
|
return {
|
|
7048
|
-
operatorPubkey: (0,
|
|
7146
|
+
operatorPubkey: (0, import_sdk31.toXOnly)(import_base18.hex.decode(input.info.signerPubkey), "ark signer key"),
|
|
7049
7147
|
// The resolved per-network pin, never operator-reported: it lands in a covenant leaf
|
|
7050
7148
|
// that decides who can move the funds.
|
|
7051
|
-
emulatorPubkey: (0,
|
|
7149
|
+
emulatorPubkey: (0, import_sdk31.toXOnly)(import_base18.hex.decode(arkade2.emulatorPubkey), "emulator signer key"),
|
|
7052
7150
|
claimDelay: unilateralClaimDelay(Number(input.info.unilateralExitDelay)),
|
|
7053
7151
|
hrp: network.hrp
|
|
7054
7152
|
};
|
|
@@ -7185,14 +7283,14 @@ var assetSidesOf = (legs) => {
|
|
|
7185
7283
|
{ give: "arkade", take: "arkade" }
|
|
7186
7284
|
);
|
|
7187
7285
|
}
|
|
7188
|
-
return giveIsBtc ? { wantAsset:
|
|
7286
|
+
return giveIsBtc ? { wantAsset: import_sdk31.asset.AssetId.fromString(legs.take.assetId) } : { offerAsset: import_sdk31.asset.AssetId.fromString(legs.give.assetId) };
|
|
7189
7287
|
};
|
|
7190
7288
|
var makerPosition = async (wallet) => {
|
|
7191
7289
|
const [address, publicKey] = await Promise.all([
|
|
7192
7290
|
wallet.getAddress(),
|
|
7193
7291
|
wallet.identity.xOnlyPublicKey()
|
|
7194
7292
|
]);
|
|
7195
|
-
return { pkScript:
|
|
7293
|
+
return { pkScript: import_sdk31.ArkAddress.decode(address).pkScript, publicKey };
|
|
7196
7294
|
};
|
|
7197
7295
|
var quoteLightningSend = async (input) => {
|
|
7198
7296
|
const invoice = input.endpoints.take.instrument;
|
|
@@ -7201,7 +7299,7 @@ var quoteLightningSend = async (input) => {
|
|
|
7201
7299
|
}
|
|
7202
7300
|
const pair = rfqPairFor(input.legs.give, input.legs.take);
|
|
7203
7301
|
const rfqId = newRfqId();
|
|
7204
|
-
const secrets = await (0,
|
|
7302
|
+
const secrets = await (0, import_sdk31.provisionRefundKey)(input.wallet);
|
|
7205
7303
|
const wire = await input.transport.requestQuote(
|
|
7206
7304
|
lightningSendRequest({
|
|
7207
7305
|
rfqId,
|
|
@@ -7270,7 +7368,7 @@ var quoteLightningReceive = async (input) => {
|
|
|
7270
7368
|
const pinned = pinnedFor(input);
|
|
7271
7369
|
const pair = rfqPairFor(input.legs.give, input.legs.take);
|
|
7272
7370
|
const rfqId = newRfqId();
|
|
7273
|
-
const secrets = await (0,
|
|
7371
|
+
const secrets = await (0, import_sdk31.provisionClaimSecret)(input.wallet);
|
|
7274
7372
|
const paymentHash = import_base18.hex.encode(secrets.paymentHash);
|
|
7275
7373
|
const payoutAddress = await input.wallet.getAddress();
|
|
7276
7374
|
const lightning = input.corridors.get("lightning").deps;
|
|
@@ -7382,8 +7480,8 @@ var quoteOnchainSend = async (input) => {
|
|
|
7382
7480
|
claimVsize: onchain.claimVsize
|
|
7383
7481
|
}) : void 0;
|
|
7384
7482
|
const quoted = claimFee === void 0 ? pinned : { on: pinned.on, value: pinned.value + claimFee, source: pinned.source };
|
|
7385
|
-
const secrets = await (0,
|
|
7386
|
-
const payoutKey = await (0,
|
|
7483
|
+
const secrets = await (0, import_sdk31.provisionClaimSecret)(input.wallet);
|
|
7484
|
+
const payoutKey = await (0, import_sdk31.provisionRefundKey)(input.wallet);
|
|
7387
7485
|
const paymentHash = import_base18.hex.encode(secrets.paymentHash);
|
|
7388
7486
|
const wire = await input.transport.requestQuote(
|
|
7389
7487
|
withCanonicalAmount(
|
|
@@ -7480,7 +7578,7 @@ var quoteOnchainSend = async (input) => {
|
|
|
7480
7578
|
};
|
|
7481
7579
|
|
|
7482
7580
|
// src/client/verbs.ts
|
|
7483
|
-
var
|
|
7581
|
+
var import_sdk32 = require("@arkade-os/sdk");
|
|
7484
7582
|
var enforceFeeCeiling = (quote, call, policy) => {
|
|
7485
7583
|
let ceiling;
|
|
7486
7584
|
for (const [source, limit] of [
|
|
@@ -7505,9 +7603,9 @@ var settle = async (deps, input, maxFee) => {
|
|
|
7505
7603
|
return deps.accept(quote);
|
|
7506
7604
|
};
|
|
7507
7605
|
var pay = async (deps, destination, options = {}) => {
|
|
7508
|
-
const arkade2 = (0,
|
|
7606
|
+
const arkade2 = (0, import_sdk32.arkTarget)(destination);
|
|
7509
7607
|
if (arkade2 !== void 0) {
|
|
7510
|
-
const amount = (0,
|
|
7608
|
+
const amount = (0, import_sdk32.resolveSendAmount)(
|
|
7511
7609
|
"ark",
|
|
7512
7610
|
destination,
|
|
7513
7611
|
options.amount === void 0 ? void 0 : satsOf(options.amount, "amount")
|
|
@@ -7820,7 +7918,7 @@ var createSwapClient = (config) => {
|
|
|
7820
7918
|
|
|
7821
7919
|
// src/reveal.ts
|
|
7822
7920
|
var import_base20 = require("@scure/base");
|
|
7823
|
-
var
|
|
7921
|
+
var import_sdk33 = require("@arkade-os/sdk");
|
|
7824
7922
|
init_claimPacket();
|
|
7825
7923
|
init_onchainHtlc();
|
|
7826
7924
|
var CovclaimdRevealError = class extends Error {
|
|
@@ -7926,7 +8024,7 @@ function revealFieldsFromScript(script) {
|
|
|
7926
8024
|
}
|
|
7927
8025
|
async function revealClaimPacket(client, input) {
|
|
7928
8026
|
const fields = revealFieldsFromScript(input.script);
|
|
7929
|
-
if (import_base20.hex.encode(
|
|
8027
|
+
if (import_base20.hex.encode(import_sdk33.ArkAddress.decode(input.address).pkScript) !== import_base20.hex.encode(input.script.pkScript)) {
|
|
7930
8028
|
throw new Error("address does not belong to this covenant");
|
|
7931
8029
|
}
|
|
7932
8030
|
assertPreimageMatches(input.preimage, input.script.options.preimageHash);
|
|
@@ -7991,6 +8089,7 @@ async function revealClaimPacket(client, input) {
|
|
|
7991
8089
|
assetSwapIdOf,
|
|
7992
8090
|
attesting,
|
|
7993
8091
|
bitcoinNetworkOf,
|
|
8092
|
+
btcAssetPart,
|
|
7994
8093
|
btcOn,
|
|
7995
8094
|
cancelSwap,
|
|
7996
8095
|
canonicalAssetId,
|
|
@@ -8026,6 +8125,8 @@ async function revealClaimPacket(client, input) {
|
|
|
8026
8125
|
isAddressable,
|
|
8027
8126
|
isAssetId,
|
|
8028
8127
|
isAtomicDecimal,
|
|
8128
|
+
isBtcAsset,
|
|
8129
|
+
isBtcAssetLenient,
|
|
8029
8130
|
isCardMarket,
|
|
8030
8131
|
isIndexedNetwork,
|
|
8031
8132
|
isNetworkRef,
|
|
@@ -8044,6 +8145,7 @@ async function revealClaimPacket(client, input) {
|
|
|
8044
8145
|
offerOutcome,
|
|
8045
8146
|
offerRecordSource,
|
|
8046
8147
|
onchainCorridor,
|
|
8148
|
+
pageRfqRecords,
|
|
8047
8149
|
parseAssetId,
|
|
8048
8150
|
parseRfqQuote,
|
|
8049
8151
|
pay,
|
package/dist/advanced.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-
|
|
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 './errors-O-27mWDX.cjs';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-O-27mWDX.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
|
|
5
|
-
export {
|
|
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-S2OS6Yl-.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 Artifact, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-S2OS6Yl-.cjs';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-60PGpQ_x.cjs';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-60PGpQ_x.cjs';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
|
-
import { OnchainProvider, NetworkName, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
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-BFMXLQV-.cjs';
|
|
11
|
+
import './offer-DCaE0YNp.cjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The alias table, filled from discovery: the inverse of `toDiscoveryLeg`, mapping a card's
|
|
@@ -192,6 +192,8 @@ declare const rfqRecordOf: (record: CorridorSwapRecord) => RfqSwapRecord;
|
|
|
192
192
|
* included, is carried through untouched — the manager never learns it.
|
|
193
193
|
*/
|
|
194
194
|
declare const withRfqState: (record: CorridorSwapRecord, state: RfqSwapRecord) => CorridorSwapRecord;
|
|
195
|
+
/** One keyset page over records already in memory, in the repository's `(updatedAt, rfqId)` order. */
|
|
196
|
+
declare const pageRfqRecords: (records: readonly RfqSwapRecord[], filter: RfqSwapPageFilter, page: PageRequest<RfqSwapPageCursor>) => PageResult<RfqSwapRecord, RfqSwapPageCursor>;
|
|
195
197
|
/** What a bridge or source hands back to the drive after a write. */
|
|
196
198
|
type RecordSink = (record: SwapRecord) => void;
|
|
197
199
|
interface CorridorRecordStore extends RfqSwapRecordStore {
|
|
@@ -538,4 +540,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
538
540
|
ciphertext: string;
|
|
539
541
|
}>;
|
|
540
542
|
|
|
541
|
-
export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, publicAssetId, resolveRoute, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
|
543
|
+
export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, resolveRoute, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-
|
|
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 './errors-DYGuDb4G.js';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-DYGuDb4G.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
|
|
5
|
-
export {
|
|
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-V98jQmTD.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 Artifact, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-V98jQmTD.js';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-60PGpQ_x.js';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-60PGpQ_x.js';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
|
-
import { OnchainProvider, NetworkName, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer
|
|
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-3pNJbc4T.js';
|
|
11
|
+
import './offer-CJzNPS5H.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The alias table, filled from discovery: the inverse of `toDiscoveryLeg`, mapping a card's
|
|
@@ -192,6 +192,8 @@ declare const rfqRecordOf: (record: CorridorSwapRecord) => RfqSwapRecord;
|
|
|
192
192
|
* included, is carried through untouched — the manager never learns it.
|
|
193
193
|
*/
|
|
194
194
|
declare const withRfqState: (record: CorridorSwapRecord, state: RfqSwapRecord) => CorridorSwapRecord;
|
|
195
|
+
/** One keyset page over records already in memory, in the repository's `(updatedAt, rfqId)` order. */
|
|
196
|
+
declare const pageRfqRecords: (records: readonly RfqSwapRecord[], filter: RfqSwapPageFilter, page: PageRequest<RfqSwapPageCursor>) => PageResult<RfqSwapRecord, RfqSwapPageCursor>;
|
|
195
197
|
/** What a bridge or source hands back to the drive after a write. */
|
|
196
198
|
type RecordSink = (record: SwapRecord) => void;
|
|
197
199
|
interface CorridorRecordStore extends RfqSwapRecordStore {
|
|
@@ -538,4 +540,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
538
540
|
ciphertext: string;
|
|
539
541
|
}>;
|
|
540
542
|
|
|
541
|
-
export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, publicAssetId, resolveRoute, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
|
543
|
+
export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, resolveRoute, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|