@arkade-os/swap 0.1.0 → 0.1.2
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 +150 -33
- package/dist/advanced.d.cts +10 -8
- package/dist/advanced.d.ts +10 -8
- package/dist/advanced.js +7 -3
- package/dist/{chunk-WKJFXXSR.js → chunk-BLECLU5Q.js} +91 -14
- package/dist/{chunk-FMRAV77W.js → chunk-ICSREL7N.js} +14 -12
- package/dist/{chunk-HRMWBULL.js → chunk-J2PMAQP2.js} +70 -25
- package/dist/index.cjs +146 -33
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- 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/nostr.js +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 +99 -25
- package/dist/protocol.d.cts +6 -6
- package/dist/protocol.d.ts +6 -6
- package/dist/protocol.js +4 -4
- 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
package/dist/advanced.cjs
CHANGED
|
@@ -2787,6 +2787,7 @@ __export(advanced_exports, {
|
|
|
2787
2787
|
buildOfferFillPlan: () => buildOfferFillPlan,
|
|
2788
2788
|
cancelSwap: () => cancelSwap,
|
|
2789
2789
|
canonicalAssetId: () => canonicalAssetId,
|
|
2790
|
+
cardLegAssetId: () => cardLegAssetId,
|
|
2790
2791
|
cardMarketOf: () => cardMarketOf,
|
|
2791
2792
|
chainSourceOver: () => chainSourceOver,
|
|
2792
2793
|
chooseMarket: () => chooseMarket,
|
|
@@ -2847,6 +2848,7 @@ __export(advanced_exports, {
|
|
|
2847
2848
|
liveArkadeInfo: () => liveArkadeInfo,
|
|
2848
2849
|
marketBackendOf: () => marketBackendOf,
|
|
2849
2850
|
marketKeyOf: () => marketKeyOf,
|
|
2851
|
+
marketOf: () => marketOf,
|
|
2850
2852
|
marketRefOf: () => marketRefOf,
|
|
2851
2853
|
networksOfInvoiceHrp: () => networksOfInvoiceHrp,
|
|
2852
2854
|
nostrTransportFactory: () => nostrTransportFactory,
|
|
@@ -4735,14 +4737,22 @@ var publicAssetId = (corridor, assetId, network) => {
|
|
|
4735
4737
|
if (!ARKADE_ASSET_IDENTITY.test(assetId)) return void 0;
|
|
4736
4738
|
return `arkade:${network}/${ARKADE_ASSET_NAMESPACE}:${assetId}`;
|
|
4737
4739
|
};
|
|
4740
|
+
var cardLegAssetId = (card, side, network) => {
|
|
4741
|
+
const corridor = corridorOfRail(marketCorridor(card, side));
|
|
4742
|
+
if (corridor === void 0) return void 0;
|
|
4743
|
+
const canonical = marketAssetId(card, side);
|
|
4744
|
+
if (canonical !== void 0 && isAssetId(canonical)) return canonical;
|
|
4745
|
+
return publicAssetId(
|
|
4746
|
+
corridor,
|
|
4747
|
+
(side === "base" ? card.base_asset : card.quote_asset).id,
|
|
4748
|
+
network
|
|
4749
|
+
);
|
|
4750
|
+
};
|
|
4738
4751
|
var aliasTableFrom = (markets, network) => {
|
|
4739
4752
|
const rows = /* @__PURE__ */ new Map();
|
|
4740
4753
|
const add = (card, side) => {
|
|
4741
4754
|
const info = side === "base" ? card.base_asset : card.quote_asset;
|
|
4742
|
-
const
|
|
4743
|
-
if (corridor === void 0) return;
|
|
4744
|
-
const canonical = marketAssetId(card, side);
|
|
4745
|
-
const id = canonical !== void 0 && isAssetId(canonical) ? canonical : publicAssetId(corridor, info.id, network);
|
|
4755
|
+
const id = cardLegAssetId(card, side, network);
|
|
4746
4756
|
if (id === void 0 || typeof info.ticker !== "string" || info.ticker === "") return;
|
|
4747
4757
|
rows.set(`${id} ${info.ticker.toLowerCase()}`, { id, ticker: info.ticker });
|
|
4748
4758
|
};
|
|
@@ -4811,7 +4821,8 @@ async function findLockupVtxos(contracts, swapPkScript) {
|
|
|
4811
4821
|
txid: vtxo.txid,
|
|
4812
4822
|
vout: vtxo.vout,
|
|
4813
4823
|
value: Number(vtxo.value),
|
|
4814
|
-
recoverable: vtxo.isSwept
|
|
4824
|
+
recoverable: vtxo.isSwept,
|
|
4825
|
+
...vtxo.assets?.length ? { assets: vtxo.assets } : {}
|
|
4815
4826
|
});
|
|
4816
4827
|
}
|
|
4817
4828
|
return out;
|
|
@@ -4821,17 +4832,17 @@ var candidateWitnessItems = (tx, inputIndex) => [
|
|
|
4821
4832
|
...(0, import_sdk14.getArkPsbtFields)(tx, inputIndex, import_sdk14.ConditionWitness).flat(),
|
|
4822
4833
|
...tx.getInput(inputIndex).finalScriptWitness ?? []
|
|
4823
4834
|
];
|
|
4824
|
-
var
|
|
4835
|
+
var refundLeafScript = (tx, inputIndex) => {
|
|
4825
4836
|
const input = tx.getInput(inputIndex);
|
|
4826
4837
|
const witness = input.finalScriptWitness;
|
|
4827
4838
|
const leaves = input.tapLeafScript ?? [];
|
|
4828
4839
|
const script = witness && witness.length >= 2 ? witness[witness.length - 2] : leaves.length === 1 ? (0, import_sdk14.scriptFromTapLeafScript)(leaves[0]) : void 0;
|
|
4829
|
-
if (!script) return
|
|
4840
|
+
if (!script) return void 0;
|
|
4830
4841
|
try {
|
|
4831
4842
|
const { type } = (0, import_sdk14.decodeTapscript)(script);
|
|
4832
|
-
return type === "multisig" || type === "csv-multisig" || type === "cltv-multisig";
|
|
4843
|
+
return type === "multisig" || type === "csv-multisig" || type === "cltv-multisig" ? script : void 0;
|
|
4833
4844
|
} catch {
|
|
4834
|
-
return
|
|
4845
|
+
return void 0;
|
|
4835
4846
|
}
|
|
4836
4847
|
};
|
|
4837
4848
|
async function readLockupFate(indexer, input) {
|
|
@@ -4864,6 +4875,7 @@ async function readLockupFate(indexer, input) {
|
|
|
4864
4875
|
const spends = [...spentBy.values()];
|
|
4865
4876
|
const { txs } = await indexer.getVirtualTxs([...spentBy.keys()]);
|
|
4866
4877
|
const refunded = /* @__PURE__ */ new Set();
|
|
4878
|
+
const leafScripts = /* @__PURE__ */ new Set();
|
|
4867
4879
|
for (const raw of txs) {
|
|
4868
4880
|
let tx;
|
|
4869
4881
|
try {
|
|
@@ -4885,11 +4897,15 @@ async function readLockupFate(indexer, input) {
|
|
|
4885
4897
|
return { fate: "claimed", preimage: candidate, spends };
|
|
4886
4898
|
}
|
|
4887
4899
|
}
|
|
4888
|
-
|
|
4900
|
+
const leafScript = refundLeafScript(tx, i);
|
|
4901
|
+
if (leafScript) {
|
|
4902
|
+
refunded.add(`${vtxo.txid}:${vtxo.vout}`);
|
|
4903
|
+
leafScripts.add(import_base10.hex.encode(leafScript));
|
|
4904
|
+
}
|
|
4889
4905
|
}
|
|
4890
4906
|
}
|
|
4891
4907
|
if (sweptLeft) return { fate: "open" };
|
|
4892
|
-
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends } : { fate: "unknown" };
|
|
4908
|
+
return everySpendNamed && all.every((vtxo) => refunded.has(`${vtxo.txid}:${vtxo.vout}`)) ? { fate: "returned", spends, leafScripts: [...leafScripts] } : { fate: "unknown" };
|
|
4893
4909
|
}
|
|
4894
4910
|
var assertNoneSwept = (vtxos, contract) => {
|
|
4895
4911
|
const swept = vtxos.filter((vtxo) => vtxo.recoverable);
|
|
@@ -4910,6 +4926,23 @@ var operatorUnrollScript = async (operator, network) => {
|
|
|
4910
4926
|
};
|
|
4911
4927
|
var MAX_LOCKUP_SPEND_INPUTS = 16;
|
|
4912
4928
|
var boundedLockupSpend = (vtxos) => [...vtxos].sort((a, b) => b.value - a.value).slice(0, MAX_LOCKUP_SPEND_INPUTS);
|
|
4929
|
+
var lockupAssetOutputs = (vtxos) => {
|
|
4930
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
4931
|
+
const totals = /* @__PURE__ */ new Map();
|
|
4932
|
+
vtxos.forEach((vtxo, vin) => {
|
|
4933
|
+
if (!vtxo.assets?.length) return;
|
|
4934
|
+
inputs.set(vin, [...vtxo.assets]);
|
|
4935
|
+
for (const { assetId, amount } of vtxo.assets) {
|
|
4936
|
+
totals.set(assetId, (totals.get(assetId) ?? 0n) + amount);
|
|
4937
|
+
}
|
|
4938
|
+
});
|
|
4939
|
+
if (inputs.size === 0) return [];
|
|
4940
|
+
const receiver = {
|
|
4941
|
+
address: "",
|
|
4942
|
+
assets: [...totals].map(([assetId, amount]) => ({ assetId, amount }))
|
|
4943
|
+
};
|
|
4944
|
+
return [import_sdk14.Extension.create([(0, import_sdk14.createAssetPacket)(inputs, [receiver])]).txOut()];
|
|
4945
|
+
};
|
|
4913
4946
|
var lockupInputs = (vtxos, contract, leaf) => {
|
|
4914
4947
|
const tapTree = contract.encode();
|
|
4915
4948
|
return vtxos.map((vtxo) => ({
|
|
@@ -4935,7 +4968,7 @@ async function pushRefundWithoutReceiver(operator, input) {
|
|
|
4935
4968
|
const amount = vtxos.reduce((sum, vtxo) => sum + vtxo.value, 0);
|
|
4936
4969
|
const { arkTx: tx, checkpoints } = (0, import_sdk14.buildOffchainTx)(
|
|
4937
4970
|
lockupInputs(vtxos, input.contract, leaf),
|
|
4938
|
-
[{ script: refundPkScript, amount: BigInt(amount) }],
|
|
4971
|
+
[{ script: refundPkScript, amount: BigInt(amount) }, ...lockupAssetOutputs(vtxos)],
|
|
4939
4972
|
serverUnrollScript
|
|
4940
4973
|
);
|
|
4941
4974
|
const signedTx = await input.sender.sign(tx);
|
|
@@ -5024,8 +5057,7 @@ var chainSourceFrom = (provider, network) => {
|
|
|
5024
5057
|
}));
|
|
5025
5058
|
},
|
|
5026
5059
|
async getSpendingTx(txid, vout, pkScript) {
|
|
5027
|
-
const
|
|
5028
|
-
const outspend = outspends[vout];
|
|
5060
|
+
const outspend = provider.getTxOutspend ? await provider.getTxOutspend(txid, vout) : (await provider.getTxOutspends(txid))[vout];
|
|
5029
5061
|
if (!outspend?.spent) return null;
|
|
5030
5062
|
const spender = outspend.txid || await spenderFromHistory(txid, vout, pkScript);
|
|
5031
5063
|
if (!spender) return null;
|
|
@@ -5113,8 +5145,7 @@ var chainSourceOver = (backend, network) => {
|
|
|
5113
5145
|
}));
|
|
5114
5146
|
},
|
|
5115
5147
|
async getSpendingTx(txid, vout, pkScript) {
|
|
5116
|
-
const
|
|
5117
|
-
const outspend = outspends[vout];
|
|
5148
|
+
const outspend = backend.provider.getTxOutspend ? await backend.provider.getTxOutspend(txid, vout) : (await backend.provider.getTxOutspends(txid))[vout];
|
|
5118
5149
|
if (!outspend?.spent) return null;
|
|
5119
5150
|
const spender = outspend.txid || await spenderFromVins(txid, vout, pkScript);
|
|
5120
5151
|
if (!spender) return null;
|
|
@@ -5829,6 +5860,8 @@ var RFQ_SWAP_ACTIVE_STATES = [
|
|
|
5829
5860
|
"needs_counterparty"
|
|
5830
5861
|
];
|
|
5831
5862
|
var isRfqSwapTerminal = (state) => RFQ_SWAP_TERMINAL_STATES.includes(state);
|
|
5863
|
+
var isRecheckableRefundedSend = (record) => record.kind === "lightning_send" && record.state === "refunded" && !record.refundTxid;
|
|
5864
|
+
var isRfqSwapRestorable = (record) => !isRfqSwapTerminal(record.state) || isRecheckableRefundedSend(record);
|
|
5832
5865
|
|
|
5833
5866
|
// src/rfqRecord.ts
|
|
5834
5867
|
init_rfqCorridor();
|
|
@@ -6368,7 +6401,10 @@ async function pushClaim(operator, input) {
|
|
|
6368
6401
|
provider: operator,
|
|
6369
6402
|
inputs: lockupInputs(vtxos, input.contract, leaf),
|
|
6370
6403
|
// One aggregate output: this leaf inspects nothing about the output set.
|
|
6371
|
-
outputs: [
|
|
6404
|
+
outputs: [
|
|
6405
|
+
{ script: input.destinationPkScript, amount: BigInt(locked) },
|
|
6406
|
+
...lockupAssetOutputs(vtxos)
|
|
6407
|
+
],
|
|
6372
6408
|
serverUnrollScript,
|
|
6373
6409
|
verifyServerSignatures: { serverPubkey: input.contract.options.server }
|
|
6374
6410
|
});
|
|
@@ -6817,6 +6853,46 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
6817
6853
|
}
|
|
6818
6854
|
return { restored, failed, pruned: [] };
|
|
6819
6855
|
}
|
|
6856
|
+
/**
|
|
6857
|
+
* Re-read stored `refunded` Lightning sends with no refund txid, one at a time. A misread
|
|
6858
|
+
* could have ended a settled send this way: a `claimed` read settles the record, any other
|
|
6859
|
+
* answer, or a failure, leaves it untouched. Returns the swaps it settled in every sink; one
|
|
6860
|
+
* a sink refused stays monitored for the poll to retry. `stopped` is checked before each
|
|
6861
|
+
* record and before each write, so a caller can walk away mid-run.
|
|
6862
|
+
*/
|
|
6863
|
+
async recheckRefundedSends(options = {}) {
|
|
6864
|
+
const repository = this.requireRepository("recheckRefundedSends");
|
|
6865
|
+
const params = options.params ?? this.paramsFromContracts();
|
|
6866
|
+
const settled = [];
|
|
6867
|
+
for (const record of await collectRfqSwaps(repository, { state: "refunded" })) {
|
|
6868
|
+
if (options.stopped?.()) break;
|
|
6869
|
+
if (!isRecheckableRefundedSend(record) || this.monitored.has(record.rfqId)) continue;
|
|
6870
|
+
const removedAt = this.removed.get(record.rfqId);
|
|
6871
|
+
try {
|
|
6872
|
+
const swap = rebuildRfqSwap(record, await params(record));
|
|
6873
|
+
const fate = await readLockupFate(this.deps.indexer, {
|
|
6874
|
+
swapPkScript: swap.lockupPkScript,
|
|
6875
|
+
paymentHash: swap.paymentHash
|
|
6876
|
+
});
|
|
6877
|
+
if (options.stopped?.()) break;
|
|
6878
|
+
if (fate.fate !== "claimed") continue;
|
|
6879
|
+
if (this.monitored.has(record.rfqId)) continue;
|
|
6880
|
+
if (this.removed.get(record.rfqId) !== removedAt) continue;
|
|
6881
|
+
delete swap.lockupSpendTxids;
|
|
6882
|
+
this.stampLockupSpends(swap, fate.spends);
|
|
6883
|
+
this.stampSettlementPreimage(swap, fate.preimage);
|
|
6884
|
+
this.setState(swap, "settled");
|
|
6885
|
+
if (await this.save(swap)) {
|
|
6886
|
+
this.dirty.delete(swap.rfqId);
|
|
6887
|
+
settled.push(swap);
|
|
6888
|
+
} else {
|
|
6889
|
+
this.track(swap);
|
|
6890
|
+
}
|
|
6891
|
+
} catch {
|
|
6892
|
+
}
|
|
6893
|
+
}
|
|
6894
|
+
return settled;
|
|
6895
|
+
}
|
|
6820
6896
|
/**
|
|
6821
6897
|
* Drop stored records that are terminal and past `RFQ_SWAP_RETENTION_SECONDS` (per
|
|
6822
6898
|
* `shouldRetainRfqSwap`), and return their ids. Explicit only: restore keeps history.
|
|
@@ -7183,6 +7259,7 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7183
7259
|
* finalization and the per-swap lock belong to `pollSwap`.
|
|
7184
7260
|
*/
|
|
7185
7261
|
async runPass(swap) {
|
|
7262
|
+
if (isRfqSwapTerminal(swap.state)) return;
|
|
7186
7263
|
await this.ensureRegistered(swap);
|
|
7187
7264
|
let fate;
|
|
7188
7265
|
try {
|
|
@@ -7194,6 +7271,11 @@ var RfqSwapManager = class _RfqSwapManager {
|
|
|
7194
7271
|
} catch {
|
|
7195
7272
|
fate = { fate: "unknown" };
|
|
7196
7273
|
}
|
|
7274
|
+
if ((swap.kind === "lightning_send" || swap.kind === "onchain_send") && fate.fate === "returned" && this.config.now() < swap.refundLocktime && !fate.leafScripts.every(
|
|
7275
|
+
(script) => script === swap.lockup?.script.nonInteractiveRefundScript
|
|
7276
|
+
)) {
|
|
7277
|
+
fate = { fate: "unknown" };
|
|
7278
|
+
}
|
|
7197
7279
|
if (swap.kind === "onchain_receive") return this.driveOnchainReceive(swap, fate);
|
|
7198
7280
|
if (fate.fate === "claimed" || fate.fate === "returned") {
|
|
7199
7281
|
this.stampLockupSpends(swap, fate.spends);
|
|
@@ -8007,6 +8089,7 @@ var createSwapDrive = (config) => {
|
|
|
8007
8089
|
let readyPromise;
|
|
8008
8090
|
const inFlight2 = /* @__PURE__ */ new Set();
|
|
8009
8091
|
let queue = Promise.resolve();
|
|
8092
|
+
let recheck;
|
|
8010
8093
|
const track = (work) => {
|
|
8011
8094
|
inFlight2.add(work);
|
|
8012
8095
|
void work.then(
|
|
@@ -8024,6 +8107,7 @@ var createSwapDrive = (config) => {
|
|
|
8024
8107
|
do {
|
|
8025
8108
|
await queue;
|
|
8026
8109
|
await Promise.allSettled([...inFlight2]);
|
|
8110
|
+
if (!disposed) await recheck;
|
|
8027
8111
|
await watcher?.idle();
|
|
8028
8112
|
} while (inFlight2.size > 0);
|
|
8029
8113
|
};
|
|
@@ -8046,12 +8130,12 @@ var createSwapDrive = (config) => {
|
|
|
8046
8130
|
storage(),
|
|
8047
8131
|
remember,
|
|
8048
8132
|
// Terminal records stay readable but are excluded from the manager's read, sparing
|
|
8049
|
-
// a rebuild per record just to file it `finished
|
|
8050
|
-
// `rfqId` (see `getRfqSwapsPage`).
|
|
8051
|
-
(r) => !undrivable.has(r.id) &&
|
|
8133
|
+
// a rebuild per record just to file it `finished`, except a refunded send restore
|
|
8134
|
+
// re-reads. The index still learns their `rfqId` (see `getRfqSwapsPage`).
|
|
8135
|
+
(r) => !undrivable.has(r.id) && isRfqSwapRestorable(r)
|
|
8052
8136
|
),
|
|
8053
8137
|
storage(),
|
|
8054
|
-
(r) => !undrivableLegacy.has(r.rfqId) &&
|
|
8138
|
+
(r) => !undrivableLegacy.has(r.rfqId) && isRfqSwapRestorable(r)
|
|
8055
8139
|
)
|
|
8056
8140
|
);
|
|
8057
8141
|
const effectiveState = (swap) => {
|
|
@@ -8500,8 +8584,9 @@ var createSwapDrive = (config) => {
|
|
|
8500
8584
|
}
|
|
8501
8585
|
}
|
|
8502
8586
|
const liveCorridor = corridor.filter((record) => !isRfqSwapTerminal(record.state));
|
|
8587
|
+
const recheckable = corridor.filter(isRecheckableRefundedSend);
|
|
8503
8588
|
const store = corridorStore();
|
|
8504
|
-
for (const record of liveCorridor) store.index(record);
|
|
8589
|
+
for (const record of [...liveCorridor, ...recheckable]) store.index(record);
|
|
8505
8590
|
const liveLegacy = await legacyLiveRfqSwaps(repository);
|
|
8506
8591
|
if (liveCorridor.length > 0 || liveLegacy.length > 0) {
|
|
8507
8592
|
try {
|
|
@@ -8548,6 +8633,17 @@ var createSwapDrive = (config) => {
|
|
|
8548
8633
|
}
|
|
8549
8634
|
}
|
|
8550
8635
|
emitAll();
|
|
8636
|
+
if (mode !== "readonly" && recheckable.length > 0) {
|
|
8637
|
+
recheck = (async () => {
|
|
8638
|
+
try {
|
|
8639
|
+
await contractsOf();
|
|
8640
|
+
managerDeps.repository = store;
|
|
8641
|
+
await manager.recheckRefundedSends({ stopped: () => disposed });
|
|
8642
|
+
} catch (error) {
|
|
8643
|
+
console.warn("[swap] the refunded send re-read did not complete", error);
|
|
8644
|
+
}
|
|
8645
|
+
})();
|
|
8646
|
+
}
|
|
8551
8647
|
};
|
|
8552
8648
|
const ready = () => readyPromise ??= restore();
|
|
8553
8649
|
const stop = async () => {
|
|
@@ -8795,6 +8891,18 @@ var cardMarketOf = (card, snapshot, key, backend) => ({
|
|
|
8795
8891
|
snapshot
|
|
8796
8892
|
});
|
|
8797
8893
|
var isCardMarket = (market) => market.kind === "card";
|
|
8894
|
+
var marketLegOf = (card, side, network) => {
|
|
8895
|
+
const asset8 = cardLegAssetId(card, side, network);
|
|
8896
|
+
return {
|
|
8897
|
+
...asset8 === void 0 ? {} : { asset: asset8 },
|
|
8898
|
+
decimals: (side === "base" ? card.base_asset : card.quote_asset).decimals,
|
|
8899
|
+
limits: (0, import_solver_discovery10.sideLimits)(card, side)
|
|
8900
|
+
};
|
|
8901
|
+
};
|
|
8902
|
+
var marketOf = (card, snapshot, network) => ({
|
|
8903
|
+
...cardMarketOf(card, snapshot, marketKeyOf(card), marketBackendOf(card)),
|
|
8904
|
+
legs: [marketLegOf(card, "base", network), marketLegOf(card, "quote", network)]
|
|
8905
|
+
});
|
|
8798
8906
|
|
|
8799
8907
|
// src/client/resolve.ts
|
|
8800
8908
|
var SUPPORTED_PAIRS = [
|
|
@@ -9599,7 +9707,7 @@ var assetSidesOf = (legs) => {
|
|
|
9599
9707
|
const giveIsBtc = legs.give.assetId === BTC_ASSET_ID;
|
|
9600
9708
|
const takeIsBtc = legs.take.assetId === BTC_ASSET_ID;
|
|
9601
9709
|
if (giveIsBtc && takeIsBtc) {
|
|
9602
|
-
throw new UnsupportedRoute("
|
|
9710
|
+
throw new UnsupportedRoute("give and take are both BTC, so the route swaps nothing", {
|
|
9603
9711
|
give: "arkade",
|
|
9604
9712
|
take: "arkade"
|
|
9605
9713
|
});
|
|
@@ -9701,9 +9809,11 @@ var quoteLightningReceive = async (input) => {
|
|
|
9701
9809
|
const pinned = pinnedFor(input);
|
|
9702
9810
|
const pair = rfqPairFor(input.legs.give, input.legs.take);
|
|
9703
9811
|
const rfqId = newRfqId();
|
|
9704
|
-
const secrets = await
|
|
9812
|
+
const [secrets, payoutAddress] = await Promise.all([
|
|
9813
|
+
(0, import_sdk35.provisionClaimSecret)(input.wallet),
|
|
9814
|
+
input.wallet.getAddress()
|
|
9815
|
+
]);
|
|
9705
9816
|
const paymentHash = import_base21.hex.encode(secrets.paymentHash);
|
|
9706
|
-
const payoutAddress = await input.wallet.getAddress();
|
|
9707
9817
|
const lightning = input.corridors.get("lightning").deps;
|
|
9708
9818
|
const sealTo = sealingKey(lightning);
|
|
9709
9819
|
const sealsAmount = pinned.on === "take" && input.legs.take.assetId === BTC_ASSET_ID;
|
|
@@ -9819,8 +9929,10 @@ var quoteOnchainSend = async (input) => {
|
|
|
9819
9929
|
claimVsize: onchain.claimVsize
|
|
9820
9930
|
}) : void 0;
|
|
9821
9931
|
const quoted = claimFee === void 0 ? pinned : { on: pinned.on, value: pinned.value + claimFee, source: pinned.source };
|
|
9822
|
-
const secrets = await
|
|
9823
|
-
|
|
9932
|
+
const [secrets, payoutKey] = await Promise.all([
|
|
9933
|
+
(0, import_sdk35.provisionClaimSecret)(input.wallet),
|
|
9934
|
+
(0, import_sdk35.provisionRefundKey)(input.wallet)
|
|
9935
|
+
]);
|
|
9824
9936
|
const paymentHash = import_base21.hex.encode(secrets.paymentHash);
|
|
9825
9937
|
const wire = await input.transport.requestQuote(
|
|
9826
9938
|
withCanonicalAmount(
|
|
@@ -9926,11 +10038,14 @@ var quoteOnchainReceive = async (input) => {
|
|
|
9926
10038
|
const pair = rfqPairFor(input.legs.give, input.legs.take);
|
|
9927
10039
|
const rfqId = newRfqId();
|
|
9928
10040
|
const l1Network = l1NetworkFromArk(input.info.network);
|
|
9929
|
-
const secrets = await
|
|
9930
|
-
|
|
10041
|
+
const [secrets, refundKey, payoutAddress, boardingAddress] = await Promise.all([
|
|
10042
|
+
(0, import_sdk35.provisionClaimSecret)(input.wallet),
|
|
10043
|
+
(0, import_sdk35.provisionRefundKey)(input.wallet),
|
|
10044
|
+
input.wallet.getAddress(),
|
|
10045
|
+
input.wallet.getBoardingAddress()
|
|
10046
|
+
]);
|
|
9931
10047
|
const paymentHash = import_base21.hex.encode(secrets.paymentHash);
|
|
9932
|
-
const
|
|
9933
|
-
const refundPkScript = l1ScriptForAddress(await input.wallet.getBoardingAddress(), l1Network);
|
|
10048
|
+
const refundPkScript = l1ScriptForAddress(boardingAddress, l1Network);
|
|
9934
10049
|
const wire = await input.transport.requestQuote(
|
|
9935
10050
|
withCanonicalAmount(
|
|
9936
10051
|
onchainReceiveRequest({
|
|
@@ -10325,10 +10440,10 @@ var createSwapClient = (config) => {
|
|
|
10325
10440
|
},
|
|
10326
10441
|
markets: async () => {
|
|
10327
10442
|
ensureLive("markets");
|
|
10328
|
-
const { discovery } = await resolved();
|
|
10443
|
+
const { base, discovery } = await resolved();
|
|
10329
10444
|
const snapshot = await discovery.load();
|
|
10330
10445
|
return usableMarkets(snapshot, config.policy).map(
|
|
10331
|
-
(card) =>
|
|
10446
|
+
(card) => marketOf(card, snapshot.ref, base.networkName)
|
|
10332
10447
|
);
|
|
10333
10448
|
},
|
|
10334
10449
|
pay: async (destination, options) => {
|
|
@@ -10958,6 +11073,7 @@ var readCommonProfile = (profile, paymentHash, chainId) => {
|
|
|
10958
11073
|
buildOfferFillPlan,
|
|
10959
11074
|
cancelSwap,
|
|
10960
11075
|
canonicalAssetId,
|
|
11076
|
+
cardLegAssetId,
|
|
10961
11077
|
cardMarketOf,
|
|
10962
11078
|
chainSourceOver,
|
|
10963
11079
|
chooseMarket,
|
|
@@ -11018,6 +11134,7 @@ var readCommonProfile = (profile, paymentHash, chainId) => {
|
|
|
11018
11134
|
liveArkadeInfo,
|
|
11019
11135
|
marketBackendOf,
|
|
11020
11136
|
marketKeyOf,
|
|
11137
|
+
marketOf,
|
|
11021
11138
|
marketRefOf,
|
|
11022
11139
|
networksOfInvoiceHrp,
|
|
11023
11140
|
nostrTransportFactory,
|
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 './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as
|
|
3
|
-
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef,
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-B-5ae_gQ.cjs';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, a8 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a9 as ObservationSeam, aa as OfferPreparation, ab as OnchainClaim, ac as OnchainRefund, ad as OperatorUnreachable, ae as ParsedRfqQuote, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, aj as QuotePreparation, 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, as as RfqPreparation, at as RfqQuoteInput, au as RfqRendezvous, av as RfqTransportFactory, aw as RouteSide, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aA as SwapDrive, aB as SwapDriveConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, aG as UnsupportedRoute, aH as VerbDeps, aI as acceptQuote, aJ as attesting, aK as buildOfferFillPlan, aL as cancelSwap, aM as canonicalAssetId, aN as cardMarketOf, aO as chooseMarket, aP as conflictingFields, aQ as corridorSet, aR as createNostrTransportFactory, aS as createSwapClient, aT as createSwapDrive, aU as deepFreeze, aV as digestJointGraph, aW as discoveryIndex, aX as eligibleMarkets, aY as enforceFeeCeiling, aZ as exchange, a_ as feedFetch, a$ as feedSpread, b0 as isAddressable, b1 as isCardMarket, b2 as isIndexedNetwork, b3 as isSwapError, b4 as isUsableCard, b5 as liveArkadeInfo, b6 as marketBackendOf, b7 as marketKeyOf, b8 as marketOf, b9 as marketRefOf, ba as nostrTransportFactory, bb as parseRfqQuote, bc as pay, bd as quoteFromFeed, be as quoteViaRfq, bf as readableRecord, bg as receive, bh as resolveCorridorBase, bi as resolveCorridorDeps, bj as rfqLeg, bk as rfqPairFor, bl as swapRecordOf, bm as toDiscoveryLeg, bn as unsignedPsbtBytes, bo as usableMarkets, bp as verifyJointGraph, bq as verifyOfferFillPlan, br as verifyPlanLegs, bs as withCanonicalAmount } from './offerFillPlan-B-5ae_gQ.cjs';
|
|
3
|
+
import { DiscoveredMarket, Side } from '@arkade-os/solver-discovery';
|
|
4
|
+
import { N as NetworkRef, A as AssetId, C as Corridor, 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-C4pvymhs.cjs';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-C4pvymhs.cjs';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-C0tHOvn6.cjs';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-C0tHOvn6.cjs';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-Bxq-lx_6.cjs';
|
|
11
|
+
import './offer-Diff5Flc.cjs';
|
|
12
12
|
import 'nostr-tools';
|
|
13
13
|
|
|
14
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
@@ -144,6 +144,8 @@ declare const evmQuoteSats: (quote: EvmRfqQuote) => number;
|
|
|
144
144
|
* asset on lightning or L1, or an id that is neither BTC nor the identity form.
|
|
145
145
|
*/
|
|
146
146
|
declare const publicAssetId: (corridor: Corridor, assetId: string, network: NetworkRef) => AssetId | undefined;
|
|
147
|
+
/** The public id for one leg of a card: a CAIP-19 id as published, else the legacy id's conversion. */
|
|
148
|
+
declare const cardLegAssetId: (card: DiscoveredMarket, side: Side, network: NetworkRef) => AssetId | undefined;
|
|
147
149
|
/** Every asset the snapshot names, as caller-writable ids and their tickers. */
|
|
148
150
|
declare const aliasTableFrom: (markets: readonly DiscoveredMarket[], network: NetworkRef) => AssetAliasTable;
|
|
149
151
|
/**
|
|
@@ -697,4 +699,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
697
699
|
ciphertext: string;
|
|
698
700
|
}>;
|
|
699
701
|
|
|
700
|
-
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, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, 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, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
|
702
|
+
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, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, 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, cardLegAssetId, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, 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 './offerFillPlan-
|
|
2
|
-
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as
|
|
3
|
-
import { DiscoveredMarket } from '@arkade-os/solver-discovery';
|
|
4
|
-
import { N as NetworkRef,
|
|
5
|
-
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-
|
|
1
|
+
import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './offerFillPlan-CJzneX6F.js';
|
|
2
|
+
export { e as AcceptConflict, f as AcceptInput, g as AcceptOptions, h as AmbiguousDestination, i as AmountEncodingUnsupported, j as AmountMismatch, k as AssetRfqPreparation, l as AttestingRfqTransport, B as BuildOfferFillPlanOpts, m as CORRIDOR_FACTORIES, n as CancelInput, o as CancelOutcome, p as ClaimedDestination, q as ClientDisposed, r as CorridorBase, s as CorridorClaim, t as CorridorCovenant, u as CorridorDeadline, v as CorridorDeps, w as CorridorDepsByCorridor, x as CorridorDrive, y as CorridorLockup, z as CorridorModule, E as CorridorOverrides, F as CorridorPass, G as CorridorRfqPreparation, H as DEFAULT_MAX_REFUND_WINDOW_SECONDS, I as DiscoveryConfig, J as DiscoveryIndexInput, K as DiscoverySnapshotUnavailable, N as DriveMode, P as DriveRefusal, Q as ExchangeOptions, R as FEED_TTL_MS, T as FeeCeiling, U as FeedFetch, V as FeedQuoteInput, W as FillSponsor, X as FillSponsorFare, Y as INDEXED_NETWORKS, Z as InconsistentRoute, _ as InsufficientFunds, $ as JointGraph, a0 as LockupOwner, a1 as Market, a2 as MarketLeg, a3 as MaxFeeExceeded, a4 as MissingCorridorDep, a5 as NotCancellable, a6 as OFFER_FILL_OWNERS, a7 as OFFER_FILL_TEMPLATE, a8 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a9 as ObservationSeam, aa as OfferPreparation, ab as OnchainClaim, ac as OnchainRefund, ad as OperatorUnreachable, ae as ParsedRfqQuote, af as PayOptions, ag as PayResult, ah as QuoteCheck, ai as QuoteExpired, aj as QuotePreparation, 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, as as RfqPreparation, at as RfqQuoteInput, au as RfqRendezvous, av as RfqTransportFactory, aw as RouteSide, ax as SWAP_ERROR_NAMES, ay as SwapClient, az as SwapClientConfig, aA as SwapDrive, aB as SwapDriveConfig, aC as SwapDriveRefusedError, aD as SwapError, aE as SwapErrorName, aF as SwapFilter, aG as UnsupportedRoute, aH as VerbDeps, aI as acceptQuote, aJ as attesting, aK as buildOfferFillPlan, aL as cancelSwap, aM as canonicalAssetId, aN as cardMarketOf, aO as chooseMarket, aP as conflictingFields, aQ as corridorSet, aR as createNostrTransportFactory, aS as createSwapClient, aT as createSwapDrive, aU as deepFreeze, aV as digestJointGraph, aW as discoveryIndex, aX as eligibleMarkets, aY as enforceFeeCeiling, aZ as exchange, a_ as feedFetch, a$ as feedSpread, b0 as isAddressable, b1 as isCardMarket, b2 as isIndexedNetwork, b3 as isSwapError, b4 as isUsableCard, b5 as liveArkadeInfo, b6 as marketBackendOf, b7 as marketKeyOf, b8 as marketOf, b9 as marketRefOf, ba as nostrTransportFactory, bb as parseRfqQuote, bc as pay, bd as quoteFromFeed, be as quoteViaRfq, bf as readableRecord, bg as receive, bh as resolveCorridorBase, bi as resolveCorridorDeps, bj as rfqLeg, bk as rfqPairFor, bl as swapRecordOf, bm as toDiscoveryLeg, bn as unsignedPsbtBytes, bo as usableMarkets, bp as verifyJointGraph, bq as verifyOfferFillPlan, br as verifyPlanLegs, bs as withCanonicalAmount } from './offerFillPlan-CJzneX6F.js';
|
|
3
|
+
import { DiscoveredMarket, Side } from '@arkade-os/solver-discovery';
|
|
4
|
+
import { N as NetworkRef, A as AssetId, C as Corridor, 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-BBVRh9ez.js';
|
|
5
|
+
export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as ArkadeCarrierChoice, u as Artifact, v as AssetIdError, w as AssetIdRefusal, x as AssetNamespace, y as AssetOn, z as AssetPart, B as AssetPaymentInput, D as AssetPaymentTerms, E as AssetRef, F as AssetScale, G as AssetSwapId, H as AtomicDecimal, J as AuctionMarketRef, K as AuctionProvenance, M as BITCOIN_RAILS, T as BTC_ASSET_PART, U as BitcoinRail, V as CORRIDORS, W as CORRIDOR_PASS, X as CardMarketRef, Y as CorridorId, Z as CorridorKind, _ as DepositArtifact, $ as DisplayDecimal, a0 as Endpoint, a1 as Ep, a2 as Hex, a3 as LOCKUP_OWNER, a4 as MarketBackend, a5 as MarketRef, a6 as OFFER_SWAP_ID_PREFIX, a7 as Outcome, a8 as ParsedAssetId, a9 as Quote, aa as QuoteLeg, ab as RAILS, ac as RFQ_SWAP_ID_PREFIX, ad as RailOf, ae as RankedBid, af as RawState, ag as ReceiverPaidCarrierQuote, ah as RecordedArtifact, ai as RecordedAssetPayment, aj as RecordedEndpoint, ak as RecordedInstrument, al as RecordedLeg, am as RestoredMarketRef, an as RfqAmountSide, ao as SnapshotRef, ap as Swap, aq as SwapFamily, ar as SwapRecordCommon, as as SwapUpdate, at as TaxiIdentity, au as Unsubscribe, av as VerifiedCarrierTerms, aw as arkadeAsset, ax as artifactOf, ay as assetPartOf, az as assetSwapIdOf, aA as bitcoinNetworkOf, aB as btcAssetPart, aC as btcOn, aD as corridorOfRail, aE as corridorOutcome, aF as decodeRfqAmount, aG as encodeRfqAmount, aH as familyOfSwapId, aI as formatAssetId, aJ as fromAtomicDecimal, aK as fromRfqAmountSide, aL as fundingWasNotSubmitted, aM as fundsFromWallet, aN as instrumentOf, aO as isAssetId, aP as isAtomicDecimal, aQ as isBtcAsset, aR as isBtcAssetLenient, aS as isNetworkRef, aT as issuanceOf, aU as legOf, aV as offerOutcome, aW as parseAssetId, aX as quoteIdOfSwapId, aY as railOf, aZ as railOfCorridor, a_ as readsChain, a$ as recordArtifact, b0 as recordEndpoint, b1 as recordInstrument, b2 as recordLeg, b3 as recordOutcome, b4 as sameAsset, b5 as swapOf, b6 as toAtomicDecimal, b7 as toRfqAmountSide, b8 as toSafeNumber } from './repository-BBVRh9ez.js';
|
|
6
6
|
import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-C0tHOvn6.js';
|
|
7
7
|
export { S as SwapRefusal } from './rfq-C0tHOvn6.js';
|
|
8
8
|
import * as btc from '@scure/btc-signer';
|
|
9
9
|
import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
|
|
10
|
-
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-
|
|
11
|
-
import './offer-
|
|
10
|
+
import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-7BiRa4oB.js';
|
|
11
|
+
import './offer-BPD2ortO.js';
|
|
12
12
|
import 'nostr-tools';
|
|
13
13
|
|
|
14
14
|
/** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
|
|
@@ -144,6 +144,8 @@ declare const evmQuoteSats: (quote: EvmRfqQuote) => number;
|
|
|
144
144
|
* asset on lightning or L1, or an id that is neither BTC nor the identity form.
|
|
145
145
|
*/
|
|
146
146
|
declare const publicAssetId: (corridor: Corridor, assetId: string, network: NetworkRef) => AssetId | undefined;
|
|
147
|
+
/** The public id for one leg of a card: a CAIP-19 id as published, else the legacy id's conversion. */
|
|
148
|
+
declare const cardLegAssetId: (card: DiscoveredMarket, side: Side, network: NetworkRef) => AssetId | undefined;
|
|
147
149
|
/** Every asset the snapshot names, as caller-writable ids and their tickers. */
|
|
148
150
|
declare const aliasTableFrom: (markets: readonly DiscoveredMarket[], network: NetworkRef) => AssetAliasTable;
|
|
149
151
|
/**
|
|
@@ -697,4 +699,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
|
|
|
697
699
|
ciphertext: string;
|
|
698
700
|
}>;
|
|
699
701
|
|
|
700
|
-
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, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, 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, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
|
702
|
+
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, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, 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, cardLegAssetId, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
|
package/dist/advanced.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
buildOfferFillPlan,
|
|
46
46
|
cancelSwap,
|
|
47
47
|
canonicalAssetId,
|
|
48
|
+
cardLegAssetId,
|
|
48
49
|
cardMarketOf,
|
|
49
50
|
chainSourceOver,
|
|
50
51
|
chooseMarket,
|
|
@@ -84,6 +85,7 @@ import {
|
|
|
84
85
|
liveArkadeInfo,
|
|
85
86
|
marketBackendOf,
|
|
86
87
|
marketKeyOf,
|
|
88
|
+
marketOf,
|
|
87
89
|
marketRefOf,
|
|
88
90
|
nostrTransportFactory,
|
|
89
91
|
offerFactsOf,
|
|
@@ -136,7 +138,7 @@ import {
|
|
|
136
138
|
withCanonicalAmount,
|
|
137
139
|
withDepositFate,
|
|
138
140
|
withRfqState
|
|
139
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-J2PMAQP2.js";
|
|
140
142
|
import {
|
|
141
143
|
ACTIVITY_TOKEN,
|
|
142
144
|
Amount,
|
|
@@ -171,7 +173,7 @@ import {
|
|
|
171
173
|
recordOutcome,
|
|
172
174
|
swapOf,
|
|
173
175
|
toAtomicDecimal
|
|
174
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-BLECLU5Q.js";
|
|
175
177
|
import {
|
|
176
178
|
ARKADE_BTC,
|
|
177
179
|
SwapRefusal,
|
|
@@ -180,7 +182,7 @@ import {
|
|
|
180
182
|
bindsClaimAmount,
|
|
181
183
|
rfqPair,
|
|
182
184
|
sealClaimPacket
|
|
183
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-ICSREL7N.js";
|
|
184
186
|
import "./chunk-A3SHHRX4.js";
|
|
185
187
|
|
|
186
188
|
// src/reveal.ts
|
|
@@ -609,6 +611,7 @@ export {
|
|
|
609
611
|
buildOfferFillPlan,
|
|
610
612
|
cancelSwap,
|
|
611
613
|
canonicalAssetId,
|
|
614
|
+
cardLegAssetId,
|
|
612
615
|
cardMarketOf,
|
|
613
616
|
chainSourceOver,
|
|
614
617
|
chooseMarket,
|
|
@@ -669,6 +672,7 @@ export {
|
|
|
669
672
|
liveArkadeInfo,
|
|
670
673
|
marketBackendOf,
|
|
671
674
|
marketKeyOf,
|
|
675
|
+
marketOf,
|
|
672
676
|
marketRefOf,
|
|
673
677
|
networksOfInvoiceHrp,
|
|
674
678
|
nostrTransportFactory,
|