@satora/escrow-client 14.0.1 → 15.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -166,7 +166,11 @@ ignored.
166
166
  // Optional: quote the recipient amount for a full-payout withdrawal
167
167
  // (payout minus the swap fee) so you don't have to do fee math.
168
168
  // `availableSats` is the spendable payout in your wallet.
169
- const {recipientSats} = await escrowClient.quoteLightningWithdrawal(availableSats);
169
+ // Passing the destination prices the real Lightning send fee for it.
170
+ const {recipientSats} = await escrowClient.quoteLightningWithdrawal(
171
+ availableSats,
172
+ "user@lnurl.example.com",
173
+ );
170
174
 
171
175
  const {swapId, fundingTxid, sourceAmountSats} =
172
176
  await escrowClient.withdrawToLightning({
@@ -179,6 +183,30 @@ const {swapId, fundingTxid, sourceAmountSats} =
179
183
  `sourceAmountSats` is what was spent from the payout (recipient amount + swap fee);
180
184
  the swap server then pays the recipient.
181
185
 
186
+ #### BOLT11 with a fixed lock
187
+
188
+ To spend an exact amount from the payout to a BOLT11 invoice, quote with the
189
+ source amount, have the recipient invoice the quoted `recipientSats`, then lock
190
+ exactly that source amount with `sourceAmountSats`:
191
+
192
+ ```ts
193
+ const sourceSats = availableSats;
194
+ const {recipientSats} = await escrowClient.quoteLightningWithdrawal(sourceSats);
195
+ const invoice = await requestInvoice(recipientSats); // recipient's BOLT11 invoice
196
+
197
+ await escrowClient.withdrawToLightning({
198
+ wallet,
199
+ destination: invoice,
200
+ sourceAmountSats: sourceSats, // exact lock (BOLT11 only)
201
+ });
202
+ ```
203
+
204
+ `sourceAmountSats` must cover the invoice amount + protocol fee + Lightning send
205
+ fee; any surplus is charged as network fee (capped), otherwise swap creation
206
+ fails. It is rejected for LNURL / Lightning addresses, which take the recipient
207
+ amount via `amountSats`. Without it, a BOLT11 swap locks invoice + fees as
208
+ quoted by the server.
209
+
182
210
  ### To L1 (onchain)
183
211
 
184
212
  A collaborative Arkade offboard (settlement round) to an onchain address:
@@ -230,14 +258,14 @@ escrowClient.dispose(); // stop watching, clear listeners
230
258
 
231
259
  ## API summary
232
260
 
233
- | Method | Purpose |
234
- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
235
- | `EscrowClient.create(config)` | Construct with `{ swap, arkProvider, indexerProvider, contractRepository, walletRepository }`. |
236
- | `fundFromLightning({ escrow, network, amountSats })` | Create a LN→escrow swap; returns `{ swapId, invoice, escrowAddress, awaitFunded() }`. |
237
- | `withdraw({ wallet, destination, amountSats? })` | Smart withdrawal — auto-routes to Lightning / L1 / Arkade by destination. Returns `{ method, txid, … }`. |
238
- | `quoteLightningWithdrawal(sourceAmountSats)` | `{ recipientSats, sourceSats }` — recipient amount after the swap fee. |
239
- | `withdrawToLightning({ wallet, destination, amountSats? })` | Withdraw the payout to a BOLT11 / LNURL / Lightning address. |
240
- | `withdrawToL1({ wallet, destinationAddress, amountSats? })` | Withdraw the payout onchain via collaborative offboard. |
241
- | `withdrawToArkade({ wallet, destinationAddress, amountSats })` | Withdraw the payout to another Arkade address (offchain Arkade transfer). |
242
- | `escrowMonitor` | The underlying `EscrowMonitor`. |
243
- | `dispose()` | Release monitor resources. |
261
+ | Method | Purpose |
262
+ | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
263
+ | `EscrowClient.create(config)` | Construct with `{ swap, arkProvider, indexerProvider, contractRepository, walletRepository }`. |
264
+ | `fundFromLightning({ escrow, network, amountSats })` | Create a LN→escrow swap; returns `{ swapId, invoice, escrowAddress, awaitFunded() }`. |
265
+ | `withdraw({ wallet, destination, amountSats? })` | Smart withdrawal — auto-routes to Lightning / L1 / Arkade by destination. Returns `{ method, txid, … }`. |
266
+ | `quoteLightningWithdrawal(sourceAmountSats, destination?)` | `{ recipientSats, sourceSats }` — recipient amount after the swap fee. |
267
+ | `withdrawToLightning({ wallet, destination, amountSats?, sourceAmountSats? })` | Withdraw the payout to a BOLT11 / LNURL / Lightning address; `sourceAmountSats` = fixed lock (BOLT11). |
268
+ | `withdrawToL1({ wallet, destinationAddress, amountSats? })` | Withdraw the payout onchain via collaborative offboard. |
269
+ | `withdrawToArkade({ wallet, destinationAddress, amountSats })` | Withdraw the payout to another Arkade address (offchain Arkade transfer). |
270
+ | `escrowMonitor` | The underlying `EscrowMonitor`. |
271
+ | `dispose()` | Release monitor resources. |
@@ -19,16 +19,32 @@ export type DestinationKind = "lightning" | "arkade" | "l1";
19
19
  */
20
20
  export declare function classifyDestination(destination: string): DestinationKind;
21
21
  /** Fields of the swap SDK's Arkade→Lightning options we route a destination to. */
22
- export interface LightningDestination {
23
- lightningInvoice?: string;
24
- lightningAddress?: string;
25
- lnurl?: string;
26
- amountSats?: number;
27
- }
22
+ export type LightningDestination = {
23
+ lightningInvoice: string;
24
+ /**
25
+ * Fixed lock: exact sats to lock from the payout. Must cover the invoice
26
+ * amount + protocol fee + Lightning send fee; any surplus is charged as
27
+ * network fee (capped by the backend).
28
+ */
29
+ sourceAmountSats?: number;
30
+ } | {
31
+ lightningAddress: string;
32
+ /** Sats the recipient receives (a BOLT11 invoice pins its own). */
33
+ targetAmountSats: number;
34
+ } | {
35
+ lnurl: string;
36
+ /** Sats the recipient receives (a BOLT11 invoice pins its own). */
37
+ targetAmountSats: number;
38
+ };
28
39
  /**
29
40
  * Map a Lightning destination string to the swap SDK's mutually-exclusive
30
41
  * `lightningInvoice` / `lightningAddress` / `lnurl` fields. Throws if it isn't a
31
42
  * Lightning destination, or if `amountSats` is missing for LNURL / address.
43
+ *
44
+ * `sourceAmountSats` (BOLT11 only) is a fixed lock: the exact sats to lock from
45
+ * the payout, passed through as the swap SDK's `sourceAmountSats`. It must be a
46
+ * positive integer, and is rejected for LNURL / address, whose amount is the
47
+ * recipient amount (`amountSats`).
32
48
  */
33
- export declare function toLightningDestination(destination: string, amountSats?: number): LightningDestination;
49
+ export declare function toLightningDestination(destination: string, amountSats?: number, sourceAmountSats?: number): LightningDestination;
34
50
  //# sourceMappingURL=destination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,OACF,CAAC;AACpC,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,OACC,CAAC;AACtC,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OACF,CAAC;AAEvC,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,0DAA0D;AAC1D,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAKxE;AAED,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,oBAAoB,CAsBtB"}
1
+ {"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,OACF,CAAC;AACpC,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,OACC,CAAC;AACtC,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OACF,CAAC;AAEvC,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,0DAA0D;AAC1D,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAKxE;AAED,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAC5B;IACE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GACD;IACE,gBAAgB,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GACD;IACE,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GACxB,oBAAoB,CAsCtB"}
@@ -33,12 +33,23 @@ export function classifyDestination(destination) {
33
33
  * Map a Lightning destination string to the swap SDK's mutually-exclusive
34
34
  * `lightningInvoice` / `lightningAddress` / `lnurl` fields. Throws if it isn't a
35
35
  * Lightning destination, or if `amountSats` is missing for LNURL / address.
36
+ *
37
+ * `sourceAmountSats` (BOLT11 only) is a fixed lock: the exact sats to lock from
38
+ * the payout, passed through as the swap SDK's `sourceAmountSats`. It must be a
39
+ * positive integer, and is rejected for LNURL / address, whose amount is the
40
+ * recipient amount (`amountSats`).
36
41
  */
37
- export function toLightningDestination(destination, amountSats) {
42
+ export function toLightningDestination(destination, amountSats, sourceAmountSats) {
38
43
  const input = destination.trim();
44
+ if (sourceAmountSats !== undefined &&
45
+ (!Number.isSafeInteger(sourceAmountSats) || sourceAmountSats <= 0)) {
46
+ throw new Error(`sourceAmountSats must be a positive integer, got ${sourceAmountSats}`);
47
+ }
39
48
  // The BOLT11 invoice carries its own amount, so amountSats is not needed.
40
49
  if (isBolt11(input)) {
41
- return { lightningInvoice: input };
50
+ return sourceAmountSats === undefined
51
+ ? { lightningInvoice: input }
52
+ : { lightningInvoice: input, sourceAmountSats };
42
53
  }
43
54
  const address = isLnAddress(input);
44
55
  const lnurl = isLnurl(input);
@@ -46,11 +57,15 @@ export function toLightningDestination(destination, amountSats) {
46
57
  throw new Error("unrecognized Lightning destination: expected a BOLT11 invoice, " +
47
58
  "LNURL (lnurl1...), or Lightning address (user@host)");
48
59
  }
60
+ if (sourceAmountSats !== undefined) {
61
+ throw new Error("sourceAmountSats is only supported with a BOLT11 invoice; pass " +
62
+ `amountSats (the recipient amount) for a Lightning ${address ? "address" : "LNURL"}`);
63
+ }
49
64
  if (amountSats === undefined) {
50
65
  throw new Error(`amountSats is required for a Lightning ${address ? "address" : "LNURL"} destination`);
51
66
  }
52
67
  return address
53
- ? { lightningAddress: input, amountSats }
54
- : { lnurl: input, amountSats };
68
+ ? { lightningAddress: input, targetAmountSats: amountSats }
69
+ : { lnurl: input, targetAmountSats: amountSats };
55
70
  }
56
71
  //# sourceMappingURL=destination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"destination.js","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAW,EAAE,CAC7C,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAW,EAAE,CAC5C,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAW,EAAE,CAChD,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvC,mFAAmF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gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE;QAC3D,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;AACrD,CAAC"}
@@ -11,15 +11,7 @@ import type { Client } from "@satora/swap";
11
11
  * has private fields, so the full class would be a nominal mismatch across
12
12
  * copies).
13
13
  */
14
- export type SwapClient = Pick<Client, "createLightningToArkadeSwap" | "claimArkade">;
15
- /**
16
- * Thrown by the Lightning-withdrawal methods while Arkade→Lightning swaps are
17
- * being rebuilt on the new Lightning provider. The API shape is kept so
18
- * consumers don't have to churn; the capability returns with the provider.
19
- */
20
- export declare class LightningWithdrawalUnavailableError extends Error {
21
- constructor();
22
- }
14
+ export type SwapClient = Pick<Client, "createLightningToArkadeSwap" | "claimArkade" | "createArkadeToLightningSwap" | "getQuote">;
23
15
  /**
24
16
  * Dependencies for {@link EscrowClient}.
25
17
  *
@@ -112,8 +104,28 @@ export declare class EscrowClient {
112
104
  * Use `recipientSats` as the `amountSats` for an LNURL / Lightning-address
113
105
  * {@link withdrawToLightning} — e.g. pre-fill the amount from the available
114
106
  * payout balance so the user doesn't have to compute fees by hand.
107
+ *
108
+ * For a BOLT11 invoice, use the fixed-lock flow instead: quote with the sats
109
+ * to spend, have the recipient issue an invoice for `recipientSats`, then
110
+ * lock exactly the quoted source amount:
111
+ *
112
+ * ```ts
113
+ * const { recipientSats } = await client.quoteLightningWithdrawal(sourceSats);
114
+ * // The recipient issues a BOLT11 invoice for exactly recipientSats.
115
+ * const invoice = await requestInvoice(recipientSats);
116
+ * await client.withdrawToLightning({
117
+ * wallet,
118
+ * destination: invoice,
119
+ * sourceAmountSats: sourceSats,
120
+ * });
121
+ * ```
122
+ *
123
+ * Pass the Lightning `destination` (address / LNURL / invoice) when known:
124
+ * the quote then uses the provider's real Lightning send fee for that payment
125
+ * instead of the flat network-fee estimate, so the quoted `recipientSats` is
126
+ * what {@link withdrawToLightning} will actually be able to fund.
115
127
  */
116
- quoteLightningWithdrawal(_sourceAmountSats: number): Promise<{
128
+ quoteLightningWithdrawal(sourceAmountSats: number, destination?: string): Promise<{
117
129
  /** Sats the recipient receives (pass as `amountSats` to withdrawToLightning). */
118
130
  recipientSats: number;
119
131
  /** Sats actually spent from the payout to fund the swap VHTLC. */
@@ -128,10 +140,21 @@ export declare class EscrowClient {
128
140
  * recipient receives) is **required** for LNURL / address and **ignored**
129
141
  * for a BOLT11 invoice (the amount is taken from the invoice).
130
142
  *
143
+ * `sourceAmountSats` (BOLT11 only) makes the swap a **fixed lock**: exactly
144
+ * that many sats are locked from the payout. It must cover the invoice amount
145
+ * plus the protocol fee and Lightning send fee; any surplus is charged as
146
+ * network fee (capped), otherwise swap creation fails. Typical flow:
147
+ * {@link quoteLightningWithdrawal}(`sourceSats`) → `recipientSats` → the
148
+ * recipient invoices `recipientSats` → `withdrawToLightning({ destination:
149
+ * invoice, sourceAmountSats: sourceSats })`. Without it, a BOLT11 swap locks
150
+ * invoice + fees as quoted by the server. Passing `sourceAmountSats` with an
151
+ * LNURL / address throws (use `amountSats` there).
152
+ *
131
153
  * Creates the swap and funds its VHTLC from the buyer wallet's payout; the
132
154
  * Lendaswap server then claims the VHTLC and pays the recipient. Returns the
133
155
  * swap id, the VHTLC funding txid, and the sats sent (recipient amount plus
134
- * the swap fee — must be <= the available payout).
156
+ * the swap fee — must be <= the available payout; equals `sourceAmountSats`
157
+ * for a fixed lock).
135
158
  */
136
159
  withdrawToLightning(params: {
137
160
  /** Buyer wallet holding the released payout VTXO(s). */
@@ -140,6 +163,12 @@ export declare class EscrowClient {
140
163
  destination: string;
141
164
  /** Recipient amount in sats. Required for LNURL / address; ignored for BOLT11. */
142
165
  amountSats?: number;
166
+ /**
167
+ * BOLT11 only: exact sats to lock from the payout (fixed lock). Must cover
168
+ * invoice + protocol fee + Lightning send fee; surplus is charged as
169
+ * network fee. Rejected for LNURL / address.
170
+ */
171
+ sourceAmountSats?: number;
143
172
  }): Promise<{
144
173
  swapId: string;
145
174
  fundingTxid: string;
@@ -1 +1 @@
1
- {"version":3,"file":"escrow-client.d.ts","sourceRoot":"","sources":["../src/escrow-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,MAAM,EACN,6BAA6B,GAAG,aAAa,CAC9C,CAAC;AAEF;;;;GAIG;AACH,qBAAa,mCAAoC,SAAQ,KAAK;;CAQ7D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,WAAW,EAAE,gBAAgB,CAAC;IAC9B,uDAAuD;IACvD,eAAe,EAAE,eAAe,CAAC;IACjC,kDAAkD;IAClD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,+DAA+D;IAC/D,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GACD;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,MAAM,WAAW,uBAAuB;IACtC,8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EAAE,MAAM,CAAC;QAC3B,8BAA8B;QAC9B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,MAAM,CAAC;IAOnB;;;;;;;;;;;;;OAaG;IACG,QAAQ,CAAC,MAAM,EAAE;QACrB,MAAM,EAAE,OAAO,CAAC;QAChB,6EAA6E;QAC7E,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,cAAc,CAAC;IA6C3B,wEAAwE;IACxE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzB"}
@@ -2,18 +2,6 @@ import { Ramps, } from "@arkade-os/sdk";
2
2
  import { EscrowMonitor, EscrowVtxoScript, } from "@satora/escrow";
3
3
  import { hex } from "@scure/base";
4
4
  import { classifyDestination, toLightningDestination } from "./destination.js";
5
- /**
6
- * Thrown by the Lightning-withdrawal methods while Arkade→Lightning swaps are
7
- * being rebuilt on the new Lightning provider. The API shape is kept so
8
- * consumers don't have to churn; the capability returns with the provider.
9
- */
10
- export class LightningWithdrawalUnavailableError extends Error {
11
- constructor() {
12
- super("Withdrawing to Lightning is temporarily unavailable: Arkade→Lightning " +
13
- "swaps are being rebuilt on the new Lightning provider.");
14
- this.name = "LightningWithdrawalUnavailableError";
15
- }
16
- }
17
5
  /**
18
6
  * High-level escrow flows that bundle the swap on/off-ramp with the escrow
19
7
  * monitor: fund an escrow from Lightning, and withdraw a released payout to
@@ -99,9 +87,41 @@ export class EscrowClient {
99
87
  * Use `recipientSats` as the `amountSats` for an LNURL / Lightning-address
100
88
  * {@link withdrawToLightning} — e.g. pre-fill the amount from the available
101
89
  * payout balance so the user doesn't have to compute fees by hand.
90
+ *
91
+ * For a BOLT11 invoice, use the fixed-lock flow instead: quote with the sats
92
+ * to spend, have the recipient issue an invoice for `recipientSats`, then
93
+ * lock exactly the quoted source amount:
94
+ *
95
+ * ```ts
96
+ * const { recipientSats } = await client.quoteLightningWithdrawal(sourceSats);
97
+ * // The recipient issues a BOLT11 invoice for exactly recipientSats.
98
+ * const invoice = await requestInvoice(recipientSats);
99
+ * await client.withdrawToLightning({
100
+ * wallet,
101
+ * destination: invoice,
102
+ * sourceAmountSats: sourceSats,
103
+ * });
104
+ * ```
105
+ *
106
+ * Pass the Lightning `destination` (address / LNURL / invoice) when known:
107
+ * the quote then uses the provider's real Lightning send fee for that payment
108
+ * instead of the flat network-fee estimate, so the quoted `recipientSats` is
109
+ * what {@link withdrawToLightning} will actually be able to fund.
102
110
  */
103
- async quoteLightningWithdrawal(_sourceAmountSats) {
104
- throw new LightningWithdrawalUnavailableError();
111
+ async quoteLightningWithdrawal(sourceAmountSats, destination) {
112
+ const quote = await this.swap.getQuote({
113
+ sourceChain: "Arkade",
114
+ sourceToken: "btc",
115
+ targetChain: "Lightning",
116
+ targetToken: "btc",
117
+ sourceAmount: sourceAmountSats,
118
+ lightningDestination: destination?.trim() || undefined,
119
+ });
120
+ // Amounts are serialized as strings over the wire.
121
+ return {
122
+ recipientSats: Number(quote.net_target_amount),
123
+ sourceSats: Number(quote.net_source_amount),
124
+ };
105
125
  }
106
126
  /**
107
127
  * Withdraw a released payout to Lightning via an Arkade→Lightning swap.
@@ -112,16 +132,31 @@ export class EscrowClient {
112
132
  * recipient receives) is **required** for LNURL / address and **ignored**
113
133
  * for a BOLT11 invoice (the amount is taken from the invoice).
114
134
  *
135
+ * `sourceAmountSats` (BOLT11 only) makes the swap a **fixed lock**: exactly
136
+ * that many sats are locked from the payout. It must cover the invoice amount
137
+ * plus the protocol fee and Lightning send fee; any surplus is charged as
138
+ * network fee (capped), otherwise swap creation fails. Typical flow:
139
+ * {@link quoteLightningWithdrawal}(`sourceSats`) → `recipientSats` → the
140
+ * recipient invoices `recipientSats` → `withdrawToLightning({ destination:
141
+ * invoice, sourceAmountSats: sourceSats })`. Without it, a BOLT11 swap locks
142
+ * invoice + fees as quoted by the server. Passing `sourceAmountSats` with an
143
+ * LNURL / address throws (use `amountSats` there).
144
+ *
115
145
  * Creates the swap and funds its VHTLC from the buyer wallet's payout; the
116
146
  * Lendaswap server then claims the VHTLC and pays the recipient. Returns the
117
147
  * swap id, the VHTLC funding txid, and the sats sent (recipient amount plus
118
- * the swap fee — must be <= the available payout).
148
+ * the swap fee — must be <= the available payout; equals `sourceAmountSats`
149
+ * for a fixed lock).
119
150
  */
120
151
  async withdrawToLightning(params) {
121
- // Validate the destination up front so callers still get shape errors
122
- // (bad LNURL, missing amount) rather than only the unavailability error.
123
- toLightningDestination(params.destination, params.amountSats);
124
- throw new LightningWithdrawalUnavailableError();
152
+ const { response } = await this.swap.createArkadeToLightningSwap(toLightningDestination(params.destination, params.amountSats, params.sourceAmountSats));
153
+ // source_amount is serialized as a string over the wire.
154
+ const sourceAmountSats = Number(response.source_amount);
155
+ const fundingTxid = await params.wallet.send({
156
+ address: response.arkade_vhtlc_address,
157
+ amount: sourceAmountSats,
158
+ });
159
+ return { swapId: response.id, fundingTxid, sourceAmountSats };
125
160
  }
126
161
  /**
127
162
  * Withdraw a released payout to L1 (a collaborative Arkade offboard).
@@ -1 +1 @@
1
- {"version":3,"file":"escrow-client.js","sourceRoot":"","sources":["../src/escrow-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAEN,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,aAAa,EAEb,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAiB/E;;;;GAIG;AACH,MAAM,OAAO,mCAAoC,SAAQ,KAAK;IAC5D;QACE,KAAK,CACH,wEAAwE;YACtE,wDAAwD,CAC3D,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;IACpD,CAAC;CACF;AA6DD;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IACA;IAHnB,YACmB,IAAg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1,6 +1,6 @@
1
1
  {
2
2
  "name": "@satora/escrow-client",
3
- "version": "14.0.1",
3
+ "version": "15.0.1",
4
4
  "description": "High-level escrow flows (funding/withdrawing) bundling @satora/escrow with an injected swap client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@arkade-os/sdk": "^0.5.1",
24
- "@satora/swap": "1.10.1"
24
+ "@satora/swap": "1.11.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@arkade-os/sdk": "^0.5.5",
28
28
  "@biomejs/biome": "2.3.15",
29
29
  "typescript": "^5.7.0",
30
30
  "vitest": "^3.0.0",
31
- "@satora/swap": "1.10.1"
31
+ "@satora/swap": "1.11.0"
32
32
  },
33
33
  "license": "MIT",
34
34
  "publishConfig": {