@arkade-os/swap 0.1.4 → 0.1.6
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 +228 -63
- package/dist/advanced.d.cts +6 -6
- package/dist/advanced.d.ts +6 -6
- package/dist/advanced.js +2 -2
- package/dist/{chunk-GJKGPE3S.js → chunk-QFM55KP2.js} +175 -29
- package/dist/{chunk-HDCC3JZR.js → chunk-SDPNWPGY.js} +30 -2
- package/dist/index.cjs +219 -54
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/{lockupContract-CdXh9yIr.d.ts → lockupContract-CKPFpIt9.d.ts} +1 -1
- package/dist/{lockupContract-QfbsjyXG.d.cts → lockupContract-CpJXTjX_.d.cts} +1 -1
- package/dist/{offer-BxzPQ6zh.d.cts → offer-Boxive2u.d.cts} +1 -1
- package/dist/{offer-Q1lVhrVX.d.ts → offer-Drw1k_jt.d.ts} +1 -1
- package/dist/{offerFillPlan-CvKlB246.d.cts → offerFillPlan-BxNkWLtw.d.cts} +4 -4
- package/dist/{offerFillPlan-_PhFt4B1.d.ts → offerFillPlan-D2N4s7Xe.d.ts} +4 -4
- package/dist/protocol.cjs +83 -33
- package/dist/protocol.d.cts +11 -27
- package/dist/protocol.d.ts +11 -27
- 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-Cut4eEkm.d.cts → repository-DFDNvcZ7.d.cts} +26 -4
- package/dist/{repository-BOQ1qYoj.d.ts → repository-Dn1V17T2.d.ts} +26 -4
- package/dist/{watch-D15U0QpD.d.ts → watch-D-mc_wfD.d.ts} +1 -1
- package/dist/{watch-D4PeBZ3H.d.cts → watch-DFNMY2K-.d.cts} +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2946,7 +2946,7 @@ __export(index_exports, {
|
|
|
2946
2946
|
module.exports = __toCommonJS(index_exports);
|
|
2947
2947
|
|
|
2948
2948
|
// src/client/client.ts
|
|
2949
|
-
var
|
|
2949
|
+
var import_base23 = require("@scure/base");
|
|
2950
2950
|
var import_sdk37 = require("@arkade-os/sdk");
|
|
2951
2951
|
init_repository();
|
|
2952
2952
|
|
|
@@ -3037,10 +3037,11 @@ async function readLockupFate(indexer, input) {
|
|
|
3037
3037
|
const spentBy = /* @__PURE__ */ new Map();
|
|
3038
3038
|
let everySpendNamed = true;
|
|
3039
3039
|
let sweptLeft = false;
|
|
3040
|
+
let live = false;
|
|
3040
3041
|
for (const vtxo of all) {
|
|
3041
3042
|
if (!(0, import_sdk8.isVtxoSpent)(vtxo)) {
|
|
3042
|
-
if (
|
|
3043
|
-
|
|
3043
|
+
if (input.receiver && vtxo.isSwept) sweptLeft = true;
|
|
3044
|
+
else live = true;
|
|
3044
3045
|
continue;
|
|
3045
3046
|
}
|
|
3046
3047
|
if (vtxo.spentBy)
|
|
@@ -3050,8 +3051,16 @@ async function readLockupFate(indexer, input) {
|
|
|
3050
3051
|
});
|
|
3051
3052
|
else everySpendNamed = false;
|
|
3052
3053
|
}
|
|
3054
|
+
if (live && (!input.receiver || spentBy.size === 0)) return { fate: "open" };
|
|
3053
3055
|
const spends = [...spentBy.values()];
|
|
3054
|
-
const
|
|
3056
|
+
const arkTxids = new Set(spends.flatMap((spend) => spend.txid ? [spend.txid] : []));
|
|
3057
|
+
let txs;
|
|
3058
|
+
try {
|
|
3059
|
+
({ txs } = await indexer.getVirtualTxs([.../* @__PURE__ */ new Set([...spentBy.keys(), ...arkTxids])]));
|
|
3060
|
+
} catch (error) {
|
|
3061
|
+
if (live) return { fate: "open" };
|
|
3062
|
+
throw error;
|
|
3063
|
+
}
|
|
3055
3064
|
const refunded = /* @__PURE__ */ new Set();
|
|
3056
3065
|
const leafScripts = /* @__PURE__ */ new Set();
|
|
3057
3066
|
for (const raw of txs) {
|
|
@@ -3061,18 +3070,29 @@ async function readLockupFate(indexer, input) {
|
|
|
3061
3070
|
} catch {
|
|
3062
3071
|
continue;
|
|
3063
3072
|
}
|
|
3064
|
-
|
|
3073
|
+
const checkpoint = spentBy.has(tx.id);
|
|
3074
|
+
if (!checkpoint && !arkTxids.has(tx.id)) continue;
|
|
3065
3075
|
for (let i = 0; i < tx.inputsLength; i++) {
|
|
3066
3076
|
const spent = tx.getInput(i);
|
|
3067
3077
|
if (!spent.txid) continue;
|
|
3068
3078
|
const txid = import_base7.hex.encode(spent.txid);
|
|
3079
|
+
if (!checkpoint) {
|
|
3080
|
+
if (spent.index !== 0 || !spentBy.has(txid)) continue;
|
|
3081
|
+
const preimage = candidateWitnessItems(tx, i).find(
|
|
3082
|
+
(candidate) => hashesTo(candidate, input.paymentHash)
|
|
3083
|
+
);
|
|
3084
|
+
if (preimage) {
|
|
3085
|
+
return live ? { fate: "open", preimage } : { fate: "claimed", preimage, spends };
|
|
3086
|
+
}
|
|
3087
|
+
continue;
|
|
3088
|
+
}
|
|
3069
3089
|
const vtxo = all.find(
|
|
3070
3090
|
(vtxo2) => vtxo2.txid === txid && vtxo2.vout === spent.index && vtxo2.spentBy === tx.id
|
|
3071
3091
|
);
|
|
3072
3092
|
if (!vtxo) continue;
|
|
3073
3093
|
for (const candidate of candidateWitnessItems(tx, i)) {
|
|
3074
3094
|
if (hashesTo(candidate, input.paymentHash)) {
|
|
3075
|
-
return { fate: "claimed", preimage: candidate, spends };
|
|
3095
|
+
return live ? { fate: "open", preimage: candidate } : { fate: "claimed", preimage: candidate, spends };
|
|
3076
3096
|
}
|
|
3077
3097
|
}
|
|
3078
3098
|
const leafScript = refundLeafScript(tx, i);
|
|
@@ -3082,7 +3102,7 @@ async function readLockupFate(indexer, input) {
|
|
|
3082
3102
|
}
|
|
3083
3103
|
}
|
|
3084
3104
|
}
|
|
3085
|
-
if (sweptLeft) return { fate: "open" };
|
|
3105
|
+
if (live || sweptLeft) return { fate: "open" };
|
|
3086
3106
|
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends, leafScripts: [...leafScripts] } : { fate: "unknown" };
|
|
3087
3107
|
}
|
|
3088
3108
|
var assertNoneSwept = (vtxos, contract) => {
|
|
@@ -6309,9 +6329,10 @@ var retireOfferScripts = async (wallet, repository, record) => {
|
|
|
6309
6329
|
|
|
6310
6330
|
// src/client/drive.ts
|
|
6311
6331
|
var import_sdk31 = require("@arkade-os/sdk");
|
|
6312
|
-
var
|
|
6332
|
+
var import_base20 = require("@scure/base");
|
|
6313
6333
|
|
|
6314
6334
|
// src/claim.ts
|
|
6335
|
+
var import_base17 = require("@scure/base");
|
|
6315
6336
|
var import_sdk25 = require("@arkade-os/sdk");
|
|
6316
6337
|
init_onchainHtlc();
|
|
6317
6338
|
var LockupAmountMismatchError = class extends Error {
|
|
@@ -6363,6 +6384,95 @@ async function pushClaim(operator, input) {
|
|
|
6363
6384
|
});
|
|
6364
6385
|
return { txid, amount: locked, left: live.length - vtxos.length, spent: vtxos };
|
|
6365
6386
|
}
|
|
6387
|
+
async function findPendingClaims(operator, indexer, input) {
|
|
6388
|
+
const { vtxos } = await indexer.getVtxos({
|
|
6389
|
+
scripts: [import_base17.hex.encode(input.contract.pkScript)],
|
|
6390
|
+
pendingOnly: true
|
|
6391
|
+
});
|
|
6392
|
+
const byArkTx = /* @__PURE__ */ new Map();
|
|
6393
|
+
for (const vtxo of vtxos ?? []) {
|
|
6394
|
+
if (!(0, import_sdk25.isVtxoSpent)(vtxo) || !vtxo.spentBy || !vtxo.arkTxId) continue;
|
|
6395
|
+
byArkTx.set(vtxo.arkTxId, [...byArkTx.get(vtxo.arkTxId) ?? [], vtxo]);
|
|
6396
|
+
}
|
|
6397
|
+
if (byArkTx.size === 0) return [];
|
|
6398
|
+
const current = await operatorUnrollScript(operator, input.network);
|
|
6399
|
+
const { deprecatedSigners } = await operator.getInfo();
|
|
6400
|
+
const unrollScripts = [
|
|
6401
|
+
current,
|
|
6402
|
+
...(deprecatedSigners ?? []).flatMap(
|
|
6403
|
+
({ pubkey }) => pubkey ? [
|
|
6404
|
+
import_sdk25.CSVMultisigTapscript.encode({
|
|
6405
|
+
...current.params,
|
|
6406
|
+
pubkeys: [(0, import_sdk25.toXOnly)(import_base17.hex.decode(pubkey), "deprecated signer")]
|
|
6407
|
+
})
|
|
6408
|
+
] : []
|
|
6409
|
+
)
|
|
6410
|
+
];
|
|
6411
|
+
const claims = [];
|
|
6412
|
+
for (const [arkTxid, spent] of byArkTx) {
|
|
6413
|
+
const live = spent.map(({ txid, vout, value }) => ({
|
|
6414
|
+
txid,
|
|
6415
|
+
vout,
|
|
6416
|
+
value: Number(value),
|
|
6417
|
+
recoverable: false
|
|
6418
|
+
}));
|
|
6419
|
+
const total = live.reduce((sum, vtxo) => sum + vtxo.value, 0);
|
|
6420
|
+
const checkpoints = unrollScripts.map(
|
|
6421
|
+
(unroll) => (0, import_sdk25.buildOffchainTx)(
|
|
6422
|
+
lockupInputs(live, input.contract, input.contract.claim()),
|
|
6423
|
+
[{ script: input.contract.pkScript, amount: BigInt(total) }],
|
|
6424
|
+
unroll
|
|
6425
|
+
).checkpoints
|
|
6426
|
+
).find(
|
|
6427
|
+
(built) => built.length === spent.length && built.every((checkpoint, i) => checkpoint.id === spent[i].spentBy)
|
|
6428
|
+
);
|
|
6429
|
+
if (checkpoints) claims.push({ arkTxid, checkpoints });
|
|
6430
|
+
}
|
|
6431
|
+
return claims;
|
|
6432
|
+
}
|
|
6433
|
+
async function finalizePendingClaim(operator, indexer, input) {
|
|
6434
|
+
const claims = await findPendingClaims(operator, indexer, input);
|
|
6435
|
+
if (claims.length === 0) return [];
|
|
6436
|
+
assertPreimageMatches(input.preimage, input.contract.options.preimageHash);
|
|
6437
|
+
const signer = (0, import_sdk25.claimWithPreimageIdentity)(input.receiver, input.preimage);
|
|
6438
|
+
const ours = import_base17.hex.encode(await input.receiver.xOnlyPublicKey());
|
|
6439
|
+
const finalized = [];
|
|
6440
|
+
for (const { arkTxid, checkpoints } of claims) {
|
|
6441
|
+
const { txs } = await indexer.getVirtualTxs(checkpoints.map((checkpoint) => checkpoint.id));
|
|
6442
|
+
const stored = new Map(
|
|
6443
|
+
txs.map((raw) => {
|
|
6444
|
+
const tx = import_sdk25.Transaction.fromPSBT(import_base17.base64.decode(raw));
|
|
6445
|
+
return [tx.id, tx];
|
|
6446
|
+
})
|
|
6447
|
+
);
|
|
6448
|
+
const signed = await Promise.all(
|
|
6449
|
+
checkpoints.map(async (checkpoint) => {
|
|
6450
|
+
const theirs = stored.get(checkpoint.id);
|
|
6451
|
+
if (!theirs) {
|
|
6452
|
+
throw new Error(
|
|
6453
|
+
`pending claim ${arkTxid}: no stored checkpoint ${checkpoint.id}`
|
|
6454
|
+
);
|
|
6455
|
+
}
|
|
6456
|
+
const server = (theirs.getInput(0).tapScriptSig ?? []).filter(
|
|
6457
|
+
([{ pubKey }]) => import_base17.hex.encode(pubKey) !== ours
|
|
6458
|
+
);
|
|
6459
|
+
if (server.length === 0) {
|
|
6460
|
+
throw new Error(
|
|
6461
|
+
`pending claim ${arkTxid}: the indexer served checkpoint ${checkpoint.id} without the operator's signature, so it cannot be finalized from here`
|
|
6462
|
+
);
|
|
6463
|
+
}
|
|
6464
|
+
const tx = await signer.sign(checkpoint, [0]);
|
|
6465
|
+
tx.updateInput(0, {
|
|
6466
|
+
tapScriptSig: [...tx.getInput(0).tapScriptSig ?? [], ...server]
|
|
6467
|
+
});
|
|
6468
|
+
return import_base17.base64.encode(tx.toPSBT());
|
|
6469
|
+
})
|
|
6470
|
+
);
|
|
6471
|
+
await operator.finalizeTx(arkTxid, signed);
|
|
6472
|
+
finalized.push(arkTxid);
|
|
6473
|
+
}
|
|
6474
|
+
return finalized;
|
|
6475
|
+
}
|
|
6366
6476
|
|
|
6367
6477
|
// src/client/drive.ts
|
|
6368
6478
|
init_onchainHtlc();
|
|
@@ -6589,7 +6699,7 @@ init_store();
|
|
|
6589
6699
|
init_repository();
|
|
6590
6700
|
|
|
6591
6701
|
// src/swapManager.ts
|
|
6592
|
-
var
|
|
6702
|
+
var import_base18 = require("@scure/base");
|
|
6593
6703
|
var import_sdk28 = require("@arkade-os/sdk");
|
|
6594
6704
|
init_onchainHtlc();
|
|
6595
6705
|
init_lockupContract();
|
|
@@ -7076,13 +7186,13 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7076
7186
|
// ── internals ────────────────────────────────────────────────────────────
|
|
7077
7187
|
track(swap) {
|
|
7078
7188
|
this.monitored.set(swap.rfqId, swap);
|
|
7079
|
-
this.byLockupScript.set(
|
|
7189
|
+
this.byLockupScript.set(import_base18.hex.encode(swap.lockupPkScript), swap);
|
|
7080
7190
|
}
|
|
7081
7191
|
/** Drops the swap from BOTH indexes. `pollSwap`'s `monitored` check also stops a late
|
|
7082
7192
|
* event, deliberately redundant so neither change alone re-drives a removed swap. */
|
|
7083
7193
|
untrack(rfqId) {
|
|
7084
7194
|
const swap = this.monitored.get(rfqId);
|
|
7085
|
-
if (swap) this.byLockupScript.delete(
|
|
7195
|
+
if (swap) this.byLockupScript.delete(import_base18.hex.encode(swap.lockupPkScript));
|
|
7086
7196
|
this.monitored.delete(rfqId);
|
|
7087
7197
|
this.refundRefused.delete(rfqId);
|
|
7088
7198
|
this.claimedOutpoints.delete(rfqId);
|
|
@@ -7128,7 +7238,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7128
7238
|
if (!lockup) {
|
|
7129
7239
|
try {
|
|
7130
7240
|
const [existing] = await contracts.getContracts({
|
|
7131
|
-
script:
|
|
7241
|
+
script: import_base18.hex.encode(swap.lockupPkScript)
|
|
7132
7242
|
});
|
|
7133
7243
|
if (existing) {
|
|
7134
7244
|
this.registered.set(swap.rfqId, true);
|
|
@@ -7147,13 +7257,13 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7147
7257
|
);
|
|
7148
7258
|
return;
|
|
7149
7259
|
}
|
|
7150
|
-
const script =
|
|
7151
|
-
if (script !==
|
|
7260
|
+
const script = import_base18.hex.encode(lockup.script.pkScript);
|
|
7261
|
+
if (script !== import_base18.hex.encode(swap.lockupPkScript)) {
|
|
7152
7262
|
this.registered.set(swap.rfqId, false);
|
|
7153
7263
|
this.emitFailed(
|
|
7154
7264
|
swap,
|
|
7155
7265
|
new Error(
|
|
7156
|
-
`swap ${swap.rfqId} lockup script ${script} does not match its lockupPkScript ${
|
|
7266
|
+
`swap ${swap.rfqId} lockup script ${script} does not match its lockupPkScript ${import_base18.hex.encode(swap.lockupPkScript)}`
|
|
7157
7267
|
)
|
|
7158
7268
|
);
|
|
7159
7269
|
return;
|
|
@@ -7170,7 +7280,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7170
7280
|
retireContract(swap) {
|
|
7171
7281
|
if (!this.deps.contracts || !this.registered.get(swap.rfqId)) return;
|
|
7172
7282
|
if (!LOCKUP_RETIRABLE.includes(swap.state)) return;
|
|
7173
|
-
void this.deps.contracts.setContractWatchState(
|
|
7283
|
+
void this.deps.contracts.setContractWatchState(import_base18.hex.encode(swap.lockupPkScript), "retained").catch((error) => this.emitFailed(swap, error));
|
|
7174
7284
|
}
|
|
7175
7285
|
arm() {
|
|
7176
7286
|
if (!this.running) return;
|
|
@@ -7230,6 +7340,11 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7230
7340
|
)) {
|
|
7231
7341
|
fate = { fate: "unknown" };
|
|
7232
7342
|
}
|
|
7343
|
+
if (swap.kind === "lightning_receive" && fate.fate !== "exited" && fate.fate !== "returned") {
|
|
7344
|
+
const pending = await this.finalizeOwnClaim(swap);
|
|
7345
|
+
const windowOpen = fate.fate === "open" && this.config.now() < swap.refundLocktime;
|
|
7346
|
+
if (pending !== "none" && !windowOpen) return;
|
|
7347
|
+
}
|
|
7233
7348
|
if (swap.kind === "onchain_receive") return this.driveOnchainReceive(swap, fate);
|
|
7234
7349
|
if (fate.fate === "claimed" || fate.fate === "returned") {
|
|
7235
7350
|
this.stampLockupSpends(swap, fate.spends);
|
|
@@ -7242,8 +7357,13 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7242
7357
|
}
|
|
7243
7358
|
if (swap.kind === "lightning_receive") {
|
|
7244
7359
|
if (fate.fate === "exited") return this.blockExitedLockup(swap, fate);
|
|
7245
|
-
if (fate.fate === "open")
|
|
7246
|
-
|
|
7360
|
+
if (fate.fate === "open") {
|
|
7361
|
+
return this.driveReceiveClaim(swap, fate.preimage !== void 0);
|
|
7362
|
+
}
|
|
7363
|
+
if (fate.fate === "unknown" && swap.claimTxid !== void 0) return;
|
|
7364
|
+
if (this.config.now() >= swap.refundLocktime) {
|
|
7365
|
+
return this.driveReceiveClaim(swap, false);
|
|
7366
|
+
}
|
|
7247
7367
|
return;
|
|
7248
7368
|
}
|
|
7249
7369
|
if (swap.kind === "onchain_send") {
|
|
@@ -7256,6 +7376,25 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7256
7376
|
}
|
|
7257
7377
|
await this.driveArkadeRefund(swap);
|
|
7258
7378
|
}
|
|
7379
|
+
/** `none` when no claim of ours is pending; `failed` covers a pending read that failed too. */
|
|
7380
|
+
async finalizeOwnClaim(swap) {
|
|
7381
|
+
const pendingClaims = this.callbacks?.pendingClaims;
|
|
7382
|
+
const finalize = this.callbacks?.finalizeClaim;
|
|
7383
|
+
if (!pendingClaims || !finalize || !this.config.enableAutoActions) return "none";
|
|
7384
|
+
try {
|
|
7385
|
+
const pending = await pendingClaims(swap);
|
|
7386
|
+
if (pending.length === 0) return "none";
|
|
7387
|
+
if (swap.claimTxid === void 0) {
|
|
7388
|
+
swap.claimTxid = pending[0];
|
|
7389
|
+
this.touch(swap);
|
|
7390
|
+
}
|
|
7391
|
+
await finalize(swap);
|
|
7392
|
+
return "finalized";
|
|
7393
|
+
} catch (error) {
|
|
7394
|
+
this.emitFailed(swap, error);
|
|
7395
|
+
return "failed";
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7259
7398
|
/**
|
|
7260
7399
|
* The lockup was unilaterally exited: its outputs sit onchain, beyond any offchain
|
|
7261
7400
|
* spend. `needs_counterparty`, not terminal: it can still end either way onchain. Set
|
|
@@ -7278,8 +7417,9 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7278
7417
|
*
|
|
7279
7418
|
* After the window the trader has no move; the manager only watches.
|
|
7280
7419
|
*/
|
|
7281
|
-
async driveReceiveClaim(swap) {
|
|
7420
|
+
async driveReceiveClaim(swap, revealed) {
|
|
7282
7421
|
const now = this.config.now();
|
|
7422
|
+
const claimOut = swap.claimTxid !== void 0 || revealed;
|
|
7283
7423
|
if (now < swap.refundLocktime) {
|
|
7284
7424
|
let vtxos;
|
|
7285
7425
|
try {
|
|
@@ -7288,26 +7428,25 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7288
7428
|
this.emitFailed(swap, error);
|
|
7289
7429
|
return;
|
|
7290
7430
|
}
|
|
7291
|
-
return this.claimIfFunded(swap, vtxos);
|
|
7431
|
+
return this.claimIfFunded(swap, vtxos, claimOut);
|
|
7292
7432
|
}
|
|
7293
7433
|
if (now < swap.refundLocktime + REFUND_MTP_LAG_SECONDS) {
|
|
7294
|
-
if (
|
|
7434
|
+
if (claimOut) return;
|
|
7295
7435
|
return this.block(
|
|
7296
7436
|
swap,
|
|
7297
7437
|
"the claim window closed with the lockup unclaimed \u2014 only the solver can act now"
|
|
7298
7438
|
);
|
|
7299
7439
|
}
|
|
7300
7440
|
const failure = swap.claimFailure;
|
|
7301
|
-
if (failure && !
|
|
7441
|
+
if (failure && !claimOut) {
|
|
7302
7442
|
return this.fail(swap, new Error(failure));
|
|
7303
7443
|
}
|
|
7304
7444
|
this.setState(swap, "refunded");
|
|
7305
7445
|
}
|
|
7306
7446
|
/** Claim what the solver funded, once it is enough (the inner gate that matters is
|
|
7307
7447
|
* `pushClaim`'s; see {@link RfqSwapManagerCallbacks.claimLockup}). */
|
|
7308
|
-
async claimIfFunded(swap, vtxos) {
|
|
7448
|
+
async claimIfFunded(swap, vtxos, partiallyClaimed) {
|
|
7309
7449
|
if (vtxos.length === 0) return this.unblock(swap);
|
|
7310
|
-
const partiallyClaimed = swap.claimTxid !== void 0;
|
|
7311
7450
|
const toClaim = partiallyClaimed ? this.unclaimed(swap.rfqId, vtxos) : vtxos;
|
|
7312
7451
|
if (toClaim.length === 0) {
|
|
7313
7452
|
return;
|
|
@@ -7387,7 +7526,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7387
7526
|
"the L1 funding was refunded, so claiming the lockup too would take both sides of the trade \u2014 the solver's reclaim ends this swap"
|
|
7388
7527
|
);
|
|
7389
7528
|
}
|
|
7390
|
-
await this.driveReceiveClaim(swap);
|
|
7529
|
+
await this.driveReceiveClaim(swap, false);
|
|
7391
7530
|
if (l1.blocked && !isRfqSwapTerminal(swap.state)) this.block(swap, l1.blocked);
|
|
7392
7531
|
}
|
|
7393
7532
|
/** `resolved`: the HTLC can hold nothing more. `blocked` is a refusal the
|
|
@@ -7708,7 +7847,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7708
7847
|
*/
|
|
7709
7848
|
stampSettlementPreimage(swap, preimage) {
|
|
7710
7849
|
if (swap.kind !== "lightning_send") return;
|
|
7711
|
-
swap.settlementPreimageHex =
|
|
7850
|
+
swap.settlementPreimageHex = import_base18.hex.encode(preimage);
|
|
7712
7851
|
this.touch(swap);
|
|
7713
7852
|
}
|
|
7714
7853
|
touch(swap) {
|
|
@@ -7831,7 +7970,7 @@ var errorMessage = (error) => error instanceof Error ? error.message : String(er
|
|
|
7831
7970
|
var outpointKey = (vtxo) => `${vtxo.txid}:${vtxo.vout}`;
|
|
7832
7971
|
|
|
7833
7972
|
// src/watch.ts
|
|
7834
|
-
var
|
|
7973
|
+
var import_base19 = require("@scure/base");
|
|
7835
7974
|
var import_sdk29 = require("@arkade-os/sdk");
|
|
7836
7975
|
init_coverage();
|
|
7837
7976
|
init_offer();
|
|
@@ -7880,9 +8019,9 @@ async function watchOfferSwaps({
|
|
|
7880
8019
|
if (candidates.length === 0) return "indeterminate";
|
|
7881
8020
|
const { txs } = await indexer.getVirtualTxs(candidates);
|
|
7882
8021
|
return classifyDepositSpend(
|
|
7883
|
-
decodeOffer(
|
|
8022
|
+
decodeOffer(import_base19.hex.decode(swap.offerHex)),
|
|
7884
8023
|
operatorPubkey,
|
|
7885
|
-
txs.map((psbt) => import_sdk29.Transaction.fromPSBT(
|
|
8024
|
+
txs.map((psbt) => import_sdk29.Transaction.fromPSBT(import_base19.base64.decode(psbt))),
|
|
7886
8025
|
{ txid: vtxo.txid, vout: vtxo.vout }
|
|
7887
8026
|
);
|
|
7888
8027
|
} catch {
|
|
@@ -8196,7 +8335,7 @@ var createSwapDrive = (config) => {
|
|
|
8196
8335
|
const signer = await (0, import_sdk31.contractSigner)(wallet, await (0, import_sdk31.identityDescriptor)(wallet.identity));
|
|
8197
8336
|
const claimKey = record.profile.claimKey;
|
|
8198
8337
|
if (typeof claimKey === "string") {
|
|
8199
|
-
const held =
|
|
8338
|
+
const held = import_base20.hex.encode(await signer.xOnlyPublicKey());
|
|
8200
8339
|
if (held !== claimKey) {
|
|
8201
8340
|
throw new Error(
|
|
8202
8341
|
`this wallet's identity key ${held} is not the payout key ${claimKey} rfq swap ${swap.rfqId} was quoted against \u2014 a wrong seed, or key provisioning has drifted from the identity key`
|
|
@@ -8240,7 +8379,7 @@ var createSwapDrive = (config) => {
|
|
|
8240
8379
|
);
|
|
8241
8380
|
}
|
|
8242
8381
|
const signer = await (0, import_sdk31.contractSigner)(wallet, descriptor);
|
|
8243
|
-
const held =
|
|
8382
|
+
const held = import_base20.hex.encode(await signer.xOnlyPublicKey());
|
|
8244
8383
|
if (held !== record.profile.refundKey) {
|
|
8245
8384
|
throw new Error(
|
|
8246
8385
|
`the key behind ${descriptor} is ${held}, not the refund key ${String(record.profile.refundKey)} rfq swap ${swap.rfqId}'s HTLC was derived with`
|
|
@@ -8280,13 +8419,37 @@ var createSwapDrive = (config) => {
|
|
|
8280
8419
|
};
|
|
8281
8420
|
const drivable = async (record) => !readsChain(record.kind) || await resolveOnchain();
|
|
8282
8421
|
const pinnedNetwork = async () => (0, import_sdk31.getNetwork)(await config.network());
|
|
8283
|
-
const
|
|
8422
|
+
const claimSecretOf = async (swap) => {
|
|
8284
8423
|
const record = await corridorStore().getRfqSwap(swap.rfqId);
|
|
8285
8424
|
if (!record) throw new Error(`rfq swap ${swap.rfqId} has no stored record to claim from`);
|
|
8286
8425
|
const secret = rfqClaimSecretOf(record);
|
|
8287
8426
|
if (!secret) throw new Error(`rfq swap ${swap.rfqId} carries no claim secret`);
|
|
8288
8427
|
const script = swap.lockup?.script;
|
|
8289
8428
|
if (!script) throw new Error(`rfq swap ${swap.rfqId} carries no lockup covenant`);
|
|
8429
|
+
return { record, secret, script };
|
|
8430
|
+
};
|
|
8431
|
+
const pendingClaims = async (swap) => {
|
|
8432
|
+
const script = swap.lockup?.script;
|
|
8433
|
+
if (!script) throw new Error(`rfq swap ${swap.rfqId} carries no lockup covenant`);
|
|
8434
|
+
const claims = await findPendingClaims(operator, indexer, {
|
|
8435
|
+
contract: script,
|
|
8436
|
+
network: await pinnedNetwork()
|
|
8437
|
+
});
|
|
8438
|
+
return claims.map(({ arkTxid }) => arkTxid);
|
|
8439
|
+
};
|
|
8440
|
+
const finalizeClaim = async (swap) => {
|
|
8441
|
+
const { secret, script } = await claimSecretOf(swap);
|
|
8442
|
+
await track(
|
|
8443
|
+
finalizePendingClaim(operator, indexer, {
|
|
8444
|
+
contract: script,
|
|
8445
|
+
receiver: await (0, import_sdk31.contractSigner)(wallet, secret.signingDescriptor),
|
|
8446
|
+
preimage: await preimageForSwapRecord(wallet, secret),
|
|
8447
|
+
network: await pinnedNetwork()
|
|
8448
|
+
})
|
|
8449
|
+
);
|
|
8450
|
+
};
|
|
8451
|
+
const claimLockup = async (swap, vtxos, { partiallyClaimed }) => {
|
|
8452
|
+
const { record, secret, script } = await claimSecretOf(swap);
|
|
8290
8453
|
const payoutAddress = rfqClaimDestinationOf(record);
|
|
8291
8454
|
if (!payoutAddress) {
|
|
8292
8455
|
throw new Error(`rfq swap ${swap.rfqId} carries no claim destination`);
|
|
@@ -8351,6 +8514,8 @@ var createSwapDrive = (config) => {
|
|
|
8351
8514
|
},
|
|
8352
8515
|
canRefundArkade,
|
|
8353
8516
|
claimLockup,
|
|
8517
|
+
pendingClaims,
|
|
8518
|
+
finalizeClaim,
|
|
8354
8519
|
...onchainSeams?.claim ? { claimOnchain: onchainSeams.claim } : {},
|
|
8355
8520
|
...onchainSeams?.refund ? { refundOnchain: onchainSeams.refund } : {}
|
|
8356
8521
|
});
|
|
@@ -8643,7 +8808,7 @@ var createSwapDrive = (config) => {
|
|
|
8643
8808
|
id
|
|
8644
8809
|
);
|
|
8645
8810
|
}
|
|
8646
|
-
const script =
|
|
8811
|
+
const script = import_base20.hex.decode(record.lockupPkScript);
|
|
8647
8812
|
const before = await recoverableAt(script);
|
|
8648
8813
|
if (before.length === 0) {
|
|
8649
8814
|
throw new SwapDriveRefusedError(
|
|
@@ -9338,12 +9503,12 @@ var verifyPlanLegs = (plan, legs, give) => {
|
|
|
9338
9503
|
};
|
|
9339
9504
|
|
|
9340
9505
|
// src/client/quoteRfq.ts
|
|
9341
|
-
var
|
|
9506
|
+
var import_base22 = require("@scure/base");
|
|
9342
9507
|
var import_sdk35 = require("@arkade-os/sdk");
|
|
9343
9508
|
var import_solver_discovery12 = require("@arkade-os/solver-discovery");
|
|
9344
9509
|
|
|
9345
9510
|
// src/jointGraph.ts
|
|
9346
|
-
var
|
|
9511
|
+
var import_base21 = require("@scure/base");
|
|
9347
9512
|
var import_sha26 = require("@noble/hashes/sha2.js");
|
|
9348
9513
|
var import_sdk32 = require("@arkade-os/sdk");
|
|
9349
9514
|
function digestJointGraph(plan, template) {
|
|
@@ -9379,7 +9544,7 @@ function digestJointGraph(plan, template) {
|
|
|
9379
9544
|
preimage.set(part, at2);
|
|
9380
9545
|
at2 += part.length;
|
|
9381
9546
|
}
|
|
9382
|
-
return
|
|
9547
|
+
return import_base21.hex.encode((0, import_sha26.sha256)(preimage));
|
|
9383
9548
|
}
|
|
9384
9549
|
function verifyJointGraph(plan, template) {
|
|
9385
9550
|
try {
|
|
@@ -9407,7 +9572,7 @@ function verifyJointGraph(plan, template) {
|
|
|
9407
9572
|
}
|
|
9408
9573
|
}
|
|
9409
9574
|
function parseGraphTx(psbt) {
|
|
9410
|
-
return import_sdk32.Transaction.fromPSBT(
|
|
9575
|
+
return import_sdk32.Transaction.fromPSBT(import_base21.base64.decode(psbt));
|
|
9411
9576
|
}
|
|
9412
9577
|
function deepFreeze(value) {
|
|
9413
9578
|
if (value !== null && typeof value === "object") {
|
|
@@ -9666,10 +9831,10 @@ var covenantInputs = (input) => {
|
|
|
9666
9831
|
const network = (0, import_sdk35.networkFromOperatorInfo)(input.info);
|
|
9667
9832
|
const arkade3 = input.corridors.get("arkade").deps;
|
|
9668
9833
|
return {
|
|
9669
|
-
operatorPubkey: (0, import_sdk35.toXOnly)(
|
|
9834
|
+
operatorPubkey: (0, import_sdk35.toXOnly)(import_base22.hex.decode(input.info.signerPubkey), "ark signer key"),
|
|
9670
9835
|
// The resolved per-network pin, never operator-reported: it lands in a covenant leaf
|
|
9671
9836
|
// that decides who can move the funds.
|
|
9672
|
-
emulatorPubkey: (0, import_sdk35.toXOnly)(
|
|
9837
|
+
emulatorPubkey: (0, import_sdk35.toXOnly)(import_base22.hex.decode(arkade3.emulatorPubkey), "emulator signer key"),
|
|
9673
9838
|
claimDelay: unilateralClaimDelay(Number(input.info.unilateralExitDelay)),
|
|
9674
9839
|
hrp: network.hrp
|
|
9675
9840
|
};
|
|
@@ -9677,7 +9842,7 @@ var covenantInputs = (input) => {
|
|
|
9677
9842
|
var sealingKey = (deps) => {
|
|
9678
9843
|
const configured = deps.covclaimd?.pubkey;
|
|
9679
9844
|
if (configured === void 0) return void 0;
|
|
9680
|
-
const key =
|
|
9845
|
+
const key = import_base22.hex.decode(configured);
|
|
9681
9846
|
if (key.length !== 33) {
|
|
9682
9847
|
throw new Error(
|
|
9683
9848
|
`the covclaimd deployment key must be 33-byte compressed hex, got ${key.length} bytes`
|
|
@@ -9734,7 +9899,7 @@ var quoteArkadeAsset = async (input) => {
|
|
|
9734
9899
|
receiveAddress,
|
|
9735
9900
|
maker.pkScript,
|
|
9736
9901
|
(0, import_sdk35.networkFromOperatorInfo)(input.info).hrp,
|
|
9737
|
-
(0, import_sdk35.toXOnly)(
|
|
9902
|
+
(0, import_sdk35.toXOnly)(import_base22.hex.decode(input.info.signerPubkey), "ark signer key")
|
|
9738
9903
|
);
|
|
9739
9904
|
const choice = payment?.carrier;
|
|
9740
9905
|
const carrierRequest = choice === void 0 ? void 0 : choice.mode === "purchase" ? { mode: "purchase" } : {
|
|
@@ -9746,7 +9911,7 @@ var quoteArkadeAsset = async (input) => {
|
|
|
9746
9911
|
if (choice?.mode === "recycleReceiver") {
|
|
9747
9912
|
if (choice.quote.assetId !== sides.wantAsset?.toString())
|
|
9748
9913
|
throw new Error("carrier quote assetId differs from requested asset");
|
|
9749
|
-
if (choice.quote.senderKey !==
|
|
9914
|
+
if (choice.quote.senderKey !== import_base22.hex.encode(maker.publicKey))
|
|
9750
9915
|
throw new Error("carrier quote senderKey differs from wallet identity");
|
|
9751
9916
|
if (input.now >= choice.quote.expiresAt - 30)
|
|
9752
9917
|
throw new Error("carrier quote expired before RFQ");
|
|
@@ -9799,7 +9964,7 @@ var quoteArkadeAsset = async (input) => {
|
|
|
9799
9964
|
if (input.now >= validUntil) throw new Error("asset payment terms lapsed before funding");
|
|
9800
9965
|
assetPayment = {
|
|
9801
9966
|
receiveAddress: receiveAddress ?? new import_sdk35.ArkAddress(
|
|
9802
|
-
(0, import_sdk35.toXOnly)(
|
|
9967
|
+
(0, import_sdk35.toXOnly)(import_base22.hex.decode(input.info.signerPubkey), "ark signer key"),
|
|
9803
9968
|
maker.pkScript.slice(2),
|
|
9804
9969
|
(0, import_sdk35.networkFromOperatorInfo)(input.info).hrp
|
|
9805
9970
|
).encode(),
|
|
@@ -9976,7 +10141,7 @@ var quoteLightningReceive = async (input) => {
|
|
|
9976
10141
|
(0, import_sdk35.provisionClaimSecret)(input.wallet),
|
|
9977
10142
|
input.wallet.getAddress()
|
|
9978
10143
|
]);
|
|
9979
|
-
const paymentHash =
|
|
10144
|
+
const paymentHash = import_base22.hex.encode(secrets.paymentHash);
|
|
9980
10145
|
const lightning = input.corridors.get("lightning").deps;
|
|
9981
10146
|
const sealTo = sealingKey(lightning);
|
|
9982
10147
|
const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
|
|
@@ -10096,7 +10261,7 @@ var quoteOnchainSend = async (input) => {
|
|
|
10096
10261
|
(0, import_sdk35.provisionClaimSecret)(input.wallet),
|
|
10097
10262
|
(0, import_sdk35.provisionRefundKey)(input.wallet)
|
|
10098
10263
|
]);
|
|
10099
|
-
const paymentHash =
|
|
10264
|
+
const paymentHash = import_base22.hex.encode(secrets.paymentHash);
|
|
10100
10265
|
const wire = await input.transport.requestQuote(
|
|
10101
10266
|
withCanonicalAmount(
|
|
10102
10267
|
onchainSendRequest({
|
|
@@ -10207,7 +10372,7 @@ var quoteOnchainReceive = async (input) => {
|
|
|
10207
10372
|
input.wallet.getAddress(),
|
|
10208
10373
|
input.wallet.getBoardingAddress()
|
|
10209
10374
|
]);
|
|
10210
|
-
const paymentHash =
|
|
10375
|
+
const paymentHash = import_base22.hex.encode(secrets.paymentHash);
|
|
10211
10376
|
const refundPkScript = l1ScriptForAddress(boardingAddress, l1Network);
|
|
10212
10377
|
const wire = await input.transport.requestQuote(
|
|
10213
10378
|
withCanonicalAmount(
|
|
@@ -10407,7 +10572,7 @@ var nostrTransportFactory = createNostrTransportFactory();
|
|
|
10407
10572
|
|
|
10408
10573
|
// src/client/client.ts
|
|
10409
10574
|
var PREPARATIONS_HELD = 64;
|
|
10410
|
-
var mintQuoteId = () =>
|
|
10575
|
+
var mintQuoteId = () => import_base23.hex.encode(crypto.getRandomValues(new Uint8Array(16)));
|
|
10411
10576
|
var createSwapClient = (config) => {
|
|
10412
10577
|
const { wallet } = config;
|
|
10413
10578
|
const operator = config.operator ?? walletOperator(wallet);
|
|
@@ -10925,7 +11090,7 @@ function createSwapPaymentRouter(wallet, client, config) {
|
|
|
10925
11090
|
}
|
|
10926
11091
|
|
|
10927
11092
|
// src/offerFillPlan.ts
|
|
10928
|
-
var
|
|
11093
|
+
var import_base24 = require("@scure/base");
|
|
10929
11094
|
var import_sdk41 = require("@arkade-os/sdk");
|
|
10930
11095
|
init_offer();
|
|
10931
11096
|
var OFFER_FILL_TEMPLATE = "offer-fill/1";
|
|
@@ -10940,7 +11105,7 @@ async function buildOfferFillPlan(wallet, arkServerUrl, offerHex, opts) {
|
|
|
10940
11105
|
assetCarrierSats = ASSET_CARRIER_SATS,
|
|
10941
11106
|
sponsor
|
|
10942
11107
|
} = opts;
|
|
10943
|
-
const offer = decodeOffer(
|
|
11108
|
+
const offer = decodeOffer(import_base24.hex.decode(offerHex));
|
|
10944
11109
|
const contract = await connectFillContract(wallet, arkServerUrl, offer, { swapAddress });
|
|
10945
11110
|
const vtxos = await contract.getUtxos();
|
|
10946
11111
|
const vtxo = resolveDeposit(vtxos, { fundingTxid, fundingOutpoint });
|
|
@@ -10989,7 +11154,7 @@ function toJointGraph(arkTx, checkpoints, layout, wantedAssetId) {
|
|
|
10989
11154
|
}
|
|
10990
11155
|
layout.inputs.forEach((input, i) => {
|
|
10991
11156
|
const spent = checkpoints[i].getInput(0);
|
|
10992
|
-
if (!(spent.txid instanceof Uint8Array) ||
|
|
11157
|
+
if (!(spent.txid instanceof Uint8Array) || import_base24.hex.encode(spent.txid) !== input.txid || spent.index !== input.vout) {
|
|
10993
11158
|
throw new Error(`fill plan checkpoint ${i} does not spend ${input.txid}:${input.vout}`);
|
|
10994
11159
|
}
|
|
10995
11160
|
});
|
|
@@ -11001,7 +11166,7 @@ function toJointGraph(arkTx, checkpoints, layout, wantedAssetId) {
|
|
|
11001
11166
|
}
|
|
11002
11167
|
layout.outputs.forEach((expected, i) => {
|
|
11003
11168
|
const out = arkTx.getOutput(i);
|
|
11004
|
-
if (!out?.script ||
|
|
11169
|
+
if (!out?.script || import_base24.hex.encode(out.script) !== import_base24.hex.encode(expected.script)) {
|
|
11005
11170
|
throw new Error(`fill plan output ${i} is not the ${expected.role} script`);
|
|
11006
11171
|
}
|
|
11007
11172
|
if (out.amount !== expected.sats) {
|
|
@@ -11015,7 +11180,7 @@ function toJointGraph(arkTx, checkpoints, layout, wantedAssetId) {
|
|
|
11015
11180
|
throw new Error(`fill plan output ${payments} is not the extension packet`);
|
|
11016
11181
|
}
|
|
11017
11182
|
const anchor = arkTx.getOutput(payments + 1);
|
|
11018
|
-
if (!anchor?.script ||
|
|
11183
|
+
if (!anchor?.script || import_base24.hex.encode(anchor.script) !== import_base24.hex.encode(import_sdk41.P2A.script) || anchor.amount !== import_sdk41.P2A.amount) {
|
|
11019
11184
|
throw new Error(`fill plan output ${payments + 1} is not the anchor`);
|
|
11020
11185
|
}
|
|
11021
11186
|
const packet = import_sdk41.Extension.fromTx(arkTx).getAssetPacket();
|
|
@@ -11047,8 +11212,8 @@ function toJointGraph(arkTx, checkpoints, layout, wantedAssetId) {
|
|
|
11047
11212
|
);
|
|
11048
11213
|
}
|
|
11049
11214
|
}
|
|
11050
|
-
const arkTxPsbt =
|
|
11051
|
-
const checkpointPsbts = checkpoints.map((c) =>
|
|
11215
|
+
const arkTxPsbt = import_base24.base64.encode(arkTx.toPSBT());
|
|
11216
|
+
const checkpointPsbts = checkpoints.map((c) => import_base24.base64.encode(c.toPSBT()));
|
|
11052
11217
|
const inputOwners = layout.inputs.map((input) => input.owner);
|
|
11053
11218
|
const graph = {
|
|
11054
11219
|
arkTx: arkTxPsbt,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bd as pay, bh as receive, bo as unsignedPsbtBytes, bq as verifyJointGraph, br as verifyOfferFillPlan } from './offerFillPlan-
|
|
2
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-
|
|
3
|
-
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, 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, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-
|
|
1
|
+
export { e as AcceptConflict, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, A as AssetAliasTable, B as BuildOfferFillPlanOpts, o as CancelOutcome, q as ClientDisposed, E as CorridorOverrides, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, d as DiscoverySnapshot, K as DiscoverySnapshotUnavailable, N as DriveMode, Q as ExchangeOptions, T as FeeCeiling, W as FillSponsor, X as FillSponsorFare, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, ad as OperatorUnreachable, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, ak as QuoteVerificationFailed, al as REGISTRY_URL, am as ReceiveArtifact, an as ReceiveOptions, ao as ReceiveRequest, ap as RecoveryResult, aq as RegisteredAsset, ar as RfqAuctionPolicy, av as RfqTransportFactory, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, S as SwapPolicy, aG as UnsupportedRoute, aH as VerbDeps, aK as buildOfferFillPlan, aM as canonicalAssetId, aS as createSwapClient, aU as deepFreeze, aV as digestJointGraph, aZ as exchange, b3 as isSwapError, bd as pay, bh as receive, bo as unsignedPsbtBytes, bq as verifyJointGraph, br as verifyOfferFillPlan } from './offerFillPlan-BxNkWLtw.cjs';
|
|
2
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry, a7 as Outcome, ap as Swap, l as QuoteInput, i as RouteResolution, a9 as Quote, as as SwapUpdate, au as Unsubscribe } from './repository-DFDNvcZ7.cjs';
|
|
3
|
+
export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, A as AssetId, 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, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, b as CorridorSwapRecord, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, ba as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a4 as MarketBackend, a5 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a8 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, aa as QuoteLeg, ab as RAILS, R as Rail, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, j as ResolvedEndpoint, am as RestoredMarketRef, bb as RfqSwapState, k as Route, ao as SnapshotRef, bc as SwapContractRegistry, aq as SwapFamily, bd as SwapOperator, ar as SwapRecordCommon, at as TaxiIdentity, av as VerifiedCarrierTerms, aw as arkadeAsset, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, be as isRfqSwapTerminal, aT as issuanceOf, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, b4 as sameAsset, b6 as toAtomicDecimal } from './repository-DFDNvcZ7.cjs';
|
|
4
4
|
export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, T as TxStatus, i as isRfqRefusalErrorCode } from './rfq-CP-P0PSL.cjs';
|
|
5
5
|
import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
|
|
6
|
-
export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-
|
|
6
|
+
export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-CpJXTjX_.cjs';
|
|
7
7
|
import '@arkade-os/solver-discovery';
|
|
8
|
-
import './offer-
|
|
8
|
+
import './offer-Boxive2u.cjs';
|
|
9
9
|
import 'nostr-tools';
|
|
10
10
|
|
|
11
11
|
/** Browser backend over the SDK's shared IndexedDB manager. */
|