@arkade-os/swap 0.1.0-rc.2 → 0.1.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -2
- package/dist/advanced.cjs +8376 -0
- package/dist/advanced.d.cts +550 -0
- package/dist/advanced.d.ts +550 -0
- package/dist/advanced.js +451 -0
- package/dist/chunk-A3SHHRX4.js +104 -0
- package/dist/chunk-HUQQVBC4.js +4262 -0
- package/dist/{chunk-EOYGUCDM.js → chunk-ITFCQWPG.js} +755 -1382
- package/dist/chunk-PVB7EBAM.js +2517 -0
- package/dist/errors-C3h8ANmE.d.ts +1560 -0
- package/dist/errors-hm7aqnRM.d.cts +1560 -0
- package/dist/index.cjs +4861 -3988
- package/dist/index.d.cts +69 -2812
- package/dist/index.d.ts +69 -2812
- package/dist/index.js +179 -3719
- package/dist/lockupContract-5r5RlgOJ.d.cts +137 -0
- package/dist/lockupContract-5r5RlgOJ.d.ts +137 -0
- package/dist/node/index.cjs +61 -10
- package/dist/node/index.d.cts +249 -591
- package/dist/node/index.d.ts +249 -591
- package/dist/node/index.js +65 -10
- package/dist/nostr.cjs +191 -11
- package/dist/nostr.d.cts +23 -68
- package/dist/nostr.d.ts +23 -68
- package/dist/nostr.js +3 -4
- package/dist/offer-Bd9Yvd8Z.d.ts +261 -0
- package/dist/offer-F88rtL_I.d.cts +261 -0
- package/dist/protocol.cjs +4086 -3706
- package/dist/protocol.d.cts +163 -768
- package/dist/protocol.d.ts +163 -768
- package/dist/protocol.js +190 -173
- package/dist/repositories/realm/index.cjs +55 -11
- package/dist/repositories/realm/index.d.cts +18 -30
- package/dist/repositories/realm/index.d.ts +18 -30
- package/dist/repositories/realm/index.js +49 -12
- package/dist/repositories/sqlite/index.cjs +61 -10
- package/dist/repositories/sqlite/index.d.cts +7 -6
- package/dist/repositories/sqlite/index.d.ts +7 -6
- package/dist/repositories/sqlite/index.js +57 -11
- package/dist/repository-BuYWGAKz.d.cts +2261 -0
- package/dist/repository-DYnRLPt-.d.ts +2261 -0
- package/dist/rfq-60PGpQ_x.d.cts +950 -0
- package/dist/rfq-60PGpQ_x.d.ts +950 -0
- package/dist/watch-BTyiBLSd.d.ts +74 -0
- package/dist/watch-M_KY-5ho.d.cts +74 -0
- package/package.json +20 -10
- package/dist/chunk-LYCMM3VB.js +0 -1357
- package/dist/chunk-U7VWWTL6.js +0 -66
- package/dist/repository-_zU9_pM3.d.cts +0 -3426
- package/dist/repository-kO95noyv.d.ts +0 -3426
- package/dist/rfq-DdBV4JO5.d.cts +0 -1097
- package/dist/rfq-DdBV4JO5.d.ts +0 -1097
- package/dist/watch-CQqvwgwY.d.cts +0 -96
- package/dist/watch-wMbmfN4p.d.ts +0 -96
package/dist/protocol.d.cts
CHANGED
|
@@ -1,63 +1,37 @@
|
|
|
1
|
-
import { ProvisionedKey, ProvisionedClaimSecret,
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
export { A as ARKADE_BTC,
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
|
|
2
|
+
import { b9 as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, b3 as RfqSwapState, b5 as SwapOperator, ba as LockupContractSource, bb as RfqSwap, bc as ArkadeRefundResult, bd as LockupVtxo } from './repository-BuYWGAKz.cjs';
|
|
3
|
+
export { c as AssetSwapStatus, be as AvailableRfqSwapManagerCallbacks, bf as BTC_ASSET_ID, bg as LightningReceiveSwap, bh as LightningSendSwap, bi as LockupFate, bj as LockupNeedsRecoveryError, bk as LockupParams, bl as LockupSpend, bm as OnchainSendAction, bn as OnchainSendSwap, bo as PersistableRfqSwap, bp as PreimageBlockedReason, bq as PreimageNotRecoverableError, br as RFQ_SWAP_RETENTION_SECONDS, bs as RefundOutcome, bt as RfqRestoreFailure, bu as RfqRestoreOptions, bv as RfqRestoreResult, b8 as RfqSwapActionName, bw as RfqSwapLockup, bx as RfqSwapManager, b7 as RfqSwapManagerCallbacks, by as RfqSwapManagerConfig, bz as RfqSwapManagerDeps, bA as RfqSwapManagerEvents, bB as RfqSwapOrigin, bC as RfqSwapOriginRequired, bD as RfqSwapOutcome, a as RfqSwapRecordStore, bE as addAssetSwap, bF as awaitRfqResolution, bG as createRfqSwapRecord, bH as findLockupVtxos, bI as getAssetSwaps, bJ as isRfqTerminal, bK as nextOnchainAction, bL as normalizeRfqSwapRecord, bM as preimageForSwapRecord, bN as pushRefundWithoutReceiver, bO as readLockupFate, bP as rebuildRfqSwap, bQ as refundIfUnresolved, bR as rfqSwapOriginOf, bS as shouldRetainRfqSwap, bT as swapSecretsToRecord, bU as updateAssetSwap, bV as updateRfqSwapRecord } from './repository-BuYWGAKz.cjs';
|
|
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-60PGpQ_x.cjs';
|
|
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 ONCHAIN_BTC, s as ONCHAIN_CLAIM_MARGIN_SECONDS, t as ONCHAIN_DUST_SATS, u as ONCHAIN_ORDER_MARGIN_SECONDS, v as ONCHAIN_RECEIVE_PAIR, w as ONCHAIN_SECONDS_PER_BLOCK, x as ONCHAIN_SEND_PAIR, y as OnchainHtlcPhase, z as RelaySocket, R as RfqQuote, B as RfqRefusalReason, D as RfqStatus, E as arkadeAssetLeg, F as arkadeSwapRequest, G as assertArkadeFundable, J as awaitOnchainFill, K as buildHtlcClaim, N as buildHtlcRefund, P as canonicalAssetAmount, Q as claimOnchainFill, T as classifyOnchainHtlc, U as deriveLightningReceive, V as deriveOnchainReceive, W as deriveOnchainSend, X as extractPreimage, Y as httpTransport, Z as l1ScriptForAddress, _ as lightningReceiveContract, $ as lightningReceiveRequest, a0 as lightningSendContract, a1 as lightningSendRequest, a2 as newPreimage, a3 as normalizeMakerPkScript, a4 as normalizeMakerPublicKey, a5 as onchainHtlcScript, a6 as onchainReceiveRequest, a7 as onchainSendRequest, a8 as paymentHashOf, a9 as relayTransport, aa as requestArkadeSwap, ab as requestLightningReceive, ac as requestOnchainReceive, ad as unilateralClaimDelay, ae as unilateralRefundDelay, af as unilateralRefundWithoutReceiverDelay, ag as verifyLockupAddress, ah as verifyOfferAddress, ai as verifyReceiveInvoice } from './rfq-60PGpQ_x.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-5r5RlgOJ.cjs';
|
|
7
|
+
import { Network as Network$1, LocalCardInput, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
|
|
8
|
+
import { O as Offer } from './offer-F88rtL_I.cjs';
|
|
9
|
+
export { A as ASSET_CARRIER_SATS, F as FillFunding, N as NoSpendableDepositError, a as OFFER_PACKET_TYPE, b as OfferCovenantMismatchError, c as cancelOffer, d as createOffer, e as decodeOffer, f as encodeOffer, g as fillOffer, o as offerContract, s as swapPrograms } from './offer-F88rtL_I.cjs';
|
|
10
|
+
export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-M_KY-5ho.cjs';
|
|
8
11
|
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Independent of any hashlock: it feeds `senderIdentityForSwapRecord` on the
|
|
13
|
-
* refund side, and a corridor that settles with no preimage at all still needs
|
|
14
|
-
* it. A corridor whose leg this wallet never signs omits the key entirely — as
|
|
15
|
-
* with everything else here, absent rather than blank.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
18
|
-
*/
|
|
12
|
+
/** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
|
|
13
|
+
* whose leg this wallet never signs. */
|
|
19
14
|
interface RfqSignerProjection {
|
|
20
15
|
/** Public. The wallet re-derives the signer from it; no key material is at
|
|
21
16
|
* rest. */
|
|
22
17
|
signingDescriptor: string;
|
|
23
18
|
}
|
|
24
19
|
/**
|
|
25
|
-
* What a
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `paymentHash` is identity, not capability — `lightning_send` carries one and
|
|
29
|
-
* can never open it. The preimage fields are the capability, and only a corridor
|
|
30
|
-
* where WE claim ever writes them: `provisionClaimSecret` produces that arm,
|
|
31
|
-
* `provisionRefundKey` does not.
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
20
|
+
* What a preimage-locked leg records about the LOCK, at `profile.hashlock`. `paymentHash` is
|
|
21
|
+
* identity, not capability; the preimage fields are the capability, written only where WE claim
|
|
22
|
+
* (`provisionClaimSecret` produces that arm, `provisionRefundKey` does not).
|
|
34
23
|
*/
|
|
35
24
|
type RfqHashlockProjection = Omit<SwapSecretsProjection, "signingDescriptor"> & {
|
|
36
25
|
/** `sha256(P)`, hex. Not recoverable from the covenant, which binds
|
|
37
26
|
* `hash160(P)`. */
|
|
38
27
|
paymentHash: string;
|
|
39
28
|
};
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* the hashlock's. **Never a stored shape**: nothing writes this object,
|
|
43
|
-
* {@link rfqClaimSecretOf} assembles it from the two keys above, which is what
|
|
44
|
-
* keeps the descriptor stored once.
|
|
45
|
-
*
|
|
46
|
-
* Structurally `SwapSecretsProjection & { paymentHash }`, which is exactly that
|
|
47
|
-
* helper's parameter.
|
|
48
|
-
*
|
|
49
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
50
|
-
*/
|
|
29
|
+
/** The composed view `preimageForSwapRecord` reads. **Never a stored shape**: assembled by
|
|
30
|
+
* {@link rfqClaimSecretOf} from the two keys, so the descriptor is stored once. */
|
|
51
31
|
type RfqClaimSecretProjection = RfqSignerProjection & RfqHashlockProjection;
|
|
52
32
|
/**
|
|
53
|
-
* The
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* Writes what the provisioning result actually has. Omit `paymentHash` and you
|
|
57
|
-
* get `signer` alone — which is what a non-hashlock corridor calls, and why it
|
|
58
|
-
* never has to reach for `hashlock`.
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
33
|
+
* The one supported way to turn a provisioned secret into stored profile keys (the corridor-owned
|
|
34
|
+
* counterpart of `onchainSendProfile`). Without `paymentHash` it writes `signer` alone.
|
|
61
35
|
*/
|
|
62
36
|
declare const rfqSecretsProfile: (secrets: ProvisionedKey | ProvisionedClaimSecret, paymentHash?: string) => {
|
|
63
37
|
signer: RfqSignerProjection;
|
|
@@ -66,51 +40,29 @@ declare const rfqSecretsProfile: (secrets: ProvisionedKey | ProvisionedClaimSecr
|
|
|
66
40
|
/**
|
|
67
41
|
* The stored signer projection, for `senderIdentityForSwapRecord`.
|
|
68
42
|
*
|
|
69
|
-
* `undefined` ONLY when
|
|
70
|
-
*
|
|
71
|
-
* "
|
|
72
|
-
* different answers, and `senderIdentityForSwapRecord` turns the first into a
|
|
73
|
-
* permanent `RefundNotLocallyPossibleError("no-secrets")` the manager acts on.
|
|
74
|
-
* Handing it a silently-emptied projection would report "no local refund is
|
|
75
|
-
* possible" for a storage bug.
|
|
76
|
-
*
|
|
77
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
43
|
+
* `undefined` ONLY when no `signer` key exists (a leg this wallet does not sign). A present but
|
|
44
|
+
* unusable one throws: the caller turns "no local signer" into a permanent
|
|
45
|
+
* `RefundNotLocallyPossibleError("no-secrets")`, which must not be reported for a storage bug.
|
|
78
46
|
*/
|
|
79
47
|
declare const rfqSignerOf: (record: RfqSwapRecord) => RfqSignerProjection | undefined;
|
|
80
48
|
/**
|
|
81
|
-
* The claim inputs, or `undefined` when
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* whether a leg claims is the corridor's fact.
|
|
86
|
-
*
|
|
87
|
-
* When the handler DOES claim, this validates and throws
|
|
88
|
-
* `PreimageNotRecoverableError("malformed-record")` rather than returning a
|
|
89
|
-
* partial projection — which `preimageForSwapRecord` would claim with, its hash
|
|
90
|
-
* check being conditional on the very field that went missing.
|
|
91
|
-
*
|
|
92
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
49
|
+
* The claim inputs, or `undefined` when the corridor's handler has no `claimSecret` (no hashlock, or
|
|
50
|
+
* a leg we refund). When it does claim, a malformed projection throws
|
|
51
|
+
* `PreimageNotRecoverableError("malformed-record")` rather than returning a partial one that
|
|
52
|
+
* `preimageForSwapRecord` would claim with unverified.
|
|
93
53
|
*/
|
|
94
54
|
declare const rfqClaimSecretOf: (record: RfqSwapRecord) => RfqClaimSecretProjection | undefined;
|
|
95
55
|
|
|
96
56
|
/**
|
|
97
|
-
* `arkade:BTC->lightning:BTC`.
|
|
98
|
-
* solver claims the lockup, the trader's only move is the refund, and the rest
|
|
99
|
-
* of the leg is fully described by the contract row.
|
|
100
|
-
*
|
|
101
|
-
* The one leg with a hashlock it can never open — P belongs to the payee — so
|
|
102
|
-
* `hashlock` here is `{ paymentHash }` alone and `signer` holds a REFUND key.
|
|
57
|
+
* `arkade:BTC->lightning:BTC`. The solver claims the lockup; the trader's only move is the refund.
|
|
103
58
|
*
|
|
104
|
-
*
|
|
59
|
+
* P belongs to the payee, so `hashlock` is `{ paymentHash }` alone and `signer` holds a REFUND key.
|
|
105
60
|
*/
|
|
106
61
|
interface LightningSendProfile extends Record<string, unknown> {
|
|
107
62
|
signer: RfqSignerProjection;
|
|
108
63
|
hashlock: RfqHashlockProjection;
|
|
109
64
|
}
|
|
110
|
-
/** `lightning:BTC->arkade:BTC`.
|
|
111
|
-
*
|
|
112
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
113
|
-
*/
|
|
65
|
+
/** `lightning:BTC->arkade:BTC`. */
|
|
114
66
|
interface LightningReceiveProfile extends Record<string, unknown> {
|
|
115
67
|
signer: RfqSignerProjection;
|
|
116
68
|
hashlock: RfqHashlockProjection;
|
|
@@ -121,20 +73,12 @@ interface LightningReceiveProfile extends Record<string, unknown> {
|
|
|
121
73
|
/**
|
|
122
74
|
* Our Arkade claim's txid, once submitted.
|
|
123
75
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* the onchain leg's `claimTxid`. Restoring without it re-arms the value gate
|
|
127
|
-
* against a lockup we have already partly claimed — `claimIfFunded` reads
|
|
128
|
-
* `partiallyClaimed` off exactly this — so the remainder is refused over a
|
|
129
|
-
* preimage that is already public, and a swap that did claim is relabelled
|
|
130
|
-
* `needs_counterparty` once its window shuts.
|
|
76
|
+
* `claimIfFunded` derives `partiallyClaimed` from this. Restoring without it re-arms the value
|
|
77
|
+
* gate against a partly claimed lockup, refusing the remainder over an already-public preimage.
|
|
131
78
|
*/
|
|
132
79
|
claimTxid?: string;
|
|
133
80
|
}
|
|
134
|
-
/** `arkade:BTC->onchain:BTC`.
|
|
135
|
-
*
|
|
136
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
137
|
-
*/
|
|
81
|
+
/** `arkade:BTC->onchain:BTC`. */
|
|
138
82
|
interface OnchainSendProfile extends Record<string, unknown> {
|
|
139
83
|
signer: RfqSignerProjection;
|
|
140
84
|
hashlock: RfqHashlockProjection;
|
|
@@ -147,21 +91,17 @@ interface OnchainSendProfile extends Record<string, unknown> {
|
|
|
147
91
|
htlcLocktime: number;
|
|
148
92
|
network: OnchainNetwork;
|
|
149
93
|
/**
|
|
150
|
-
* The L1 address the fill was expected at
|
|
151
|
-
* `
|
|
152
|
-
* against the quote's own `profile.htlc_address`.
|
|
94
|
+
* The L1 address the fill was expected at (`htlc.address`, already checked against the quote's
|
|
95
|
+
* `profile.htlc_address`).
|
|
153
96
|
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* parameter that came back wrong. The arkade lockup gets that check from
|
|
158
|
-
* `rebuildRfqSwap`; this leg, the one whose parameters have no second source
|
|
159
|
-
* anywhere, would otherwise get none — and a swapped or corrupted key
|
|
160
|
-
* derives another perfectly valid HTLC, at an address nobody funded.
|
|
97
|
+
* Stored independently of the keys so the rebuild must reproduce it: a swapped or corrupted
|
|
98
|
+
* key derives another valid HTLC at an address nobody funded, and this leg has no contract row
|
|
99
|
+
* to catch that.
|
|
161
100
|
*/
|
|
162
101
|
htlcAddress: string;
|
|
163
102
|
/** `profile.min_confirmations`; gates when the fill is claimable. */
|
|
164
103
|
minConfirmations: number;
|
|
104
|
+
expectedAmount: number;
|
|
165
105
|
/** Where the claim PAYS, hex. The spender's own choice, so nothing else
|
|
166
106
|
* gives it back — and `buildHtlcClaim` needs it. */
|
|
167
107
|
payoutPkScript: string;
|
|
@@ -175,281 +115,25 @@ interface OnchainSendProfile extends Record<string, unknown> {
|
|
|
175
115
|
claimTxid?: string;
|
|
176
116
|
}
|
|
177
117
|
/**
|
|
178
|
-
* Build the profile from what `requestOnchainSend` returned.
|
|
179
|
-
*
|
|
180
|
-
* Pass the whole result: every field this needs is on it, so the mapping is
|
|
181
|
-
* done here, once, instead of at each call site.
|
|
118
|
+
* Build the profile's L1 half from what `requestOnchainSend` returned.
|
|
182
119
|
*
|
|
183
|
-
*
|
|
184
|
-
* `htlcLocktime`
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* input to anything, it is the derived value the rebuild checks the inputs
|
|
188
|
-
* against, so writing it is easy to skip and impossible to reconstruct later.
|
|
189
|
-
* A caller copying fields across by hand gets all three right or restores a
|
|
190
|
-
* swap that watches nothing.
|
|
191
|
-
*
|
|
192
|
-
* The other two corridors have no such builder, deliberately: their profiles
|
|
193
|
-
* are the request result's own fields under their own names, with nothing
|
|
194
|
-
* derived and nothing renamed.
|
|
195
|
-
*
|
|
196
|
-
* The L1 half ONLY. `signer` and `hashlock` come from `rfqSecretsProfile`, which
|
|
197
|
-
* every corridor calls — folding them in here would give this leg a one-call
|
|
198
|
-
* mapper the other two cannot have, and the uniform rule ("`rfqSecretsProfile`
|
|
199
|
-
* first, then whatever the corridor adds") is what keeps the per-corridor
|
|
200
|
-
* instructions short enough to follow.
|
|
201
|
-
*
|
|
202
|
-
* @deprecated Internal to the corridor modules; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
120
|
+
* Exists because the mapping is easy to get wrong by hand: `htlcParams.refundLocktime` becomes
|
|
121
|
+
* `htlcLocktime` (the record's `refundLocktime` is the arkade lockup's), keys go bytes to hex, and
|
|
122
|
+
* `htlcAddress` is a derived check value that is easy to skip and impossible to reconstruct.
|
|
123
|
+
* `signer` and `hashlock` still come from `rfqSecretsProfile`, as for every corridor.
|
|
203
124
|
*/
|
|
204
125
|
declare function onchainSendProfile(result: {
|
|
205
126
|
htlc: Pick<OnchainHtlc, "address">;
|
|
206
127
|
htlcParams: OnchainHtlcParams;
|
|
207
128
|
l1Network: OnchainNetwork;
|
|
208
129
|
minConfirmations: number;
|
|
130
|
+
expectedAmount: number;
|
|
209
131
|
payoutPkScript: Uint8Array;
|
|
210
132
|
}): Omit<OnchainSendProfile, "signer" | "hashlock">;
|
|
211
133
|
|
|
212
134
|
/**
|
|
213
|
-
* The
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* **These are the base: an offer carrying an exit delay compiles to a third
|
|
217
|
-
* closure that is not in either file.** The tree is not fixed-shape — the
|
|
218
|
-
* protocol defines the exit as `iff ExitDelay`, and solverd appends it the same
|
|
219
|
-
* way (`pkg/swap/contract/offer.go`, `VtxoScript`) — so it cannot be a function
|
|
220
|
-
* in a static artifact without splitting these into one file per exit variant.
|
|
221
|
-
* {@link withExitClosure} owns that step, and the golden in `offer.test.ts`
|
|
222
|
-
* pins the artifact it produces so the whole contract is still readable as data.
|
|
223
|
-
*
|
|
224
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
225
|
-
*/
|
|
226
|
-
declare const swapPrograms: Record<"wantAsset" | "wantBtc", ReturnType<typeof arkade.parseArtifact>>;
|
|
227
|
-
/** A full-fill offer. Exactly one field names an asset: `wantAsset` set = the
|
|
228
|
-
* fill must deliver that asset (the deposit may be BTC or another asset,
|
|
229
|
-
* identified by the funding vtxo itself); `offerAsset` set = the user
|
|
230
|
-
* deposits that asset and wants sats.
|
|
231
|
-
*
|
|
232
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
233
|
-
*/
|
|
234
|
-
interface Offer {
|
|
235
|
-
/** The scriptPubKey of the swap contract. */
|
|
236
|
-
swapPkScript: Uint8Array;
|
|
237
|
-
/** Amount the user wants (asset units, or sats when wanting BTC). */
|
|
238
|
-
wantAmount: bigint;
|
|
239
|
-
/** The asset the user wants. Omitted when wanting BTC. */
|
|
240
|
-
wantAsset?: asset.AssetId;
|
|
241
|
-
/** The asset the user deposits. Omitted when depositing BTC. */
|
|
242
|
-
offerAsset?: asset.AssetId;
|
|
243
|
-
/** Maker's taproot scriptPubKey (34 bytes) — where the fill must pay. */
|
|
244
|
-
makerPkScript: Uint8Array;
|
|
245
|
-
/** Maker's x-only key (32 bytes) — the cancel path's `user` signer. */
|
|
246
|
-
makerPublicKey: Uint8Array;
|
|
247
|
-
/** Covenant co-signer (emulator) x-only key (32 bytes). */
|
|
248
|
-
emulatorPubkey: Uint8Array;
|
|
249
|
-
/** Partial-fill numerator. Reserved wire space in V1: carried through the
|
|
250
|
-
* codec so an offer that sets it decodes, never interpreted here. */
|
|
251
|
-
ratioNum?: bigint;
|
|
252
|
-
/** Partial-fill denominator. Set with {@link Offer.ratioNum} or not at all. */
|
|
253
|
-
ratioDen?: bigint;
|
|
254
|
-
/** The maker's unilateral exit path. Present adds a third closure to the
|
|
255
|
-
* taproot tree, so it changes `swapPkScript` — see {@link offerVtxoScript}. */
|
|
256
|
-
exitDelay?: RelativeTimelock;
|
|
257
|
-
}
|
|
258
|
-
/** Compile the offer's contract: program + args -> taproot tree.
|
|
259
|
-
*
|
|
260
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
261
|
-
*/
|
|
262
|
-
declare function offerContract(offer: Omit<Offer, "swapPkScript">, operatorPubkey: Uint8Array): InstanceType<typeof arkade.ArkadeProgramScript>;
|
|
263
|
-
/** Extension packet type tag for Arkade Intents offers.
|
|
264
|
-
*
|
|
265
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
266
|
-
*/
|
|
267
|
-
declare const OFFER_PACKET_TYPE = 3;
|
|
268
|
-
/** Serialize an offer to TLV bytes (the packet payload).
|
|
269
|
-
*
|
|
270
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
271
|
-
*/
|
|
272
|
-
declare function encodeOffer(offer: Offer): Uint8Array;
|
|
273
|
-
/** Parse TLV bytes into an offer. Throws on malformed or unknown records.
|
|
274
|
-
*
|
|
275
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
276
|
-
*/
|
|
277
|
-
declare function decodeOffer(data: Uint8Array): Offer;
|
|
278
|
-
/**
|
|
279
|
-
* Build a new offer for `wallet` (the user). Fund `address` with the side
|
|
280
|
-
* you deposit, embedding the returned extension, and the solver does the rest:
|
|
281
|
-
*
|
|
282
|
-
* // BTC -> asset
|
|
283
|
-
* const o = await createOffer(wallet, { wantAmount: 1000n, wantAsset })
|
|
284
|
-
* await wallet.send({ address: o.address, amount: 1000, extensions: [o.extension] })
|
|
285
|
-
*
|
|
286
|
-
* // asset -> BTC (the sats are the VTXO carrier for the asset)
|
|
287
|
-
* const o = await createOffer(wallet, { wantAmount: 1000n, offerAsset })
|
|
288
|
-
* await wallet.send({ address: o.address, amount: 500,
|
|
289
|
-
* assets: [{ assetId, amount: 1000n }],
|
|
290
|
-
* extensions: [o.extension] })
|
|
291
|
-
*
|
|
292
|
-
* Broadcasts nothing, but does write locally: the covenant is registered with
|
|
293
|
-
* the wallet's contract manager before the address is returned, so the deposit
|
|
294
|
-
* is watched from the moment it lands and is marked as escrow (see
|
|
295
|
-
* {@link registerOfferContract}). Registration deliberately happens *before*
|
|
296
|
-
* funding rather than after: nothing is at stake yet, so a failure can throw
|
|
297
|
-
* and be retried, where the same failure after `wallet.send` would leave a
|
|
298
|
-
* funded deposit unwatched with no way to notice.
|
|
299
|
-
*
|
|
300
|
-
* **The maker's unilateral exit closure is built by default**, at the server's
|
|
301
|
-
* own `unilateralExitDelay` — the same thing solverd does. Without it `cancel`
|
|
302
|
-
* is the only way back out, and `cancel` needs the server's signature: a server
|
|
303
|
-
* that will not co-sign leaves the deposit stuck at the swap address until the
|
|
304
|
-
* VTXO expires and the operator sweeps it. An offer has no expiry of its own,
|
|
305
|
-
* so that exposure has no end. `noExit` opts out for a caller who wants the
|
|
306
|
-
* smaller tree and accepts the dependency.
|
|
307
|
-
*
|
|
308
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
309
|
-
*/
|
|
310
|
-
declare function createOffer(wallet: IWallet, params: {
|
|
311
|
-
wantAmount: bigint;
|
|
312
|
-
wantAsset?: asset.AssetId;
|
|
313
|
-
offerAsset?: asset.AssetId;
|
|
314
|
-
/** Co-signer key override (33-byte compressed hex); see
|
|
315
|
-
* {@link resolveEmulatorPubkey}. */
|
|
316
|
-
emulatorPubkey?: string;
|
|
317
|
-
/** Override the exit closure's delay. Defaults to the server's own
|
|
318
|
-
* `unilateralExitDelay`, which is the delay solverd uses too. */
|
|
319
|
-
exitDelay?: RelativeTimelock;
|
|
320
|
-
/** Publish without the exit closure, leaving `cancel` — which needs the
|
|
321
|
-
* server — as the only way back out. See the note on this function. */
|
|
322
|
-
noExit?: boolean;
|
|
323
|
-
}): Promise<{
|
|
324
|
-
/** The encoded offer, hex. **Persist this** — it is the only input
|
|
325
|
-
* `cancelOffer` needs to rebuild the covenant, and the restore scan reads
|
|
326
|
-
* the same bytes back off the funding tx into `AssetSwap.offerHex`. */
|
|
327
|
-
offerHex: string;
|
|
328
|
-
/** Ready for `wallet.send`'s `extensions` — the caller never handles the packet type. */
|
|
329
|
-
extension: {
|
|
330
|
-
type: number;
|
|
331
|
-
payload: Uint8Array;
|
|
332
|
-
};
|
|
333
|
-
/** The swap address to fund. Nothing exists on chain until the deposit
|
|
334
|
-
* lands here: `createOffer` is pure derivation and broadcasts nothing.
|
|
335
|
-
* Identical offers derive an identical address, so the funding txid — not
|
|
336
|
-
* the address — is what identifies one deposit. */
|
|
337
|
-
address: string;
|
|
338
|
-
/** The covenant's scriptPubKey: the key an indexer watches to spot the
|
|
339
|
-
* deposit and its later spend (`AssetSwap.swapPkScript`). */
|
|
340
|
-
swapPkScript: Uint8Array;
|
|
341
|
-
}>;
|
|
342
|
-
/**
|
|
343
|
-
* Cancel an offer: spend the swap VTXO back to the user. Returns the ark txid.
|
|
344
|
-
*
|
|
345
|
-
* This is the cooperative refund path — how a user takes back a deposit no
|
|
346
|
-
* solver filled. **No path here is on a deadline**, so an unfilled deposit
|
|
347
|
-
* keeps its place at the swap address rather than expiring: nothing to miss and
|
|
348
|
-
* no "expired" state to unwind, at the cost of the refund being something the
|
|
349
|
-
* user asks for rather than something a clock delivers.
|
|
350
|
-
*
|
|
351
|
-
* The routes out of the covenant are deliberately asymmetric:
|
|
352
|
-
* - `fulfill` is signed by the **server alone**, but the covenant constrains
|
|
353
|
-
* it to pay output 0 to `makerWP` for at least `wantAmount` — a solver
|
|
354
|
-
* cannot take the deposit without delivering.
|
|
355
|
-
* - `cancel` is a **2-of-2 of the user and the server**, so cancelling is
|
|
356
|
-
* cooperative: the server co-signs. No solver signature is involved, so the
|
|
357
|
-
* refund never depends on the counterparty being reachable.
|
|
358
|
-
* - `exit` is the user **alone** after a relative timelock, present unless the
|
|
359
|
-
* offer was created with `noExit`. It is the route that survives a server
|
|
360
|
-
* that will not co-sign this one, and it is reached by unrolling the VTXO
|
|
361
|
-
* onchain rather than through this function.
|
|
362
|
-
*
|
|
363
|
-
* Cancel therefore races a fill rather than pre-empting it. An offer the solver
|
|
364
|
-
* is filling in the same moment may be spent by `fulfill` first, in which case
|
|
365
|
-
* this throws "no spendable VTXO at the swap address" — which means the swap
|
|
366
|
-
* completed, not that anything failed. `restoreAssetSwaps` classifies the two
|
|
367
|
-
* spends apart afterwards by the leaf each took (see `classifySpend`).
|
|
368
|
-
*
|
|
369
|
-
* Marking the deposit as escrow (see {@link registerOfferContract}) does not
|
|
370
|
-
* close this path: the gate's subject is *implicit* coin selection, and cancel
|
|
371
|
-
* names its input outpoint explicitly. The user keeps the only spend route
|
|
372
|
-
* that was ever theirs to take.
|
|
373
|
-
*
|
|
374
|
-
* Identical offers derive the same address, so `fundingTxid` selects the exact
|
|
375
|
-
* deposit; without it the address must hold exactly one spendable VTXO — with
|
|
376
|
-
* several, cancel refuses to guess and throws.
|
|
377
|
-
* `swapAddress` (the funded address) pins the operator key the covenant was
|
|
378
|
-
* built with, so cancel keeps working across an operator signer rotation; without
|
|
379
|
-
* it a rotated key is detected and reported rather than reading as a missing
|
|
380
|
-
* VTXO.
|
|
381
|
-
*
|
|
382
|
-
* **When the matching swap record is present, this records its own outcome,
|
|
383
|
-
* and that is what makes the live watcher cheap.** `cancel` is a 2-of-2 of
|
|
384
|
-
* user and server, so a cancel can only be the user's own act: on a
|
|
385
|
-
* successful submit this *is* the authoritative answer, and writing it here
|
|
386
|
-
* means `watchOfferSwaps` has nothing left to decide for our own cancels — it
|
|
387
|
-
* sees a terminal record and leaves it alone. The status moves to `cancelling`
|
|
388
|
-
* first so a crash between submit and record leaves a marker rather than a
|
|
389
|
-
* swap that still looks pending.
|
|
390
|
-
*
|
|
391
|
-
* Passing a repository that does not contain the swap record is allowed: the
|
|
392
|
-
* cancel still submits and returns its txid, but no local status is written,
|
|
393
|
-
* so the watcher or restore scan must classify the spend later.
|
|
394
|
-
*
|
|
395
|
-
* When a local record exists, the txid is only knowable after `send()`
|
|
396
|
-
* returns, so a spend event that arrives in that window finds a `cancelling`
|
|
397
|
-
* record and classifies the spend by its covenant leaf instead — the same
|
|
398
|
-
* answer, one indexer read more.
|
|
399
|
-
*
|
|
400
|
-
* Takes no server URL, like every other entrypoint here: broadcast comes from
|
|
401
|
-
* `wallet.getArkadeBroadcaster()` and the indexer fallback from
|
|
402
|
-
* `wallet.getArkadeReader()`, so the wallet's own connection is the only one
|
|
403
|
-
* used (#734).
|
|
404
|
-
*
|
|
405
|
-
* @deprecated Use `client.cancel()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
406
|
-
*/
|
|
407
|
-
declare function cancelOffer(wallet: IWallet, offerHex: string, opts: {
|
|
408
|
-
repository: AssetSwapRepository;
|
|
409
|
-
fundingTxid?: string;
|
|
410
|
-
swapAddress?: string;
|
|
411
|
-
}): Promise<string>;
|
|
412
|
-
/**
|
|
413
|
-
* No deposit left to cancel at the swap address.
|
|
414
|
-
*
|
|
415
|
-
* Almost always the fill winning the race — v1's documented
|
|
416
|
-
* throw-means-completed trap, which the v2 client's `cancel()` reconciles
|
|
417
|
-
* against the covenant's leaves instead of surfacing (see `client/cancel.ts`).
|
|
418
|
-
* Typed so that reconciliation is an `instanceof`, not a message match; the
|
|
419
|
-
* message is v1's, unchanged.
|
|
420
|
-
*
|
|
421
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
422
|
-
*/
|
|
423
|
-
declare class NoSpendableDepositError extends Error {
|
|
424
|
-
readonly name = "NoSpendableDepositError";
|
|
425
|
-
constructor(options?: ErrorOptions);
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* The rebuilt covenant disagrees with the offer's own `swapPkScript`: the
|
|
429
|
-
* operator key the rebuild pinned is not the one the covenant was funded with.
|
|
430
|
-
*
|
|
431
|
-
* v1's fallback read this as a missing VTXO; with a pinned `swapAddress` the
|
|
432
|
-
* only remaining causes are a record corrupted or a `swapAddress` that is not
|
|
433
|
-
* the one funded — so the condition is typed rather than left to surface raw.
|
|
434
|
-
* Fires before any broadcast, where §7's law still governs.
|
|
435
|
-
*
|
|
436
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
437
|
-
*/
|
|
438
|
-
declare class OfferCovenantMismatchError extends Error {
|
|
439
|
-
readonly swapPkScript: string;
|
|
440
|
-
readonly name = "OfferCovenantMismatchError";
|
|
441
|
-
constructor(swapPkScript: string, options?: ErrorOptions);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* The subset of a wallet transaction record the swap scan reads.
|
|
446
|
-
*
|
|
447
|
-
* No `assets`: a spend is classified from the covenant leaf it took, read off
|
|
448
|
-
* the spending transaction itself (see {@link classifySpend}). A wallet
|
|
449
|
-
* record's asset field is a net delta — an asset offer's cancel moves the asset
|
|
450
|
-
* out and back, netting to nothing — so it cannot answer the question.
|
|
451
|
-
*
|
|
452
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
135
|
+
* The subset of a wallet transaction record the swap scan reads. No `assets`: see
|
|
136
|
+
* {@link classifySpend} for why a net asset delta cannot classify a spend.
|
|
453
137
|
*/
|
|
454
138
|
interface Tx {
|
|
455
139
|
type: string;
|
|
@@ -460,121 +144,66 @@ interface Tx {
|
|
|
460
144
|
/** Unix seconds. */
|
|
461
145
|
createdAt?: number;
|
|
462
146
|
}
|
|
463
|
-
/** The indexer surface the restore scan needs — narrower than a full provider.
|
|
464
|
-
*
|
|
465
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
466
|
-
*/
|
|
147
|
+
/** The indexer surface the restore scan needs — narrower than a full provider. */
|
|
467
148
|
type RestoreIndexer = Pick<RestIndexerProvider, "getVirtualTxs" | "getVtxos">;
|
|
468
149
|
/**
|
|
469
|
-
* What became of a deposit, as the spending transaction reports it.
|
|
470
|
-
*
|
|
471
|
-
* `indeterminate` is not a third outcome — it is the absence of one, and the
|
|
472
|
-
* caller decides whether to retry or accept a default.
|
|
473
|
-
*
|
|
474
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
150
|
+
* What became of a deposit, as the spending transaction reports it. `indeterminate` is
|
|
151
|
+
* the absence of an answer; the caller decides whether to retry.
|
|
475
152
|
*/
|
|
476
153
|
type SpendKind = "cancelled" | "fulfilled" | "indeterminate";
|
|
477
154
|
/**
|
|
478
|
-
* Classify a spend by the covenant leaf it took
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
* user. A submitted ark tx keeps each input's `tapLeafScript`, so the spend
|
|
483
|
-
* *states* which one it used — this reads an answer rather than inferring one.
|
|
484
|
-
*
|
|
485
|
-
* **`exit` reports `cancelled`, like `cancel` does.** The two differ in who had
|
|
486
|
-
* to agree — `cancel` is cooperative with the signer, `exit` is the maker alone
|
|
487
|
-
* after a delay — but not in outcome: the deposit went back unfilled either
|
|
488
|
-
* way, which is the question this answers. Reporting the exit leaf as
|
|
489
|
-
* `indeterminate` instead would be worse than imprecise: no status is written,
|
|
490
|
-
* so the swap stays `pending`, `restoreAssetSwaps` re-queues it on every scan,
|
|
491
|
-
* and `retireOfferContract` never runs — leaving a dead script in the
|
|
492
|
-
* subscription and the failsafe poll for the life of the wallet.
|
|
493
|
-
*
|
|
494
|
-
* **Hand it the transaction that actually spends the deposit outpoint, which is
|
|
495
|
-
* the checkpoint, not the ark tx.** A spend is two linked transactions: the
|
|
496
|
-
* checkpoint (`vtxo.spentBy`) takes the deposit outpoint and carries the
|
|
497
|
-
* covenant leaf, and the ark tx (`vtxo.arkTxId`) spends the checkpoint's output
|
|
498
|
-
* — carrying the same leaf, but over an outpoint that is not the deposit's. A
|
|
499
|
-
* caller that offers only the ark tx gets `indeterminate` for every real spend,
|
|
500
|
-
* which is exactly what the first version of this function did.
|
|
501
|
-
* {@link classifyDepositSpend} takes both and picks whichever answers.
|
|
155
|
+
* Classify a spend by the covenant leaf it took (a submitted ark tx keeps each input's
|
|
156
|
+
* `tapLeafScript`). `fulfill` is the solver paying; every other leaf returns the deposit.
|
|
157
|
+
* Not by asset movement: once registered, the deposit is the wallet's own coin, so an
|
|
158
|
+
* asset offer's cancel nets to zero exactly like its fill. Leaves also survive batching.
|
|
502
159
|
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
* covenant is a registered contract the deposit joins the wallet's own coins,
|
|
506
|
-
* every wallet-level asset figure becomes a *net* delta, and an asset offer's
|
|
507
|
-
* cancel — asset out of the covenant, same asset back to the user — nets to
|
|
508
|
-
* zero and reads exactly like its fill. Leaves do not have that failure mode,
|
|
509
|
-
* and they also survive batching: a solver filling several offers in one tx
|
|
510
|
-
* gives each input its own leaf.
|
|
160
|
+
* **`exit` reports `cancelled`, like `cancel`.** Reporting it `indeterminate` would leave
|
|
161
|
+
* the swap `pending` forever: re-queued every scan, and never retired.
|
|
511
162
|
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* `
|
|
515
|
-
* `cancelOffer` diagnoses the same mismatch the same way.
|
|
163
|
+
* **Pass the checkpoint (`vtxo.spentBy`), not the ark tx.** Only the checkpoint spends the
|
|
164
|
+
* deposit outpoint; the ark tx spends the checkpoint's output, so it always yields
|
|
165
|
+
* `indeterminate`. {@link classifyDepositSpend} tries both.
|
|
516
166
|
*
|
|
517
|
-
* @
|
|
167
|
+
* @param operatorPubkey - The key the covenant was *funded* against. A rotated key fails
|
|
168
|
+
* the script match and yields `indeterminate` rather than a guess.
|
|
518
169
|
*/
|
|
519
170
|
declare function classifySpend(offer: Offer, operatorPubkey: Uint8Array, spendTx: Transaction, deposit: {
|
|
520
171
|
txid: string;
|
|
521
172
|
vout: number;
|
|
522
173
|
}): SpendKind;
|
|
523
|
-
/**
|
|
524
|
-
* The txids that may hold a deposit's spend, in the order worth trying: the
|
|
525
|
-
* checkpoint first, since it is the one carrying the deposit outpoint.
|
|
526
|
-
*
|
|
527
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
528
|
-
*/
|
|
174
|
+
/** The txids that may hold a deposit's spend, checkpoint first (it carries the outpoint). */
|
|
529
175
|
declare const spendTxidsOf: (vtxo: {
|
|
530
176
|
spentBy?: string;
|
|
531
177
|
arkTxId?: string;
|
|
532
178
|
}) => string[];
|
|
533
179
|
/**
|
|
534
|
-
* Classify a deposit's spend across both halves of it
|
|
535
|
-
*
|
|
536
|
-
* A caller holds two txids for one spend — `spentBy` (the checkpoint, which
|
|
537
|
-
* takes the deposit outpoint) and `arkTxId` (the ark tx built on it) — and
|
|
538
|
-
* cannot tell from the outside which shape a given deployment produced: for a
|
|
539
|
-
* settlement they may be the same id. Try each and take the first definite
|
|
540
|
-
* answer, so the classification does not depend on that distinction.
|
|
541
|
-
*
|
|
542
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
180
|
+
* Classify a deposit's spend across both halves of it (`spentBy` and `arkTxId`, which
|
|
181
|
+
* may be the same id for a settlement), taking the first definite answer.
|
|
543
182
|
*/
|
|
544
183
|
declare function classifyDepositSpend(offer: Offer, operatorPubkey: Uint8Array, spendTxs: Iterable<Transaction>, deposit: {
|
|
545
184
|
txid: string;
|
|
546
185
|
vout: number;
|
|
547
186
|
}): SpendKind;
|
|
548
187
|
/**
|
|
549
|
-
* Scan the given candidates for offer packets and rebuild the AssetSwap
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
* persists those so they are never fetched again.
|
|
553
|
-
*
|
|
554
|
-
* ## A spent deposit is classified or left alone — never guessed
|
|
188
|
+
* Scan the given candidates for offer packets and rebuild the AssetSwap records the store
|
|
189
|
+
* lost. Returns the rebuilt swaps plus the txids that got an authoritative answer, which
|
|
190
|
+
* the caller persists so they are never fetched again.
|
|
555
191
|
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
* cannot be classified — not fetchable yet, or gone by neither leaf — leaves
|
|
560
|
-
* the funding txid unanswered, so nothing is persisted and a later scan decides
|
|
561
|
-
* it. Nothing sticky is written on a guess.
|
|
192
|
+
* A spent deposit is classified from its spending tx's covenant leaf
|
|
193
|
+
* ({@link classifySpend}), fetched from the indexer. An unclassifiable spend leaves the
|
|
194
|
+
* funding txid unanswered for a later scan: nothing sticky is written on a guess.
|
|
562
195
|
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
* spending tx came from the caller's possibly-lagging history. It no longer
|
|
566
|
-
* does, so the `existingIds` escape hatch is no longer a correction mechanism
|
|
567
|
-
* for a wrong label — it is only a skip list.
|
|
568
|
-
*
|
|
569
|
-
* `operatorPubkey` must be the operator key the covenants were funded against; a
|
|
570
|
-
* key that has rotated since makes every affected swap unclassifiable rather
|
|
571
|
-
* than misclassified.
|
|
572
|
-
*
|
|
573
|
-
* @deprecated The drive restores; `await client.ready`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
196
|
+
* @param opts.operatorPubkey - The key the covenants were funded against. A rotated key
|
|
197
|
+
* leaves affected swaps unresolved rather than misclassified.
|
|
574
198
|
*/
|
|
575
199
|
declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingIds: ReadonlySet<string>, opts: {
|
|
576
200
|
operatorPubkey: Uint8Array;
|
|
577
201
|
scanned?: ReadonlySet<string>;
|
|
202
|
+
reopen?: AssetSwap[];
|
|
203
|
+
/** Address prefix; given, a rebuilt record names the covenant's address (#680). */
|
|
204
|
+
hrp?: string;
|
|
205
|
+
/** Commitment txids of recovery rounds this wallet ran (`recoverVtxos()`'s return). */
|
|
206
|
+
recoveredIn?: ReadonlySet<string>;
|
|
578
207
|
}): Promise<{
|
|
579
208
|
restored: AssetSwap[];
|
|
580
209
|
scannedTxids: string[];
|
|
@@ -582,14 +211,8 @@ declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingI
|
|
|
582
211
|
|
|
583
212
|
/**
|
|
584
213
|
* One swap, flattened to what grouping needs: an identity, a corridor, an
|
|
585
|
-
* outcome, and every Arkade transaction that belongs to it.
|
|
586
|
-
*
|
|
587
|
-
* Deliberately not a stored swap record itself — resolution should stay
|
|
588
|
-
* testable with plain data rather than a repository. {@link rfqSwapActivityInputs}
|
|
589
|
-
* derives these from the record store and, where a record cannot answer, the
|
|
590
|
-
* funding lockup's VTXOs.
|
|
591
|
-
*
|
|
592
|
-
* @deprecated Read swap history with `client.swaps()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
214
|
+
* outcome, and every Arkade transaction that belongs to it. Plain data, not a stored record, so
|
|
215
|
+
* resolution is testable without a repository.
|
|
593
216
|
*/
|
|
594
217
|
interface SwapActivityInput {
|
|
595
218
|
rfqId: string;
|
|
@@ -601,33 +224,24 @@ interface SwapActivityInput {
|
|
|
601
224
|
/**
|
|
602
225
|
* Group each RFQ swap's transactions into one activity carrying its outcome.
|
|
603
226
|
*
|
|
604
|
-
* Without this a failed swap renders as two unrelated rows
|
|
605
|
-
*
|
|
606
|
-
* `
|
|
607
|
-
* by netting, not by `buildActivities`'s same-key change exclusion — that
|
|
608
|
-
* rule only fires when one txid is both sent and received, and funding and
|
|
609
|
-
* refund are different txids. Summing the signed amounts
|
|
610
|
-
* (`-funding + refund ≈ -fees`) is what does the work here.
|
|
227
|
+
* Without this a failed swap renders as two unrelated rows (funding send, covenant refund). The
|
|
228
|
+
* amount comes out right by netting signed amounts (`-funding + refund ≈ -fees`), not by
|
|
229
|
+
* `buildActivities`'s same-txid change exclusion, since funding and refund are different txids.
|
|
611
230
|
*
|
|
612
231
|
* `prepare` loads once and `resolve` stays pure and synchronous, as the SDK's
|
|
613
232
|
* `ActivityResolver` contract requires.
|
|
614
|
-
*
|
|
615
|
-
* @deprecated Read swap history with `client.swaps()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
616
233
|
*/
|
|
617
234
|
declare function swapActivityResolver(deps: {
|
|
618
235
|
listSwaps(): Promise<readonly SwapActivityInput[]>;
|
|
619
236
|
}): ActivityResolver;
|
|
620
237
|
/** @deprecated Read swap history with `client.swaps()`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
621
238
|
interface RfqSwapActivityDeps {
|
|
622
|
-
repository: Pick<AssetSwapRepository, "
|
|
239
|
+
repository: Pick<AssetSwapRepository, "getRfqSwapsPage">;
|
|
623
240
|
/**
|
|
624
241
|
* Consulted only for what a record cannot answer: a record written before
|
|
625
242
|
* `fundingTxid` existed, and the counterparty's spend on a swap that
|
|
626
|
-
* ended without a refund of ours.
|
|
627
|
-
*
|
|
628
|
-
* Optional because the stored fields are the primary source — cheaper, and
|
|
629
|
-
* they work offline, which is the resolver's whole posture. An indexer that
|
|
630
|
-
* throws costs that record its extra txids and nothing else.
|
|
243
|
+
* ended without a refund of ours. Optional because stored fields are the primary, offline
|
|
244
|
+
* source; an indexer that throws costs that record its extra txids and nothing else.
|
|
631
245
|
*/
|
|
632
246
|
indexer?: LockupSpendIndexer;
|
|
633
247
|
}
|
|
@@ -635,78 +249,78 @@ interface RfqSwapActivityDeps {
|
|
|
635
249
|
* Every stored RFQ swap, flattened into what {@link swapActivityResolver}
|
|
636
250
|
* groups on.
|
|
637
251
|
*
|
|
638
|
-
*
|
|
639
|
-
* `
|
|
640
|
-
*
|
|
641
|
-
* first two cannot answer — one read of the lockup's VTXOs.
|
|
642
|
-
*
|
|
643
|
-
* A missing txid costs an activity a row, never a wrong one: a swap that
|
|
644
|
-
* contributes fewer txids simply leaves those transactions ungrouped, which is
|
|
645
|
-
* what they already are.
|
|
646
|
-
*
|
|
647
|
-
* @deprecated Read swap history with `client.swaps()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
252
|
+
* Txids come from the record's `fundingTxid`/`refundTxid`, the corridor's `activityTxids`, the
|
|
253
|
+
* manager's `lockupSpendTxids`, and only then one lockup VTXO read. A missing txid leaves that
|
|
254
|
+
* transaction ungrouped, never misgrouped.
|
|
648
255
|
*/
|
|
649
256
|
declare function rfqSwapActivityInputs(deps: RfqSwapActivityDeps): Promise<SwapActivityInput[]>;
|
|
650
257
|
|
|
651
258
|
/**
|
|
652
|
-
* The `refundArkade` callback, assembled.
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* callback doc and the README — because it is the one callback whose obvious
|
|
656
|
-
* implementation is wrong: `refundIfUnresolved` is the single-swap version of
|
|
657
|
-
* `RfqSwapManager` itself and brings its own status polling and MTP retry loop,
|
|
658
|
-
* which would nest inside the manager's. Composing the atomic push here makes
|
|
659
|
-
* that mistake something a consumer has to go out of their way to make.
|
|
259
|
+
* The `refundArkade` callback, assembled. Its obvious implementation, `refundIfUnresolved`, is
|
|
260
|
+
* wrong here: it brings its own status polling and MTP retry loop, which would nest inside the
|
|
261
|
+
* manager's.
|
|
660
262
|
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
* {@link RefundNotLocallyPossibleError} and {@link LockupNeedsRecoveryError}
|
|
664
|
-
* propagate untouched — the manager reads the first as permanent and surfaces
|
|
665
|
-
* the second as `needs_recovery`, and catching either here would turn a state
|
|
263
|
+
* An empty lockup returns `null`; {@link RefundNotLocallyPossibleError} and
|
|
264
|
+
* {@link LockupNeedsRecoveryError} propagate untouched, since catching either would turn a state
|
|
666
265
|
* the trader must act on into a retry that grinds the window away.
|
|
667
266
|
*/
|
|
668
267
|
|
|
669
|
-
/** @deprecated The drive refunds; `client.recover()` settles a swept lockup. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
670
268
|
interface ArkadeRefunderDeps {
|
|
671
269
|
operator: SwapOperator;
|
|
672
|
-
|
|
270
|
+
/**
|
|
271
|
+
* The wallet's contract manager (prefer `await wallet.getContractManager()`). The lockup must
|
|
272
|
+
* be registered in it before the funding is visible.
|
|
273
|
+
*/
|
|
274
|
+
contracts: LockupContractSource;
|
|
673
275
|
/** Asked for the descriptor's signer; never asked to mint a key. */
|
|
674
276
|
wallet: IWallet;
|
|
675
277
|
/**
|
|
676
|
-
* The record store
|
|
677
|
-
*
|
|
678
|
-
* the refund key is resolved by key, which is what `getRfqSwap` is for.
|
|
278
|
+
* The record store: the live `RfqSwap` carries no `signingDescriptor` (it lives in the
|
|
279
|
+
* record's `profile.signer`), so the refund key is resolved through `getRfqSwap`.
|
|
679
280
|
*/
|
|
680
281
|
repository: Pick<AssetSwapRepository, "getRfqSwap">;
|
|
282
|
+
/** The caller's already-resolved network, pinning the checkpoint exit-delay floor. Lazy,
|
|
283
|
+
* like `SwapDriveConfig.network`. @see operatorUnrollScript */
|
|
284
|
+
network?: () => Promise<Network>;
|
|
681
285
|
}
|
|
682
286
|
/**
|
|
683
287
|
* Build the `refundArkade` callback for `RfqSwapManager.setCallbacks`.
|
|
684
288
|
*
|
|
685
289
|
* @example
|
|
686
290
|
* manager.setCallbacks({
|
|
687
|
-
* refundArkade: arkadeRefunder({ operator,
|
|
291
|
+
* refundArkade: arkadeRefunder({ operator, contracts, wallet, repository }),
|
|
688
292
|
* saveSwap,
|
|
689
293
|
* });
|
|
690
|
-
*
|
|
691
|
-
* @deprecated The drive refunds; `client.recover()` settles a swept lockup. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
692
294
|
*/
|
|
693
295
|
declare function arkadeRefunder(deps: ArkadeRefunderDeps): (swap: RfqSwap) => Promise<ArkadeRefundResult>;
|
|
694
296
|
|
|
695
297
|
/** `network` is `requestOnchainSend`'s `l1Network`, and only decodes scripts to
|
|
696
298
|
* addresses — the provider decides which chain is read, so mismatching the two
|
|
697
299
|
* yields addresses it knows nothing about rather than an error.
|
|
698
|
-
*
|
|
699
|
-
* @deprecated Internal to the onchain corridor; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
700
300
|
*/
|
|
701
301
|
declare const chainSourceFrom: (provider: OnchainProvider, network: OnchainNetwork) => ChainSource;
|
|
702
302
|
|
|
303
|
+
/**
|
|
304
|
+
* The receive corridors' completion: the trader claims the solver-funded
|
|
305
|
+
* lockup with its own preimage.
|
|
306
|
+
*
|
|
307
|
+
* On `lightning:BTC->arkade:BTC` and `onchain:BTC->arkade:BTC` the trader is the covenant's
|
|
308
|
+
* `receiver` and generated `P`, so the collaborative claim leaf (preimage + receiver + server) is
|
|
309
|
+
* spendable the moment the lockup lands, with no covclaimd. Mirror of `pushRefundWithoutReceiver`,
|
|
310
|
+
* except:
|
|
311
|
+
*
|
|
312
|
+
* - The preimage rides the PSBT's `ConditionWitness`, attached AFTER signing on the ark tx and
|
|
313
|
+
* every checkpoint; attaching it first yields `INVALID_SIGNATURE` (`claimWithPreimageIdentity`
|
|
314
|
+
* owns that ordering).
|
|
315
|
+
* - The leaf is NOT covenant-pinned, so one aggregate output pays wherever the trader says; the
|
|
316
|
+
* destination is required, defaulting honestly to the swap's payout address.
|
|
317
|
+
*/
|
|
318
|
+
|
|
703
319
|
/**
|
|
704
320
|
* The lockup is funded for less than the swap agreed.
|
|
705
321
|
*
|
|
706
|
-
* The attack
|
|
707
|
-
*
|
|
708
|
-
* proves nothing here, because the script was never the lie. Claiming anyway
|
|
709
|
-
* publishes `P`, which is what lets the solver settle the payer's Lightning
|
|
322
|
+
* The attack: the solver funds the correctly derived script with dust, so local script derivation
|
|
323
|
+
* proves nothing. Claiming anyway publishes `P`, letting the solver settle the payer's Lightning
|
|
710
324
|
* HTLC in full.
|
|
711
325
|
*
|
|
712
326
|
* @deprecated The claim path is internal to the drive; watch it with `client.onUpdate()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
@@ -719,87 +333,51 @@ declare class LockupAmountMismatchError extends Error {
|
|
|
719
333
|
constructor(expectedAmount: number, lockedAmount: number);
|
|
720
334
|
}
|
|
721
335
|
/**
|
|
722
|
-
* Build, sign, and push the collaborative claim of a receive-corridor lockup
|
|
723
|
-
*
|
|
724
|
-
* revealing `P` in the witness — which is also what settles the trader's side
|
|
725
|
-
* of the swap (the solver reads `P` off the public claim).
|
|
726
|
-
*
|
|
727
|
-
* The preimage is checked against the script's committed hash BEFORE anything
|
|
728
|
-
* is signed: a wrong value can never open the leaf, and catching it here
|
|
729
|
-
* beats learning it from the server's rejection.
|
|
730
|
-
*
|
|
731
|
-
* So is the funded VALUE, against `expectedAmount` — and for the same reason,
|
|
732
|
-
* only more sharply: disclosure happens at SUBMIT, since `P` rides the PSBT to
|
|
733
|
-
* the Ark server. A check that waits for the transaction to land has already
|
|
734
|
-
* leaked the secret.
|
|
336
|
+
* Build, sign, and push the collaborative claim of a receive-corridor lockup, moving every funded
|
|
337
|
+
* output to the trader's destination and revealing `P` (the solver reads it off the claim).
|
|
735
338
|
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* outputs.
|
|
741
|
-
*
|
|
742
|
-
* The server's countersignature is verified before finalizing, per input and
|
|
743
|
-
* against that input's own leaf. It does not protect `P` — that reached the
|
|
744
|
-
* server at submit — but it turns "reported claimed, nothing landed, the
|
|
745
|
-
* solver refunds hours later" into an immediate failure.
|
|
746
|
-
*
|
|
747
|
-
* @deprecated The claim path is internal to the drive; watch `client.onUpdate()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
339
|
+
* Preimage and funded VALUE are checked BEFORE signing: `P` reaches the operator at SUBMIT, so a
|
|
340
|
+
* later check has already leaked it. Swept outputs are refused first (one non-live input would sink
|
|
341
|
+
* the aggregate tx). The server countersignature is verified per input, so "reported claimed,
|
|
342
|
+
* nothing landed" fails immediately.
|
|
748
343
|
*/
|
|
749
344
|
declare function pushClaim(operator: SwapOperator, input: {
|
|
750
345
|
/** The receive-direction covenant (see `lightningReceiveContract`). */
|
|
751
346
|
contract: InstanceType<typeof VHTLC.ScriptV2>;
|
|
752
|
-
/** The trader's `receiver` signer
|
|
753
|
-
* with `contractSigner` — on an HD wallet that resolves
|
|
754
|
-
* from the seed, with no stored key bytes anywhere. */
|
|
347
|
+
/** The trader's `receiver` signer, built from the swap's `secrets` with `contractSigner`. */
|
|
755
348
|
receiver: Identity;
|
|
756
349
|
/** `P`, 32 bytes — the trader generated it at request time. */
|
|
757
350
|
preimage: Uint8Array;
|
|
758
351
|
vtxos: readonly LockupVtxo[];
|
|
759
352
|
/** Where the claimed sats land — the swap's payout address, decoded. */
|
|
760
353
|
destinationPkScript: Uint8Array;
|
|
761
|
-
/** What the lockup must carry: the quote's `to_amount`, captured at
|
|
762
|
-
*
|
|
763
|
-
* optional, so the guard cannot be skipped by the records that need
|
|
764
|
-
* it most. */
|
|
354
|
+
/** What the lockup must carry: the quote's `to_amount`, captured at REQUEST time and
|
|
355
|
+
* persisted. Required so the guard cannot be skipped. */
|
|
765
356
|
expectedAmount: number;
|
|
766
357
|
/** Set when this lockup already carries a claim of ours: `P` is public
|
|
767
358
|
* by then, so the value gate protects nothing and would only strand
|
|
768
359
|
* the remainder. */
|
|
769
360
|
partiallyClaimed?: boolean;
|
|
361
|
+
/** @see operatorUnrollScript */
|
|
362
|
+
network?: Network;
|
|
770
363
|
}): Promise<{
|
|
771
364
|
txid: string;
|
|
772
365
|
amount: number;
|
|
773
366
|
}>;
|
|
774
|
-
/**
|
|
775
|
-
*
|
|
776
|
-
|
|
777
|
-
* Same conventions as `awaitRfqResolution`: a `pollMs` interval, an optional
|
|
778
|
-
* unix-seconds `deadline`, and a thrown error carrying a stable `reason` when
|
|
779
|
-
* the deadline passes.
|
|
780
|
-
*
|
|
781
|
-
* @deprecated The claim path is internal to the drive; watch `client.onUpdate()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
782
|
-
*/
|
|
783
|
-
declare function awaitLockupFunding(indexer: RefundIndexer, swapPkScript: Uint8Array, options?: {
|
|
367
|
+
/** Wait for the solver-funded lockup to appear at the covenant script; past the unix-seconds
|
|
368
|
+
* `deadline`, throws with reason `lockup_timeout`. */
|
|
369
|
+
declare function awaitLockupFunding(contracts: LockupContractSource, swapPkScript: Uint8Array, options?: {
|
|
784
370
|
pollMs?: number;
|
|
785
371
|
deadline?: number;
|
|
786
372
|
}): Promise<readonly LockupVtxo[]>;
|
|
787
373
|
/**
|
|
788
|
-
* The one-call composition: wait for the solver's funding, then push the
|
|
789
|
-
*
|
|
790
|
-
* funded, the claim itself is gated by nothing but the solver's own refund
|
|
791
|
-
* deadline (`refund_locktime` from the quote), which is the number the
|
|
792
|
-
* caller's deadline should be measured against.
|
|
374
|
+
* The one-call composition: wait for the solver's funding, then push the claim. The deadline gates
|
|
375
|
+
* the WAIT only; once funded, the claim is bounded by the quote's `refund_locktime`.
|
|
793
376
|
*
|
|
794
|
-
* The wait returns on the first output seen, so
|
|
795
|
-
*
|
|
796
|
-
* {@link LockupAmountMismatchError}. Nothing was signed, so retrying once the
|
|
797
|
-
* rest lands is safe — and that is also the answer to a genuinely underfunded
|
|
798
|
-
* lockup, which never gets past the gate at all.
|
|
799
|
-
*
|
|
800
|
-
* @deprecated The claim path is internal to the drive; watch it with `client.onUpdate()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
377
|
+
* The wait returns on the first output seen, so piecemeal funding can throw
|
|
378
|
+
* {@link LockupAmountMismatchError}. Nothing was signed, so retrying once the rest lands is safe.
|
|
801
379
|
*/
|
|
802
|
-
declare function claimReceiveLockup(
|
|
380
|
+
declare function claimReceiveLockup(contracts: LockupContractSource, operator: SwapOperator, input: Parameters<typeof pushClaim>[1] & {
|
|
803
381
|
/** The covenant's scriptPubKey, from the request flow's `swapPkScript`. */
|
|
804
382
|
swapPkScript: Uint8Array;
|
|
805
383
|
pollMs?: number;
|
|
@@ -809,182 +387,35 @@ declare function claimReceiveLockup(indexer: RefundIndexer, operator: SwapOperat
|
|
|
809
387
|
amount: number;
|
|
810
388
|
}>;
|
|
811
389
|
|
|
812
|
-
/** @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
813
|
-
interface SealedClaimPacket {
|
|
814
|
-
/** `ephPub(33) ‖ nonce(12) ‖ ciphertext`, base64 — wire-ready. This is
|
|
815
|
-
* the whole packet: the RFQ request's `claim_packet` field carries
|
|
816
|
-
* exactly this string. */
|
|
817
|
-
ciphertext: string;
|
|
818
|
-
}
|
|
819
|
-
/** @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
820
|
-
interface ClaimPacketInput {
|
|
821
|
-
preimage: Uint8Array;
|
|
822
|
-
/** covclaimd's public key, 33-byte compressed (from its /v1 info). */
|
|
823
|
-
covclaimdPubkey: Uint8Array;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Seal a preimage to covclaimd.
|
|
827
|
-
*
|
|
828
|
-
* The ephemeral key and nonce are generated here and CANNOT be supplied by a
|
|
829
|
-
* caller. That is the point of this signature: AES-GCM under a repeated
|
|
830
|
-
* (key, nonce) pair is a total break — forgery and plaintext recovery, not a
|
|
831
|
-
* degradation — so an optional `nonce` on a production export is a loaded gun
|
|
832
|
-
* whatever the doc comment says. Deterministic sealing lives in the test
|
|
833
|
-
* helper, where no consumer reaches it by accident.
|
|
834
|
-
*
|
|
835
|
-
* @deprecated Internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
836
|
-
*/
|
|
837
|
-
declare function sealClaimPacket(input: ClaimPacketInput): Promise<SealedClaimPacket>;
|
|
838
|
-
|
|
839
|
-
/** The contract type a swap lockup registers under. `@arkade-os/sdk`'s handler
|
|
840
|
-
* for `VHTLC.ScriptV2` — the covenant script this corridor builds.
|
|
841
|
-
*
|
|
842
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
843
|
-
*/
|
|
844
|
-
declare const SWAP_LOCKUP_CONTRACT_TYPE = "vhtlc-v2";
|
|
845
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
846
|
-
declare const SWAP_LOCKUP_CONTRACT_LABEL = "Arkade RFQ swap lockup";
|
|
847
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
848
|
-
declare const SWAP_LOCKUP_CONTRACT_KIND = "rfq-swap-lockup";
|
|
849
|
-
/** The write seam registration needs, narrowed to the one method — the same
|
|
850
|
-
* injection style as `SwapContractRegistry`, and satisfied by a real
|
|
851
|
-
* `ContractManager` (`await wallet.getContractManager()`).
|
|
852
|
-
*
|
|
853
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
854
|
-
*/
|
|
855
|
-
type LockupContractWriter = Pick<IContractManager, "createContract">;
|
|
856
|
-
/** The read seam {@link lockupContractParams} needs. Same narrowing, same
|
|
857
|
-
* `ContractManager` satisfies it.
|
|
858
|
-
*
|
|
859
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
860
|
-
*/
|
|
861
|
-
type LockupContractReader = Pick<IContractManager, "getContracts">;
|
|
862
|
-
/**
|
|
863
|
-
* No row for a lockup a record claims was funded.
|
|
864
|
-
*
|
|
865
|
-
* Separate from a rebuild failure on purpose: the record is fine and its money
|
|
866
|
-
* may well be at the address — what is missing is the wallet's copy of the
|
|
867
|
-
* covenant, which registration writes before the address can be funded. So this
|
|
868
|
-
* means the contract store was cleared or was never the one that registered
|
|
869
|
-
* this swap, and the remedy is a store, not a re-quote.
|
|
870
|
-
*
|
|
871
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
872
|
-
*/
|
|
873
|
-
declare class LockupContractMissing extends Error {
|
|
874
|
-
/** The lockup whose row is absent. */
|
|
875
|
-
readonly address: string;
|
|
876
|
-
/** Its pkScript hex — the key the row would have been under. */
|
|
877
|
-
readonly script: string;
|
|
878
|
-
constructor(address: string, script: string);
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* The lockup could not be written locally.
|
|
882
|
-
*
|
|
883
|
-
* Deliberately NOT a {@link SwapRefusal} or an {@link AddressMismatch}: those
|
|
884
|
-
* say "the quote is bad, never fund it", while this says "the quote is fine and
|
|
885
|
-
* your own store failed".
|
|
886
|
-
*
|
|
887
|
-
* The throw is the safe point: nothing is funded, and on the receive legs the
|
|
888
|
-
* invoice never left the function, so the abandoned quote is inert and simply
|
|
889
|
-
* retrying the request is the recovery. `script` travels beside `address` so a
|
|
890
|
-
* caller that still holds the swap — `RfqSwapManager`'s `ensureRegistered`, or
|
|
891
|
-
* one resuming from its own record — can retry `registerLockupContract` alone
|
|
892
|
-
* instead of re-quoting. It is NOT enough to resume a request that threw here:
|
|
893
|
-
* that caller never received the invoice or `secrets`.
|
|
894
|
-
*
|
|
895
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
896
|
-
*/
|
|
897
|
-
declare class LockupRegistrationFailed extends Error {
|
|
898
|
-
/** The lockup address that was never registered — never fund it: nothing
|
|
899
|
-
* is watching it. */
|
|
900
|
-
readonly address: string;
|
|
901
|
-
/** The covenant the row would have been written from — the other half of
|
|
902
|
-
* `registerLockupContract`, so the write is retryable without a quote. */
|
|
903
|
-
readonly script: InstanceType<typeof VHTLC.ScriptV2>;
|
|
904
|
-
constructor(script: InstanceType<typeof VHTLC.ScriptV2>, address: string, cause: unknown);
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Register a lockup covenant so its VTXOs are watched, annotatable and — via
|
|
908
|
-
* `vhtlc-v2`'s own handler, which is never generically spendable — kept out of
|
|
909
|
-
* ordinary coin selection.
|
|
910
|
-
*
|
|
911
|
-
* The row carries script-level facts only. Per-swap identity and key material
|
|
912
|
-
* stay in the swap record: rows are keyed by script and first-writer-wins, so
|
|
913
|
-
* anything per-swap written here is stale from the second swap onward.
|
|
914
|
-
*
|
|
915
|
-
* Takes the derived script rather than a script hex plus params, so the row
|
|
916
|
-
* cannot describe a script other than the one it is keyed by.
|
|
917
|
-
*
|
|
918
|
-
* Throws {@link LockupRegistrationFailed}, so a caller can tell a local
|
|
919
|
-
* storage problem from a reason to walk away from the quote.
|
|
920
|
-
*
|
|
921
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
922
|
-
*/
|
|
923
|
-
declare function registerLockupContract(contracts: LockupContractWriter, script: InstanceType<typeof VHTLC.ScriptV2>, address: string): Promise<void>;
|
|
924
|
-
/**
|
|
925
|
-
* The stored covenant parameters of a funded lockup — the other half of
|
|
926
|
-
* `rebuildRfqSwap`.
|
|
927
|
-
*
|
|
928
|
-
* The row is the wallet's own copy of the tree, written from the covenant
|
|
929
|
-
* before the address could be funded and keyed by the script it derives, which
|
|
930
|
-
* `createContract` refuses to write unless the params reproduce it. That is why
|
|
931
|
-
* an RFQ swap record stores no tree parameters of its own.
|
|
932
|
-
*
|
|
933
|
-
* Looked up by script rather than address: the script is the row's key, and
|
|
934
|
-
* decoding it here means a record whose address does not decode fails as a bad
|
|
935
|
-
* address instead of as a missing row.
|
|
936
|
-
*
|
|
937
|
-
* Throws {@link LockupContractMissing} when there is no row.
|
|
938
|
-
*
|
|
939
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
940
|
-
*/
|
|
941
|
-
declare function lockupContractParams(contracts: LockupContractReader, lockupAddress: string): Promise<Record<string, string>>;
|
|
942
|
-
|
|
943
390
|
/**
|
|
944
391
|
* Quoting: solver discovery and the pricing guardrails around a plan.
|
|
945
392
|
*
|
|
946
|
-
* The
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* client-side, from the market card the solver publishes (its price feed and
|
|
950
|
-
* its fee) rather than over a relay roundtrip. The card commits a solver to a
|
|
951
|
-
* price; only a fill commits it to this swap, so nothing here is signed and no
|
|
952
|
-
* inventory is reserved.
|
|
953
|
-
*
|
|
954
|
-
* Relay-negotiated quotes are where every corridor converges, this one
|
|
955
|
-
* included. What stays specific to intra-Arkade is the settlement covenant,
|
|
956
|
-
* not the negotiation. See the README's Roles section for why this package
|
|
957
|
-
* says user and solver rather than maker and taker.
|
|
393
|
+
* The quote resolves client-side from the solver's published market card (price feed
|
|
394
|
+
* and fee), not over a relay round trip. The card commits a solver to a price; only a
|
|
395
|
+
* fill commits it to this swap, so nothing here is signed and no inventory is reserved.
|
|
958
396
|
*/
|
|
959
397
|
|
|
960
398
|
/** Shared quote options so every quote path agrees.
|
|
961
399
|
* No safety margin on top of the market fee: pricing drift between quote
|
|
962
400
|
* and fill is the solver's risk to manage, not the user's to prepay.
|
|
963
|
-
*
|
|
964
|
-
* @deprecated Internal to the pricing path behind `client.quote()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
965
401
|
*/
|
|
966
402
|
declare const QUOTE_OPTIONS: {
|
|
967
403
|
readonly safetyBps: 0;
|
|
968
404
|
};
|
|
969
|
-
/** Feed fetcher with a short per-URL TTL cache
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
* as "Quote unavailable" mid-typing — one feed value per TTL window is fresh
|
|
973
|
-
* enough for a preview whose rate is re-checked at fill anyway.
|
|
405
|
+
/** Feed fetcher with a short per-URL TTL cache: a quote UI refetches the feed on every
|
|
406
|
+
* debounced keystroke, and public feeds (CoinGecko) rate-limit that burst. The rate is
|
|
407
|
+
* re-checked at fill anyway.
|
|
974
408
|
* ponytail: no stale-serve when the fetch itself fails; add one if feeds
|
|
975
409
|
* flake beyond the TTL window (cap the staleness — the feed value becomes
|
|
976
410
|
* the covenant floor, so an old price must never price a real offer).
|
|
977
|
-
*
|
|
978
|
-
*
|
|
979
|
-
* a no-op — the flat-feedCalls swap test guards against that regressing.
|
|
980
|
-
*
|
|
981
|
-
* @deprecated Internal to the pricing path behind `client.quote()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
411
|
+
* Assumes a market's feed URL is stable and amount-invariant; a cache-busting nonce
|
|
412
|
+
* would silently make this a no-op (guarded by the flat-feedCalls swap test).
|
|
982
413
|
*/
|
|
983
414
|
declare const makeCachedFeedFetch: (ttlMs?: number, fetchImpl?: typeof fetch) => typeof fetch;
|
|
984
|
-
/** @deprecated Use `client.markets()`; pricing is internal to `client.quote()`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
985
415
|
interface DiscoverMarketsOptions {
|
|
986
|
-
network: Network;
|
|
987
|
-
/**
|
|
416
|
+
network: Network$1;
|
|
417
|
+
/** Overrides the network's default registry. `undefined` follows
|
|
418
|
+
* `@arkade-os/solver-discovery`'s per-network default (never hardcoded here). */
|
|
988
419
|
registryUrl: string | undefined;
|
|
989
420
|
/** Backs the 1-hour markets cache and its stale fallback. Omit for a
|
|
990
421
|
* one-shot discovery that always hits the registry. */
|
|
@@ -998,35 +429,25 @@ interface DiscoverMarketsOptions {
|
|
|
998
429
|
* own fetchImpl with an AbortSignal; add one if a hung registry ever
|
|
999
430
|
* strands discovery in practice. */
|
|
1000
431
|
fetchImpl?: typeof fetch;
|
|
1001
|
-
/** `false` forces a refetch past a fresh cache
|
|
1002
|
-
*
|
|
1003
|
-
* still serves the last known markets rather than none. */
|
|
432
|
+
/** `false` forces a refetch past a fresh cache. The stale-cache fallback for an
|
|
433
|
+
* unreachable registry still applies. */
|
|
1004
434
|
useCache?: boolean;
|
|
1005
435
|
}
|
|
1006
436
|
/**
|
|
1007
|
-
* Markets from
|
|
1008
|
-
*
|
|
1009
|
-
* stale cache backstops an unreachable registry (quotes stay live either way).
|
|
1010
|
-
*
|
|
1011
|
-
* @deprecated Use `client.markets()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
437
|
+
* Markets from this network's solver registry, cached for an hour, with a stale cache
|
|
438
|
+
* backstopping an unreachable registry. Only an unrecognised network yields [].
|
|
1012
439
|
*/
|
|
1013
440
|
declare const discoverMarkets: (options: DiscoverMarketsOptions) => Promise<DiscoveredMarket[]>;
|
|
1014
441
|
/** Best market for a from/to pair, in either orientation. `give` is the side
|
|
1015
442
|
* the sender deposits; `wantSide` skips markets whose receive side is
|
|
1016
443
|
* disabled (max = "0").
|
|
1017
|
-
*
|
|
1018
|
-
* @deprecated Use `client.markets()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1019
444
|
*/
|
|
1020
445
|
declare const findMarket: (markets: DiscoveredMarket[], fromId: string, toId: string) => {
|
|
1021
446
|
market: DiscoveredMarket | null;
|
|
1022
447
|
give: Side;
|
|
1023
448
|
} | undefined;
|
|
1024
|
-
/** @deprecated Use `client.markets()`; pricing is internal to `client.quote()`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1025
449
|
type PlanError = "insufficient-balance" | "side-disabled" | "below-min" | "above-max" | "below-dust";
|
|
1026
|
-
/** Validate a plan against the user's balance and the server dust limit
|
|
1027
|
-
*
|
|
1028
|
-
* @deprecated Internal to the pricing path behind `client.quote()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1029
|
-
*/
|
|
450
|
+
/** Validate a plan against the user's balance and the server dust limit.*/
|
|
1030
451
|
declare const validatePlan: (plan: OfferPlan, giveBalance: bigint, dust: bigint) => PlanError | undefined;
|
|
1031
452
|
|
|
1032
453
|
/**
|
|
@@ -1046,10 +467,8 @@ declare const CROSS_ASSET_RAIL = "cross-asset";
|
|
|
1046
467
|
* chain state, never by resending. Persisting only afterwards would leave a
|
|
1047
468
|
* crash between send and persist looking exactly like `filled`.
|
|
1048
469
|
*
|
|
1049
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1050
470
|
*/
|
|
1051
471
|
type CrossAssetPhase = "quoted" | "filled" | "paying" | "settled";
|
|
1052
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1053
472
|
interface CrossAssetSwap {
|
|
1054
473
|
phase: CrossAssetPhase;
|
|
1055
474
|
offerHex: string;
|
|
@@ -1062,7 +481,6 @@ interface CrossAssetSwap {
|
|
|
1062
481
|
/** The payout, once `settled` — the receipt a `paying` record looks for. */
|
|
1063
482
|
txid?: string;
|
|
1064
483
|
}
|
|
1065
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1066
484
|
interface CrossAssetRailDeps {
|
|
1067
485
|
/** Called by `available()` and again by `quote()`; pass the caching
|
|
1068
486
|
* `discoverMarkets`, not a bare registry fetch. */
|
|
@@ -1086,7 +504,6 @@ interface CrossAssetRailDeps {
|
|
|
1086
504
|
/** Rank after `ark-asset`, which pays from a balance already held. Both match,
|
|
1087
505
|
* so `options()` can offer "pay from your USDX" beside "buy USDX and pay".
|
|
1088
506
|
*
|
|
1089
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1090
507
|
*/
|
|
1091
508
|
declare function crossAssetRail(deps: CrossAssetRailDeps): PaymentRail;
|
|
1092
509
|
|
|
@@ -1100,7 +517,6 @@ declare function crossAssetRail(deps: CrossAssetRailDeps): PaymentRail;
|
|
|
1100
517
|
* No `emulatorPubkey`: the card's key only FILTERS here — the covenant is
|
|
1101
518
|
* built from `deps.emulatorPubkey` or the pinned default, never from it.
|
|
1102
519
|
*
|
|
1103
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1104
520
|
*/
|
|
1105
521
|
interface SolverRendezvous {
|
|
1106
522
|
solverPubkey: string;
|
|
@@ -1117,7 +533,6 @@ interface SolverRendezvous {
|
|
|
1117
533
|
* is refused anyway. A card that serves the corridor but not the size is
|
|
1118
534
|
* skipped, not fatal — another may take it.
|
|
1119
535
|
*
|
|
1120
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1121
536
|
*/
|
|
1122
537
|
declare const solverRendezvous: (markets: DiscoveredMarket[], payoutCorridor: "onchain" | "lightning", amountSats: number, fallbackEmulatorPubkey?: Uint8Array) => SolverRendezvous | undefined;
|
|
1123
538
|
|
|
@@ -1131,14 +546,12 @@ declare const solverRendezvous: (markets: DiscoveredMarket[], payoutCorridor: "o
|
|
|
1131
546
|
|
|
1132
547
|
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1133
548
|
declare const SOLVER_LIGHTNING_RAIL = "solver-lightning";
|
|
1134
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1135
549
|
type SolverLightningSend = Awaited<ReturnType<typeof requestLightningSend>> & {
|
|
1136
550
|
invoice: InvoiceFacts;
|
|
1137
551
|
rendezvous: SolverRendezvous;
|
|
1138
552
|
};
|
|
1139
553
|
/** Mirrors {@link SolverOnchainRailDeps}; see there for the shared seams.
|
|
1140
554
|
*
|
|
1141
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1142
555
|
*/
|
|
1143
556
|
interface SolverLightningRailDeps {
|
|
1144
557
|
/** A decoder that throws drops the rail rather than taking the router
|
|
@@ -1154,9 +567,7 @@ interface SolverLightningRailDeps {
|
|
|
1154
567
|
emulatorPubkey?: string;
|
|
1155
568
|
fallbackEmulatorPubkey?: Uint8Array;
|
|
1156
569
|
}
|
|
1157
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1158
570
|
declare const solverLightningRendezvous: (markets: DiscoveredMarket[], amountSats: number, fallbackEmulatorPubkey?: Uint8Array) => SolverRendezvous | undefined;
|
|
1159
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1160
571
|
declare function solverLightningRail(deps: SolverLightningRailDeps): PaymentRail;
|
|
1161
572
|
|
|
1162
573
|
/**
|
|
@@ -1172,7 +583,6 @@ declare const SOLVER_ONCHAIN_RAIL = "solver-onchain";
|
|
|
1172
583
|
/** What a record needs. Pass the whole object to `onchainSendProfile()`: only
|
|
1173
584
|
* this carries `payoutPkScript`.
|
|
1174
585
|
*
|
|
1175
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1176
586
|
*/
|
|
1177
587
|
type SolverOnchainSend = Awaited<ReturnType<typeof requestOnchainSend>> & {
|
|
1178
588
|
rendezvous: SolverRendezvous;
|
|
@@ -1181,7 +591,6 @@ type SolverOnchainSend = Awaited<ReturnType<typeof requestOnchainSend>> & {
|
|
|
1181
591
|
* these bytes raw returns an object with no `.length`. */
|
|
1182
592
|
payoutPkScript: Uint8Array;
|
|
1183
593
|
};
|
|
1184
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1185
594
|
interface SolverOnchainRailDeps {
|
|
1186
595
|
l1Network: OnchainNetwork;
|
|
1187
596
|
/** x-only L1 key that AUTHORISES the claim — not where it pays. */
|
|
@@ -1201,22 +610,16 @@ interface SolverOnchainRailDeps {
|
|
|
1201
610
|
emulatorPubkey?: string;
|
|
1202
611
|
fallbackEmulatorPubkey?: Uint8Array;
|
|
1203
612
|
}
|
|
1204
|
-
/** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
1205
613
|
declare const solverOnchainRendezvous: (markets: DiscoveredMarket[], amountSats: number, fallbackEmulatorPubkey?: Uint8Array) => SolverRendezvous | undefined;
|
|
1206
614
|
/** Register alongside the core `onchain` rail, ranked first:
|
|
1207
615
|
* `priority: ["ark", "solver-onchain", "onchain"]`. Both stay registered.
|
|
1208
616
|
*
|
|
1209
|
-
* @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1210
617
|
*/
|
|
1211
618
|
declare function solverOnchainRail(deps: SolverOnchainRailDeps): PaymentRail;
|
|
1212
619
|
|
|
1213
620
|
/**
|
|
1214
|
-
* Why a wallet cannot produce a swap's spending key.
|
|
1215
|
-
*
|
|
1216
|
-
* A swap-lifecycle concern, not a key-provisioning one — which is why it
|
|
1217
|
-
* lives here and not in the SDK: `RfqSwapManager` reads it to decide a refund
|
|
1218
|
-
* is impossible rather than merely failing, and stops grinding against a push
|
|
1219
|
-
* that can never work for the whole refund window.
|
|
621
|
+
* Why a wallet cannot produce a swap's spending key. `RfqSwapManager` reads this to treat a
|
|
622
|
+
* refund as impossible rather than retryable, and stops pushing for the rest of the window.
|
|
1220
623
|
*/
|
|
1221
624
|
|
|
1222
625
|
/** @deprecated Recovery is internal to the drive; use `client.recover()`. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
@@ -1226,17 +629,13 @@ type RefundBlockedReason =
|
|
|
1226
629
|
/** The descriptor belongs to another wallet's key. */
|
|
1227
630
|
| "foreign-descriptor"
|
|
1228
631
|
/**
|
|
1229
|
-
* This wallet holds the key but cannot sign with it
|
|
1230
|
-
*
|
|
1231
|
-
* this can stop being true without changing wallets, so it is worth
|
|
1232
|
-
* telling apart: "attach your signer", not "restore the other wallet".
|
|
632
|
+
* This wallet holds the key but cannot sign with it (watch-only, or remote signer not
|
|
633
|
+
* attached). Unlike the others it can clear without changing wallets: "attach your signer".
|
|
1233
634
|
*/
|
|
1234
635
|
| "unsignable-wallet";
|
|
1235
636
|
/**
|
|
1236
637
|
* The wallet cannot produce this swap's spending key, so no local refund is
|
|
1237
638
|
* possible: not a failure to retry, a capability this wallet does not have.
|
|
1238
|
-
*
|
|
1239
|
-
* @deprecated Recovery is internal to the drive; use `client.recover()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
1240
639
|
*/
|
|
1241
640
|
declare class RefundNotLocallyPossibleError extends Error {
|
|
1242
641
|
readonly reason: RefundBlockedReason;
|
|
@@ -1248,15 +647,11 @@ declare class RefundNotLocallyPossibleError extends Error {
|
|
|
1248
647
|
/**
|
|
1249
648
|
* The signer for a swap record's `signingDescriptor`, or a typed refusal.
|
|
1250
649
|
*
|
|
1251
|
-
* **Wire `refundArkade` here, not to `contractSigner` directly
|
|
1252
|
-
*
|
|
1253
|
-
* permanent refusal rather than a `TypeError` at the push site — which the
|
|
1254
|
-
* manager would treat as retryable.
|
|
1255
|
-
*
|
|
1256
|
-
* @deprecated Recovery is internal to the drive; use `client.recover()`. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
650
|
+
* **Wire `refundArkade` here, not to `contractSigner` directly**: a record without a descriptor
|
|
651
|
+
* must be a permanent refusal, not a `TypeError` the manager would retry.
|
|
1257
652
|
*/
|
|
1258
653
|
declare function senderIdentityForSwapRecord(wallet: IWallet, record: {
|
|
1259
654
|
signingDescriptor?: string;
|
|
1260
655
|
}): Promise<Identity>;
|
|
1261
656
|
|
|
1262
|
-
export { ArkadeRefundResult, type ArkadeRefunderDeps,
|
|
657
|
+
export { ArkadeRefundResult, type ArkadeRefunderDeps, CROSS_ASSET_RAIL, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractSource, LockupVtxo, Offer, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, type RefundBlockedReason, RefundNotLocallyPossibleError, type RestoreIndexer, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqTransport, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, arkadeRefunder, awaitLockupFunding, chainSourceFrom, claimReceiveLockup, classifyDepositSpend, classifySpend, crossAssetRail, discoverMarkets, findMarket, makeCachedFeedFetch, onchainSendProfile, pushClaim, requestLightningSend, requestOnchainSend, restoreAssetSwaps, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, swapActivityResolver, validatePlan };
|