@satora/swap 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -630,6 +630,10 @@ declare class Client {
|
|
|
630
630
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
631
631
|
getQuote(...args: Parameters<Client$1["getQuote"]>): ReturnType<Client$1["getQuote"]>;
|
|
632
632
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
633
|
+
createLightningToEvmSwap(...args: Parameters<Client$1["createLightningToEvmSwap"]>): ReturnType<Client$1["createLightningToEvmSwap"]>;
|
|
634
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
635
|
+
getLightningSendQuote(...args: Parameters<Client$1["getLightningSendQuote"]>): ReturnType<Client$1["getLightningSendQuote"]>;
|
|
636
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
633
637
|
getSwap(...args: Parameters<Client$1["getSwap"]>): ReturnType<Client$1["getSwap"]>;
|
|
634
638
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
635
639
|
getBulkStatus(...args: Parameters<Client$1["getBulkStatus"]>): ReturnType<Client$1["getBulkStatus"]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -630,6 +630,10 @@ declare class Client {
|
|
|
630
630
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
631
631
|
getQuote(...args: Parameters<Client$1["getQuote"]>): ReturnType<Client$1["getQuote"]>;
|
|
632
632
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
633
|
+
createLightningToEvmSwap(...args: Parameters<Client$1["createLightningToEvmSwap"]>): ReturnType<Client$1["createLightningToEvmSwap"]>;
|
|
634
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
635
|
+
getLightningSendQuote(...args: Parameters<Client$1["getLightningSendQuote"]>): ReturnType<Client$1["getLightningSendQuote"]>;
|
|
636
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
633
637
|
getSwap(...args: Parameters<Client$1["getSwap"]>): ReturnType<Client$1["getSwap"]>;
|
|
634
638
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
635
639
|
getBulkStatus(...args: Parameters<Client$1["getBulkStatus"]>): ReturnType<Client$1["getBulkStatus"]>;
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,16 @@ function deriveSwapActions(input) {
|
|
|
64
64
|
return { recommended: "wait", actions: [wait] };
|
|
65
65
|
}
|
|
66
66
|
case "clientfunded": {
|
|
67
|
+
if (!clientFunds) {
|
|
68
|
+
const wait2 = {
|
|
69
|
+
id: "wait",
|
|
70
|
+
waitingOn: "server_funding",
|
|
71
|
+
recommended: true,
|
|
72
|
+
automation: "auto",
|
|
73
|
+
reason: "Waiting for the server to fund the swap."
|
|
74
|
+
};
|
|
75
|
+
return { recommended: "wait", actions: [wait2] };
|
|
76
|
+
}
|
|
67
77
|
const refundUnlocked = clientChainNow >= clientRefundLocktime;
|
|
68
78
|
if (refundUnlocked) {
|
|
69
79
|
const refund2 = {
|
|
@@ -201,6 +211,16 @@ function deriveSwapActions(input) {
|
|
|
201
211
|
case "serverwontfund":
|
|
202
212
|
case "clientfundedtoolate":
|
|
203
213
|
case "clientinvalidfunded": {
|
|
214
|
+
if (!clientFunds) {
|
|
215
|
+
const done = {
|
|
216
|
+
id: "none",
|
|
217
|
+
outcome: "refunded",
|
|
218
|
+
recommended: true,
|
|
219
|
+
automation: "auto",
|
|
220
|
+
reason: "The swap did not complete \u2014 your Lightning payment will be refunded automatically."
|
|
221
|
+
};
|
|
222
|
+
return { recommended: "none", actions: [done] };
|
|
223
|
+
}
|
|
204
224
|
const refundUnlocked = clientChainNow >= clientRefundLocktime;
|
|
205
225
|
if (refundUnlocked) {
|
|
206
226
|
const refund2 = {
|
|
@@ -1901,6 +1921,27 @@ function swapToTracked(stored) {
|
|
|
1901
1921
|
// Pay-on-Lightning: the client pays a Lightning invoice (off-chain, nothing to
|
|
1902
1922
|
// watch) and claims an on-chain HTLC. No client-funded leg — the client's
|
|
1903
1923
|
// claim completes the swap; a hold invoice that never settles auto-unwinds.
|
|
1924
|
+
// Client pays the invoice, then claims the server's EVM HTLC.
|
|
1925
|
+
case "lightning_to_evm":
|
|
1926
|
+
return {
|
|
1927
|
+
swapId: r.id,
|
|
1928
|
+
serverHtlc: evmLeg({
|
|
1929
|
+
chainId: r.evm_chain_id,
|
|
1930
|
+
htlc: r.evm_htlc_address,
|
|
1931
|
+
hashLock: r.hash_lock,
|
|
1932
|
+
claimAddress: r.client_evm_address,
|
|
1933
|
+
// the client claims the server's EVM HTLC
|
|
1934
|
+
expectedSats: r.evm_expected_sats,
|
|
1935
|
+
token: r.wbtc_address,
|
|
1936
|
+
sender: r.server_evm_address,
|
|
1937
|
+
// the server funded it
|
|
1938
|
+
timelockSec: r.evm_refund_locktime,
|
|
1939
|
+
createdAt: r.created_at
|
|
1940
|
+
}),
|
|
1941
|
+
clientRefundLocktime: 0,
|
|
1942
|
+
// no on-chain client leg
|
|
1943
|
+
serverRefundLocktime: ms(r.evm_refund_locktime)
|
|
1944
|
+
};
|
|
1904
1945
|
// Client pays the invoice, then claims the Arkade VHTLC (target_amount).
|
|
1905
1946
|
case "lightning_to_arkade":
|
|
1906
1947
|
return {
|
|
@@ -2357,6 +2398,14 @@ var Client = class {
|
|
|
2357
2398
|
return this.#legacy.getQuote(...args);
|
|
2358
2399
|
}
|
|
2359
2400
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
2401
|
+
createLightningToEvmSwap(...args) {
|
|
2402
|
+
return this.#legacy.createLightningToEvmSwap(...args);
|
|
2403
|
+
}
|
|
2404
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
2405
|
+
getLightningSendQuote(...args) {
|
|
2406
|
+
return this.#legacy.getLightningSendQuote(...args);
|
|
2407
|
+
}
|
|
2408
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
2360
2409
|
getSwap(...args) {
|
|
2361
2410
|
return this.#legacy.getSwap(...args);
|
|
2362
2411
|
}
|