@arkade-os/swap 0.1.0 → 0.1.1
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 +134 -24
- package/dist/advanced.d.cts +10 -8
- package/dist/advanced.d.ts +10 -8
- package/dist/advanced.js +6 -2
- package/dist/{chunk-WKJFXXSR.js → chunk-T4FHBWZI.js} +90 -13
- package/dist/{chunk-HRMWBULL.js → chunk-YHESEL4I.js} +53 -15
- package/dist/index.cjs +130 -24
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/{lockupContract-D7BNjksX.d.ts → lockupContract-CIXkJPxV.d.ts} +1 -1
- package/dist/{lockupContract-G-9CNRMq.d.cts → lockupContract-CkhWMKCo.d.cts} +1 -1
- package/dist/{offer-DdB1M6FZ.d.ts → offer-BPD2ortO.d.ts} +1 -1
- package/dist/{offer-CcJfx5Fj.d.cts → offer-Diff5Flc.d.cts} +1 -1
- package/dist/{offerFillPlan-BII0PW92.d.cts → offerFillPlan-B-5ae_gQ.d.cts} +40 -11
- package/dist/{offerFillPlan-CNTLVD7j.d.ts → offerFillPlan-CJzneX6F.d.ts} +40 -11
- package/dist/protocol.cjs +83 -11
- package/dist/protocol.d.cts +6 -6
- package/dist/protocol.d.ts +6 -6
- package/dist/protocol.js +1 -1
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{repository-DmPzpbd7.d.ts → repository-BBVRh9ez.d.ts} +17 -2
- package/dist/{repository-DqdLVrVv.d.cts → repository-C4pvymhs.d.cts} +17 -2
- package/dist/{watch-CmJQDtsy.d.ts → watch-7BiRa4oB.d.ts} +1 -1
- package/dist/{watch-BonYT9af.d.cts → watch-Bxq-lx_6.d.cts} +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IWallet, NetworkName, Network, SignerSet, OnchainProvider, ArkadeInfo, VHTLC, ProvisionedKey, ProvisionedClaimSecret, Transaction } from '@arkade-os/sdk';
|
|
2
|
-
import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository-
|
|
2
|
+
import { bd as SwapOperator, d as AssetSwapRepository, m as Pubkey, bf as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, bg as RfqSwapActionName, N as NetworkRef, A as AssetId, ao as SnapshotRef, a4 as MarketBackend, X as CardMarketRef, a5 as MarketRef, E as AssetRef, r as AmountOn, ap as Swap, Y as CorridorId, _ as DepositArtifact, l as QuoteInput, a9 as Quote, ae as RankedBid, as as SwapUpdate, au as Unsubscribe, S as SwapRecord, Q as QuoteId, a7 as Outcome, L as LockupSpendIndexer, bc as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, D as AssetPaymentTerms, B as AssetPaymentInput, O as OfferSwapRecord, G as AssetSwapId, aq as SwapFamily, i as RouteResolution } from './repository-BBVRh9ez.js';
|
|
3
3
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote, e as RfqTransport, L as LightningSendContractParams, f as LightningReceiveContractParams, O as OnchainHtlc, g as OnchainHtlcParams, h as OnchainNetwork, S as SwapRefusal } from './rfq-C0tHOvn6.js';
|
|
4
4
|
import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
5
|
-
import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-
|
|
5
|
+
import { D as DerivedOffer, F as FillFunding, a as FillOutpoint, b as FillInputOwner } from './offer-BPD2ortO.js';
|
|
6
6
|
import * as nostr_tools from 'nostr-tools';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -498,7 +498,8 @@ declare const isAddressable: (card: DiscoveredMarket) => boolean;
|
|
|
498
498
|
declare const marketBackendOf: (card: DiscoveredMarket) => MarketBackend;
|
|
499
499
|
/**
|
|
500
500
|
* The cards on a snapshot this client may act on at all: the policy's registry allowlist, then
|
|
501
|
-
* addressability. Shared with `markets()
|
|
501
|
+
* addressability. Shared with `markets()`; eligibility is not, so `markets()` can list a card
|
|
502
|
+
* `quote()` refuses.
|
|
502
503
|
*/
|
|
503
504
|
declare const usableMarkets: (snapshot: DiscoverySnapshot, policy?: SwapPolicy) => DiscoveredMarket[];
|
|
504
505
|
/**
|
|
@@ -529,12 +530,34 @@ declare const marketRefOf: (candidate: MarketCandidate, snapshot: SnapshotRef) =
|
|
|
529
530
|
declare const cardMarketOf: (card: DiscoveredMarket, snapshot: SnapshotRef, key: string, backend: MarketBackend) => CardMarketRef;
|
|
530
531
|
/** Narrow a `MarketRef` to the card arm — the only one `quote()` mints. */
|
|
531
532
|
declare const isCardMarket: (market: MarketRef) => market is CardMarketRef;
|
|
533
|
+
/** One side of a {@link Market}. */
|
|
534
|
+
interface MarketLeg {
|
|
535
|
+
/** Absent when the leg has no public id, e.g. an `eip155:` leg. */
|
|
536
|
+
readonly asset?: AssetId;
|
|
537
|
+
/** For `Amount.format`. */
|
|
538
|
+
readonly decimals: number;
|
|
539
|
+
/**
|
|
540
|
+
* The card's announced bounds, in atomic units. Indicative: the solver can still refuse.
|
|
541
|
+
* `null`: the solver will not pay this leg out; a one-way card still routes it as the give leg.
|
|
542
|
+
* Only an amount pinned with `amountOn: "take"` is checked: a give-pinned amount still resolves,
|
|
543
|
+
* and a feed card still quotes it, even if the resulting take is out of range.
|
|
544
|
+
*/
|
|
545
|
+
readonly limits: {
|
|
546
|
+
readonly min: bigint;
|
|
547
|
+
readonly max: bigint;
|
|
548
|
+
} | null;
|
|
549
|
+
}
|
|
532
550
|
/**
|
|
533
|
-
* A market as the v2 client publishes it
|
|
534
|
-
*
|
|
535
|
-
*
|
|
551
|
+
* A market as the v2 client publishes it: the {@link CardMarketRef} a quote would cite, plus its
|
|
552
|
+
* legs. Find a leg by `asset`, not position: they are in card order. The legs stay off
|
|
553
|
+
* `CardMarketRef` because that is written into durable records, which forbid `bigint`.
|
|
536
554
|
*/
|
|
537
|
-
|
|
555
|
+
interface Market extends CardMarketRef {
|
|
556
|
+
readonly legs: readonly [MarketLeg, MarketLeg];
|
|
557
|
+
}
|
|
558
|
+
/** A card as {@link Market}. `network` is the wallet's, as routing uses, so a legacy leg's id
|
|
559
|
+
* matches `resolve()` under a `DiscoveryConfig.network` override. */
|
|
560
|
+
declare const marketOf: (card: DiscoveredMarket, snapshot: SnapshotRef, network: NetworkRef) => Market;
|
|
538
561
|
|
|
539
562
|
/**
|
|
540
563
|
* The three product-facing verbs: `pay`, `receive` and `exchange` each compile a
|
|
@@ -1304,9 +1327,15 @@ interface SwapClient {
|
|
|
1304
1327
|
*/
|
|
1305
1328
|
swaps(filter?: SwapFilter): Promise<Swap[]>;
|
|
1306
1329
|
/**
|
|
1307
|
-
* The markets
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1330
|
+
* The markets on the active snapshot, in the `Quote.market` shape plus each leg's announced
|
|
1331
|
+
* limits, with no RFQ and no disclosure. Shares `quote()`'s registry allowlist and addressability
|
|
1332
|
+
* filter but not its eligibility, so it can list a card `quote()` refuses. Fetches when no
|
|
1333
|
+
* snapshot is in hand, as `quote()` does, since callers reach for it BEFORE quoting.
|
|
1334
|
+
*
|
|
1335
|
+
* `key` is not unique: correlate with `resolve().market` on `key` + `source` + `discoveryPubkey`,
|
|
1336
|
+
* or `solver` on spot cards, which have no `discoveryPubkey`. These fields identify a solver's
|
|
1337
|
+
* market, not one card. A solver may publish several with different limits: `pair` separates a
|
|
1338
|
+
* flipped card, but nothing public separates fee tiers.
|
|
1310
1339
|
*
|
|
1311
1340
|
* @throws {DiscoverySnapshotUnavailable} when the fetch leaves it with
|
|
1312
1341
|
* nothing either.
|
|
@@ -1639,4 +1668,4 @@ interface BuildOfferFillPlanOpts {
|
|
|
1639
1668
|
declare function buildOfferFillPlan(wallet: IWallet, arkServerUrl: string, offerHex: string, opts: BuildOfferFillPlanOpts): Promise<JointGraph>;
|
|
1640
1669
|
declare function verifyOfferFillPlan(plan: JointGraph): boolean;
|
|
1641
1670
|
|
|
1642
|
-
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a,
|
|
1671
|
+
export { type JointGraph as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorOverrides as E, type CorridorPass as F, type CorridorRfqPreparation as G, DEFAULT_MAX_REFUND_WINDOW_SECONDS as H, type DiscoveryConfig as I, type DiscoveryIndexInput as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveMode as N, type OnchainCorridorDeps as O, type DriveRefusal as P, type ExchangeOptions as Q, FEED_TTL_MS as R, type SwapPolicy as S, type FeeCeiling as T, type FeedFetch as U, type FeedQuoteInput as V, type FillSponsor as W, type FillSponsorFare as X, INDEXED_NETWORKS as Y, InconsistentRoute as Z, InsufficientFunds as _, type ArkadeCorridorDeps as a, feedSpread as a$, type LockupOwner as a0, type Market as a1, type MarketLeg as a2, MaxFeeExceeded as a3, MissingCorridorDep as a4, NotCancellable as a5, OFFER_FILL_OWNERS as a6, OFFER_FILL_TEMPLATE as a7, ONCHAIN_CLAIM_FEE_RATE_SATVB as a8, type ObservationSeam as a9, type SwapDrive as aA, type SwapDriveConfig as aB, SwapDriveRefusedError as aC, type SwapError as aD, type SwapErrorName as aE, type SwapFilter as aF, UnsupportedRoute as aG, type VerbDeps as aH, acceptQuote as aI, attesting as aJ, buildOfferFillPlan as aK, cancelSwap as aL, canonicalAssetId as aM, cardMarketOf as aN, chooseMarket as aO, conflictingFields as aP, corridorSet as aQ, createNostrTransportFactory as aR, createSwapClient as aS, createSwapDrive as aT, deepFreeze as aU, digestJointGraph as aV, discoveryIndex as aW, eligibleMarkets as aX, enforceFeeCeiling as aY, exchange as aZ, feedFetch as a_, type OfferPreparation as aa, type OnchainClaim as ab, type OnchainRefund as ac, OperatorUnreachable as ad, type ParsedRfqQuote as ae, type PayOptions as af, type PayResult as ag, type QuoteCheck as ah, QuoteExpired as ai, type QuotePreparation as aj, QuoteVerificationFailed as ak, REGISTRY_URL as al, type ReceiveArtifact as am, type ReceiveOptions as an, type ReceiveRequest as ao, type RecoveryResult as ap, type RegisteredAsset as aq, type RfqAuctionPolicy as ar, type RfqPreparation as as, type RfqQuoteInput as at, type RfqRendezvous as au, type RfqTransportFactory as av, type RouteSide as aw, SWAP_ERROR_NAMES as ax, type SwapClient as ay, type SwapClientConfig as az, type CorridorSet as b, isAddressable as b0, isCardMarket as b1, isIndexedNetwork as b2, isSwapError as b3, isUsableCard as b4, liveArkadeInfo as b5, marketBackendOf as b6, marketKeyOf as b7, marketOf as b8, marketRefOf as b9, nostrTransportFactory as ba, parseRfqQuote as bb, pay as bc, quoteFromFeed as bd, quoteViaRfq as be, readableRecord as bf, receive as bg, resolveCorridorBase as bh, resolveCorridorDeps as bi, rfqLeg as bj, rfqPairFor as bk, swapRecordOf as bl, toDiscoveryLeg as bm, unsignedPsbtBytes as bn, usableMarkets as bo, verifyJointGraph as bp, verifyOfferFillPlan as bq, verifyPlanLegs as br, withCanonicalAmount as bs, type DiscoveryLeg as c, type DiscoverySnapshot as d, AcceptConflict as e, type AcceptInput as f, type AcceptOptions as g, AmbiguousDestination as h, AmountEncodingUnsupported as i, AmountMismatch as j, type AssetRfqPreparation as k, type AttestingRfqTransport as l, CORRIDOR_FACTORIES as m, type CancelInput as n, type CancelOutcome as o, type ClaimedDestination as p, ClientDisposed as q, type CorridorBase as r, type CorridorClaim as s, type CorridorCovenant as t, type CorridorDeadline as u, type CorridorDeps as v, type CorridorDepsByCorridor as w, type CorridorDrive as x, type CorridorLockup as y, type CorridorModule as z };
|
package/dist/protocol.cjs
CHANGED
|
@@ -3475,7 +3475,8 @@ async function findLockupVtxos(contracts, swapPkScript) {
|
|
|
3475
3475
|
txid: vtxo.txid,
|
|
3476
3476
|
vout: vtxo.vout,
|
|
3477
3477
|
value: Number(vtxo.value),
|
|
3478
|
-
recoverable: vtxo.isSwept
|
|
3478
|
+
recoverable: vtxo.isSwept,
|
|
3479
|
+
...vtxo.assets?.length ? { assets: vtxo.assets } : {}
|
|
3479
3480
|
});
|
|
3480
3481
|
}
|
|
3481
3482
|
return out;
|
|
@@ -3485,17 +3486,17 @@ var candidateWitnessItems = (tx, inputIndex) => [
|
|
|
3485
3486
|
...(0, import_sdk8.getArkPsbtFields)(tx, inputIndex, import_sdk8.ConditionWitness).flat(),
|
|
3486
3487
|
...tx.getInput(inputIndex).finalScriptWitness ?? []
|
|
3487
3488
|
];
|
|
3488
|
-
var
|
|
3489
|
+
var refundLeafScript = (tx, inputIndex) => {
|
|
3489
3490
|
const input = tx.getInput(inputIndex);
|
|
3490
3491
|
const witness = input.finalScriptWitness;
|
|
3491
3492
|
const leaves = input.tapLeafScript ?? [];
|
|
3492
3493
|
const script = witness && witness.length >= 2 ? witness[witness.length - 2] : leaves.length === 1 ? (0, import_sdk8.scriptFromTapLeafScript)(leaves[0]) : void 0;
|
|
3493
|
-
if (!script) return
|
|
3494
|
+
if (!script) return void 0;
|
|
3494
3495
|
try {
|
|
3495
3496
|
const { type } = (0, import_sdk8.decodeTapscript)(script);
|
|
3496
|
-
return type === "multisig" || type === "csv-multisig" || type === "cltv-multisig";
|
|
3497
|
+
return type === "multisig" || type === "csv-multisig" || type === "cltv-multisig" ? script : void 0;
|
|
3497
3498
|
} catch {
|
|
3498
|
-
return
|
|
3499
|
+
return void 0;
|
|
3499
3500
|
}
|
|
3500
3501
|
};
|
|
3501
3502
|
async function readLockupFate(indexer, input) {
|
|
@@ -3528,6 +3529,7 @@ async function readLockupFate(indexer, input) {
|
|
|
3528
3529
|
const spends = [...spentBy.values()];
|
|
3529
3530
|
const { txs } = await indexer.getVirtualTxs([...spentBy.keys()]);
|
|
3530
3531
|
const refunded = /* @__PURE__ */ new Set();
|
|
3532
|
+
const leafScripts = /* @__PURE__ */ new Set();
|
|
3531
3533
|
for (const raw of txs) {
|
|
3532
3534
|
let tx;
|
|
3533
3535
|
try {
|
|
@@ -3549,11 +3551,15 @@ async function readLockupFate(indexer, input) {
|
|
|
3549
3551
|
return { fate: "claimed", preimage: candidate, spends };
|
|
3550
3552
|
}
|
|
3551
3553
|
}
|
|
3552
|
-
|
|
3554
|
+
const leafScript = refundLeafScript(tx, i);
|
|
3555
|
+
if (leafScript) {
|
|
3556
|
+
refunded.add(`${vtxo.txid}:${vtxo.vout}`);
|
|
3557
|
+
leafScripts.add(import_base7.hex.encode(leafScript));
|
|
3558
|
+
}
|
|
3553
3559
|
}
|
|
3554
3560
|
}
|
|
3555
3561
|
if (sweptLeft) return { fate: "open" };
|
|
3556
|
-
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends } : { fate: "unknown" };
|
|
3562
|
+
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends, leafScripts: [...leafScripts] } : { fate: "unknown" };
|
|
3557
3563
|
}
|
|
3558
3564
|
var assertNoneSwept = (vtxos, contract) => {
|
|
3559
3565
|
const swept = vtxos.filter((vtxo) => vtxo.recoverable);
|
|
@@ -3574,6 +3580,23 @@ var operatorUnrollScript = async (operator, network) => {
|
|
|
3574
3580
|
};
|
|
3575
3581
|
var MAX_LOCKUP_SPEND_INPUTS = 16;
|
|
3576
3582
|
var boundedLockupSpend = (vtxos) => [...vtxos].sort((a, b) => b.value - a.value).slice(0, MAX_LOCKUP_SPEND_INPUTS);
|
|
3583
|
+
var lockupAssetOutputs = (vtxos) => {
|
|
3584
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
3585
|
+
const totals = /* @__PURE__ */ new Map();
|
|
3586
|
+
vtxos.forEach((vtxo, vin) => {
|
|
3587
|
+
if (!vtxo.assets?.length) return;
|
|
3588
|
+
inputs.set(vin, [...vtxo.assets]);
|
|
3589
|
+
for (const { assetId, amount } of vtxo.assets) {
|
|
3590
|
+
totals.set(assetId, (totals.get(assetId) ?? 0n) + amount);
|
|
3591
|
+
}
|
|
3592
|
+
});
|
|
3593
|
+
if (inputs.size === 0) return [];
|
|
3594
|
+
const receiver = {
|
|
3595
|
+
address: "",
|
|
3596
|
+
assets: [...totals].map(([assetId, amount]) => ({ assetId, amount }))
|
|
3597
|
+
};
|
|
3598
|
+
return [import_sdk8.Extension.create([(0, import_sdk8.createAssetPacket)(inputs, [receiver])]).txOut()];
|
|
3599
|
+
};
|
|
3577
3600
|
var lockupInputs = (vtxos, contract, leaf) => {
|
|
3578
3601
|
const tapTree = contract.encode();
|
|
3579
3602
|
return vtxos.map((vtxo) => ({
|
|
@@ -3599,7 +3622,7 @@ async function pushRefundWithoutReceiver(operator, input) {
|
|
|
3599
3622
|
const amount = vtxos.reduce((sum, vtxo) => sum + vtxo.value, 0);
|
|
3600
3623
|
const { arkTx: tx, checkpoints } = (0, import_sdk8.buildOffchainTx)(
|
|
3601
3624
|
lockupInputs(vtxos, input.contract, leaf),
|
|
3602
|
-
[{ script: refundPkScript, amount: BigInt(amount) }],
|
|
3625
|
+
[{ script: refundPkScript, amount: BigInt(amount) }, ...lockupAssetOutputs(vtxos)],
|
|
3603
3626
|
serverUnrollScript
|
|
3604
3627
|
);
|
|
3605
3628
|
const signedTx = await input.sender.sign(tx);
|
|
@@ -3645,6 +3668,7 @@ var RFQ_SWAP_ACTIVE_STATES = [
|
|
|
3645
3668
|
"needs_counterparty"
|
|
3646
3669
|
];
|
|
3647
3670
|
var isRfqSwapTerminal = (state) => RFQ_SWAP_TERMINAL_STATES.includes(state);
|
|
3671
|
+
var isRecheckableRefundedSend = (record) => record.kind === "lightning_send" && record.state === "refunded" && !record.refundTxid;
|
|
3648
3672
|
|
|
3649
3673
|
// src/rfqRecord.ts
|
|
3650
3674
|
init_rfqCorridor();
|
|
@@ -4216,6 +4240,46 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
4216
4240
|
}
|
|
4217
4241
|
return { restored, failed, pruned: [] };
|
|
4218
4242
|
}
|
|
4243
|
+
/**
|
|
4244
|
+
* Re-read stored `refunded` Lightning sends with no refund txid, one at a time. A misread
|
|
4245
|
+
* could have ended a settled send this way: a `claimed` read settles the record, any other
|
|
4246
|
+
* answer, or a failure, leaves it untouched. Returns the swaps it settled in every sink; one
|
|
4247
|
+
* a sink refused stays monitored for the poll to retry. `stopped` is checked before each
|
|
4248
|
+
* record and before each write, so a caller can walk away mid-run.
|
|
4249
|
+
*/
|
|
4250
|
+
async recheckRefundedSends(options = {}) {
|
|
4251
|
+
const repository = this.requireRepository("recheckRefundedSends");
|
|
4252
|
+
const params = options.params ?? this.paramsFromContracts();
|
|
4253
|
+
const settled = [];
|
|
4254
|
+
for (const record of await collectRfqSwaps(repository, { state: "refunded" })) {
|
|
4255
|
+
if (options.stopped?.()) break;
|
|
4256
|
+
if (!isRecheckableRefundedSend(record) || this.monitored.has(record.rfqId)) continue;
|
|
4257
|
+
const removedAt = this.removed.get(record.rfqId);
|
|
4258
|
+
try {
|
|
4259
|
+
const swap = rebuildRfqSwap(record, await params(record));
|
|
4260
|
+
const fate = await readLockupFate(this.deps.indexer, {
|
|
4261
|
+
swapPkScript: swap.lockupPkScript,
|
|
4262
|
+
paymentHash: swap.paymentHash
|
|
4263
|
+
});
|
|
4264
|
+
if (options.stopped?.()) break;
|
|
4265
|
+
if (fate.fate !== "claimed") continue;
|
|
4266
|
+
if (this.monitored.has(record.rfqId)) continue;
|
|
4267
|
+
if (this.removed.get(record.rfqId) !== removedAt) continue;
|
|
4268
|
+
delete swap.lockupSpendTxids;
|
|
4269
|
+
this.stampLockupSpends(swap, fate.spends);
|
|
4270
|
+
this.stampSettlementPreimage(swap, fate.preimage);
|
|
4271
|
+
this.setState(swap, "settled");
|
|
4272
|
+
if (await this.save(swap)) {
|
|
4273
|
+
this.dirty.delete(swap.rfqId);
|
|
4274
|
+
settled.push(swap);
|
|
4275
|
+
} else {
|
|
4276
|
+
this.track(swap);
|
|
4277
|
+
}
|
|
4278
|
+
} catch {
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
return settled;
|
|
4282
|
+
}
|
|
4219
4283
|
/**
|
|
4220
4284
|
* Drop stored records that are terminal and past `RFQ_SWAP_RETENTION_SECONDS` (per
|
|
4221
4285
|
* `shouldRetainRfqSwap`), and return their ids. Explicit only: restore keeps history.
|
|
@@ -4582,6 +4646,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
4582
4646
|
* finalization and the per-swap lock belong to `pollSwap`.
|
|
4583
4647
|
*/
|
|
4584
4648
|
async runPass(swap) {
|
|
4649
|
+
if (isRfqSwapTerminal(swap.state)) return;
|
|
4585
4650
|
await this.ensureRegistered(swap);
|
|
4586
4651
|
let fate;
|
|
4587
4652
|
try {
|
|
@@ -4593,6 +4658,11 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
4593
4658
|
} catch {
|
|
4594
4659
|
fate = { fate: "unknown" };
|
|
4595
4660
|
}
|
|
4661
|
+
if ((swap.kind === "lightning_send" || swap.kind === "onchain_send") && fate.fate === "returned" && this.config.now() < swap.refundLocktime && !fate.leafScripts.every(
|
|
4662
|
+
(script) => script === swap.lockup?.script.nonInteractiveRefundScript
|
|
4663
|
+
)) {
|
|
4664
|
+
fate = { fate: "unknown" };
|
|
4665
|
+
}
|
|
4596
4666
|
if (swap.kind === "onchain_receive") return this.driveOnchainReceive(swap, fate);
|
|
4597
4667
|
if (fate.fate === "claimed" || fate.fate === "returned") {
|
|
4598
4668
|
this.stampLockupSpends(swap, fate.spends);
|
|
@@ -5546,8 +5616,7 @@ var chainSourceFrom = (provider, network) => {
|
|
|
5546
5616
|
}));
|
|
5547
5617
|
},
|
|
5548
5618
|
async getSpendingTx(txid, vout, pkScript) {
|
|
5549
|
-
const
|
|
5550
|
-
const outspend = outspends[vout];
|
|
5619
|
+
const outspend = provider.getTxOutspend ? await provider.getTxOutspend(txid, vout) : (await provider.getTxOutspends(txid))[vout];
|
|
5551
5620
|
if (!outspend?.spent) return null;
|
|
5552
5621
|
const spender = outspend.txid || await spenderFromHistory(txid, vout, pkScript);
|
|
5553
5622
|
if (!spender) return null;
|
|
@@ -5611,7 +5680,10 @@ async function pushClaim(operator, input) {
|
|
|
5611
5680
|
provider: operator,
|
|
5612
5681
|
inputs: lockupInputs(vtxos, input.contract, leaf),
|
|
5613
5682
|
// One aggregate output: this leaf inspects nothing about the output set.
|
|
5614
|
-
outputs: [
|
|
5683
|
+
outputs: [
|
|
5684
|
+
{ script: input.destinationPkScript, amount: BigInt(locked) },
|
|
5685
|
+
...lockupAssetOutputs(vtxos)
|
|
5686
|
+
],
|
|
5615
5687
|
serverUnrollScript,
|
|
5616
5688
|
verifyServerSignatures: { serverPubkey: input.contract.options.server }
|
|
5617
5689
|
});
|
package/dist/protocol.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
|
|
2
|
-
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-
|
|
3
|
-
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-
|
|
2
|
+
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-C4pvymhs.cjs';
|
|
3
|
+
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-C4pvymhs.cjs';
|
|
4
4
|
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-C0tHOvn6.cjs';
|
|
5
5
|
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-C0tHOvn6.cjs';
|
|
6
|
-
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-
|
|
6
|
+
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-CkhWMKCo.cjs';
|
|
7
7
|
import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
8
|
-
import { O as Offer } from './offer-
|
|
9
|
-
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-
|
|
10
|
-
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-
|
|
8
|
+
import { O as Offer } from './offer-Diff5Flc.cjs';
|
|
9
|
+
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-Diff5Flc.cjs';
|
|
10
|
+
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-Bxq-lx_6.cjs';
|
|
11
11
|
|
|
12
12
|
/** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
|
|
13
13
|
* whose leg this wallet never signs. */
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
|
|
2
|
-
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-
|
|
3
|
-
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-
|
|
2
|
+
import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-BBVRh9ez.js';
|
|
3
|
+
export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-BBVRh9ez.js';
|
|
4
4
|
import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-C0tHOvn6.js';
|
|
5
5
|
export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-C0tHOvn6.js';
|
|
6
|
-
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-
|
|
6
|
+
export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-CIXkJPxV.js';
|
|
7
7
|
import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
8
|
-
import { O as Offer } from './offer-
|
|
9
|
-
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-
|
|
10
|
-
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-
|
|
8
|
+
import { O as Offer } from './offer-BPD2ortO.js';
|
|
9
|
+
export { A as ASSET_CARRIER_SATS, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, c as OFFER_PACKET_TYPE, d as OfferCovenantMismatchError, e as cancelOffer, f as createOffer, g as decodeOffer, h as encodeOffer, i as fillOffer, o as offerContract, j as offerVtxoScript, s as swapPrograms } from './offer-BPD2ortO.js';
|
|
10
|
+
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-7BiRa4oB.js';
|
|
11
11
|
|
|
12
12
|
/** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
|
|
13
13
|
* whose leg this wallet never signs. */
|
package/dist/protocol.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-C4pvymhs.cjs';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
5
|
import '../../rfq-C0tHOvn6.cjs';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RealmLike } from '@arkade-os/sdk/repositories/realm';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-BBVRh9ez.js';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
5
|
import '../../rfq-C0tHOvn6.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-C4pvymhs.cjs';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
5
|
import '../../rfq-C0tHOvn6.cjs';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
2
|
import { PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
|
-
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-
|
|
3
|
+
import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-BBVRh9ez.js';
|
|
4
4
|
import '@arkade-os/solver-discovery';
|
|
5
5
|
import '../../rfq-C0tHOvn6.js';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
2
|
-
import { IWallet, ProvisionedKey, ProvisionedClaimSecret, ArkProvider, RestIndexerProvider, IContractManager, VHTLC, Identity, Network, InputExpiryFloor, NetworkName, asset, PageRequest, PageResult } from '@arkade-os/sdk';
|
|
2
|
+
import { IWallet, ProvisionedKey, ProvisionedClaimSecret, ArkProvider, Asset, RestIndexerProvider, IContractManager, VHTLC, Identity, Network, InputExpiryFloor, NetworkName, asset, PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
3
|
import { e as RfqTransport, E as RfqStatus, O as OnchainHtlc, l as ChainUtxo, C as ChainSource, z as OnchainHtlcPhase } from './rfq-C0tHOvn6.js';
|
|
4
4
|
|
|
5
5
|
/** @deprecated Use `Outcome`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
@@ -155,6 +155,9 @@ interface LockupVtxo {
|
|
|
155
155
|
* refuses these rather than submitting a doomed spend.
|
|
156
156
|
*/
|
|
157
157
|
recoverable: boolean;
|
|
158
|
+
/** Absent on a sats-only output. Anyone can send an asset to the lockup address, and arkd
|
|
159
|
+
* refuses a spend that does not declare where it goes: see {@link lockupAssetOutputs}. */
|
|
160
|
+
assets?: readonly Asset[];
|
|
158
161
|
}
|
|
159
162
|
/**
|
|
160
163
|
* Thrown when a refund was asked for over outputs that have been swept. Carries the outpoints so
|
|
@@ -227,10 +230,12 @@ type LockupFate =
|
|
|
227
230
|
preimage: Uint8Array;
|
|
228
231
|
spends: readonly LockupSpend[];
|
|
229
232
|
}
|
|
230
|
-
/** Every lockup output was spent through a recognized refund leaf.
|
|
233
|
+
/** Every lockup output was spent through a recognized refund leaf. `leafScripts` are
|
|
234
|
+
* the distinct leaf scripts spent, hex. */
|
|
231
235
|
| {
|
|
232
236
|
fate: "returned";
|
|
233
237
|
spends: readonly LockupSpend[];
|
|
238
|
+
leafScripts: readonly string[];
|
|
234
239
|
}
|
|
235
240
|
/**
|
|
236
241
|
* At least one output was unilaterally exited: onchain under the VHTLC script, beyond any
|
|
@@ -898,6 +903,16 @@ declare class RfqSwapManager {
|
|
|
898
903
|
* {@link RfqRestoreResult.failed}, never fatal to the others.
|
|
899
904
|
*/
|
|
900
905
|
restoreFromRepository(options?: RfqRestoreOptions): Promise<RfqRestoreResult>;
|
|
906
|
+
/**
|
|
907
|
+
* Re-read stored `refunded` Lightning sends with no refund txid, one at a time. A misread
|
|
908
|
+
* could have ended a settled send this way: a `claimed` read settles the record, any other
|
|
909
|
+
* answer, or a failure, leaves it untouched. Returns the swaps it settled in every sink; one
|
|
910
|
+
* a sink refused stays monitored for the poll to retry. `stopped` is checked before each
|
|
911
|
+
* record and before each write, so a caller can walk away mid-run.
|
|
912
|
+
*/
|
|
913
|
+
recheckRefundedSends(options?: Pick<RfqRestoreOptions, "params"> & {
|
|
914
|
+
stopped?: () => boolean;
|
|
915
|
+
}): Promise<RfqSwap[]>;
|
|
901
916
|
/**
|
|
902
917
|
* Drop stored records that are terminal and past `RFQ_SWAP_RETENTION_SECONDS` (per
|
|
903
918
|
* `shouldRetainRfqSwap`), and return their ids. Explicit only: restore keeps history.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
2
|
-
import { IWallet, ProvisionedKey, ProvisionedClaimSecret, ArkProvider, RestIndexerProvider, IContractManager, VHTLC, Identity, Network, InputExpiryFloor, NetworkName, asset, PageRequest, PageResult } from '@arkade-os/sdk';
|
|
2
|
+
import { IWallet, ProvisionedKey, ProvisionedClaimSecret, ArkProvider, Asset, RestIndexerProvider, IContractManager, VHTLC, Identity, Network, InputExpiryFloor, NetworkName, asset, PageRequest, PageResult } from '@arkade-os/sdk';
|
|
3
3
|
import { e as RfqTransport, E as RfqStatus, O as OnchainHtlc, l as ChainUtxo, C as ChainSource, z as OnchainHtlcPhase } from './rfq-C0tHOvn6.cjs';
|
|
4
4
|
|
|
5
5
|
/** @deprecated Use `Outcome`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
@@ -155,6 +155,9 @@ interface LockupVtxo {
|
|
|
155
155
|
* refuses these rather than submitting a doomed spend.
|
|
156
156
|
*/
|
|
157
157
|
recoverable: boolean;
|
|
158
|
+
/** Absent on a sats-only output. Anyone can send an asset to the lockup address, and arkd
|
|
159
|
+
* refuses a spend that does not declare where it goes: see {@link lockupAssetOutputs}. */
|
|
160
|
+
assets?: readonly Asset[];
|
|
158
161
|
}
|
|
159
162
|
/**
|
|
160
163
|
* Thrown when a refund was asked for over outputs that have been swept. Carries the outpoints so
|
|
@@ -227,10 +230,12 @@ type LockupFate =
|
|
|
227
230
|
preimage: Uint8Array;
|
|
228
231
|
spends: readonly LockupSpend[];
|
|
229
232
|
}
|
|
230
|
-
/** Every lockup output was spent through a recognized refund leaf.
|
|
233
|
+
/** Every lockup output was spent through a recognized refund leaf. `leafScripts` are
|
|
234
|
+
* the distinct leaf scripts spent, hex. */
|
|
231
235
|
| {
|
|
232
236
|
fate: "returned";
|
|
233
237
|
spends: readonly LockupSpend[];
|
|
238
|
+
leafScripts: readonly string[];
|
|
234
239
|
}
|
|
235
240
|
/**
|
|
236
241
|
* At least one output was unilaterally exited: onchain under the VHTLC script, beyond any
|
|
@@ -898,6 +903,16 @@ declare class RfqSwapManager {
|
|
|
898
903
|
* {@link RfqRestoreResult.failed}, never fatal to the others.
|
|
899
904
|
*/
|
|
900
905
|
restoreFromRepository(options?: RfqRestoreOptions): Promise<RfqRestoreResult>;
|
|
906
|
+
/**
|
|
907
|
+
* Re-read stored `refunded` Lightning sends with no refund txid, one at a time. A misread
|
|
908
|
+
* could have ended a settled send this way: a `claimed` read settles the record, any other
|
|
909
|
+
* answer, or a failure, leaves it untouched. Returns the swaps it settled in every sink; one
|
|
910
|
+
* a sink refused stays monitored for the poll to retry. `stopped` is checked before each
|
|
911
|
+
* record and before each write, so a caller can walk away mid-run.
|
|
912
|
+
*/
|
|
913
|
+
recheckRefundedSends(options?: Pick<RfqRestoreOptions, "params"> & {
|
|
914
|
+
stopped?: () => boolean;
|
|
915
|
+
}): Promise<RfqSwap[]>;
|
|
901
916
|
/**
|
|
902
917
|
* Drop stored records that are terminal and past `RFQ_SWAP_RETENTION_SECONDS` (per
|
|
903
918
|
* `shouldRetainRfqSwap`), and return their ids. Explicit only: restore keeps history.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet } from '@arkade-os/sdk';
|
|
2
|
-
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-
|
|
2
|
+
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-BBVRh9ez.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet } from '@arkade-os/sdk';
|
|
2
|
-
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-
|
|
2
|
+
import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-C4pvymhs.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/swap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Client-side Arkade Intents asset swaps: state a route, get an outcome. Pay a bolt11 invoice, receive over Lightning, exchange assets, or withdraw onchain.",
|
|
6
6
|
"repository": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@scure/base": "2.4.0",
|
|
105
105
|
"@scure/btc-signer": "2.4.1",
|
|
106
106
|
"light-bolt11-decoder": "3.2.0",
|
|
107
|
-
"@arkade-os/sdk": "0.5.
|
|
107
|
+
"@arkade-os/sdk": "0.5.1"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"nostr-tools": "2.24.1"
|