@satora/swap 1.10.2 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-K4BQUZC6.js → chunk-2AULREFC.js} +2 -2
- package/dist/chunk-2AULREFC.js.map +1 -0
- package/dist/{chunk-2LGHF7A3.cjs → chunk-4NVWIR74.cjs} +755 -439
- package/dist/chunk-4NVWIR74.cjs.map +1 -0
- package/dist/{chunk-HWK7LVVX.js → chunk-JHZHRY7S.js} +130 -51
- package/dist/chunk-JHZHRY7S.js.map +1 -0
- package/dist/{chunk-7GOXIT24.cjs → chunk-JZTF4JNH.cjs} +110 -31
- package/dist/chunk-JZTF4JNH.cjs.map +1 -0
- package/dist/{chunk-OJNQCRHU.cjs → chunk-Q4TOBBAN.cjs} +7 -7
- package/dist/{chunk-OJNQCRHU.cjs.map → chunk-Q4TOBBAN.cjs.map} +1 -1
- package/dist/{chunk-MYOGO44L.cjs → chunk-TNZW35XA.cjs} +2 -2
- package/dist/chunk-TNZW35XA.cjs.map +1 -0
- package/dist/{chunk-VBNBVJLB.js → chunk-TT3J2OOS.js} +8 -8
- package/dist/{chunk-VBNBVJLB.js.map → chunk-TT3J2OOS.js.map} +1 -1
- package/dist/{chunk-S4T4GK5G.js → chunk-WQMAL2VD.js} +391 -75
- package/dist/chunk-WQMAL2VD.js.map +1 -0
- package/dist/delegate.cjs +3 -3
- package/dist/delegate.js +2 -2
- package/dist/dist-MHRQ5FFV.cjs +394 -0
- package/dist/{dist-MMYSP6LP.cjs.map → dist-MHRQ5FFV.cjs.map} +1 -1
- package/dist/{dist-L5LHQNRK.js → dist-SHY7I6SH.js} +13 -13
- package/dist/{fundSwap-IUPFISXM-ON5IVSSZ.cjs → fundSwap-UBCHMUP4-BEMQNSFQ.cjs} +15 -15
- package/dist/{fundSwap-IUPFISXM-ON5IVSSZ.cjs.map → fundSwap-UBCHMUP4-BEMQNSFQ.cjs.map} +1 -1
- package/dist/{fundSwap-IUPFISXM-6IBPJ5O7.js → fundSwap-UBCHMUP4-WBLYE6MC.js} +11 -11
- package/dist/index.cjs +28 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -13
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +11 -6
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +11 -6
- package/dist/node.js.map +1 -1
- package/dist/types/cjs/pure/cctp/attestation.d.cts +5 -3
- package/dist/types/cjs/pure/cctp/types.d.cts +11 -2
- package/dist/types/cjs/pure/cctp-inbound/submit.d.cts +2 -0
- package/dist/types/cjs/pure/cctp-inbound/types.d.cts +5 -0
- package/dist/types/cjs/pure/cctp-inbound/userOp.d.cts +11 -0
- package/dist/types/cjs/pure/client.d.cts +61 -18
- package/dist/types/cjs/pure/create/arkade-to-lightning.d.cts +8 -0
- package/dist/types/cjs/pure/create/bitcoin-to-lightning.d.cts +8 -0
- package/dist/types/cjs/pure/create/types.d.cts +16 -4
- package/dist/types/cjs/pure/evm/coordinator.d.cts +4 -0
- package/dist/types/cjs/pure/evm/wallet.d.cts +4 -4
- package/dist/types/cjs/pure/generated/api.d.cts +102 -21
- package/dist/types/cjs/pure/redeem/arkade.d.cts +4 -1
- package/dist/types/cjs/pure/storage/types.d.cts +2 -0
- package/dist/types/cjs/pure/swap-verification.d.cts +12 -0
- package/dist/types/cjs/pure/tokens.d.cts +0 -6
- package/dist/types/cjs/pure/types/dex-quote.d.cts +9 -1
- package/dist/types/cjs/pure/version.d.cts +4 -4
- package/dist/types/cjs/swap/client.d.cts +2 -0
- package/dist/types/esm/pure/cctp/attestation.d.ts +5 -3
- package/dist/types/esm/pure/cctp/types.d.ts +11 -2
- package/dist/types/esm/pure/cctp-inbound/submit.d.ts +2 -0
- package/dist/types/esm/pure/cctp-inbound/types.d.ts +5 -0
- package/dist/types/esm/pure/cctp-inbound/userOp.d.ts +11 -0
- package/dist/types/esm/pure/client.d.ts +61 -18
- package/dist/types/esm/pure/create/arkade-to-lightning.d.ts +8 -0
- package/dist/types/esm/pure/create/bitcoin-to-lightning.d.ts +8 -0
- package/dist/types/esm/pure/create/types.d.ts +16 -4
- package/dist/types/esm/pure/evm/coordinator.d.ts +4 -0
- package/dist/types/esm/pure/evm/wallet.d.ts +4 -4
- package/dist/types/esm/pure/generated/api.d.ts +102 -21
- package/dist/types/esm/pure/redeem/arkade.d.ts +4 -1
- package/dist/types/esm/pure/storage/types.d.ts +2 -0
- package/dist/types/esm/pure/swap-verification.d.ts +12 -0
- package/dist/types/esm/pure/tokens.d.ts +0 -6
- package/dist/types/esm/pure/types/dex-quote.d.ts +9 -1
- package/dist/types/esm/pure/version.d.ts +4 -4
- package/dist/types/esm/swap/client.d.ts +2 -0
- package/dist/wallet-33OJRHX5-4VM7QDPO.cjs +31 -0
- package/dist/{wallet-THELKUYT-26NOFCTE.cjs.map → wallet-33OJRHX5-4VM7QDPO.cjs.map} +1 -1
- package/dist/{wallet-THELKUYT-TOHSMRGU.js → wallet-33OJRHX5-PR4S3NI3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2LGHF7A3.cjs.map +0 -1
- package/dist/chunk-7GOXIT24.cjs.map +0 -1
- package/dist/chunk-HWK7LVVX.js.map +0 -1
- package/dist/chunk-K4BQUZC6.js.map +0 -1
- package/dist/chunk-MYOGO44L.cjs.map +0 -1
- package/dist/chunk-S4T4GK5G.js.map +0 -1
- package/dist/dist-MMYSP6LP.cjs +0 -394
- package/dist/wallet-THELKUYT-26NOFCTE.cjs +0 -31
- /package/dist/{dist-L5LHQNRK.js.map → dist-SHY7I6SH.js.map} +0 -0
- /package/dist/{fundSwap-IUPFISXM-6IBPJ5O7.js.map → fundSwap-UBCHMUP4-WBLYE6MC.js.map} +0 -0
- /package/dist/{wallet-THELKUYT-TOHSMRGU.js.map → wallet-33OJRHX5-PR4S3NI3.js.map} +0 -0
|
@@ -1328,6 +1328,13 @@ export interface components {
|
|
|
1328
1328
|
bridge_target_chain?: string | null;
|
|
1329
1329
|
/** @description USDC address on the bridge destination chain. */
|
|
1330
1330
|
bridge_target_token_address?: string | null;
|
|
1331
|
+
/**
|
|
1332
|
+
* @description Transaction that delivered the bridged payout on the destination
|
|
1333
|
+
* chain, once the server has minted it there. Absent while the transfer
|
|
1334
|
+
* is in flight, and for payouts Circle's Forwarding Service delivers
|
|
1335
|
+
* (Circle's API reports that transaction).
|
|
1336
|
+
*/
|
|
1337
|
+
bridge_target_txid?: string | null;
|
|
1331
1338
|
btc_claim_txid?: string | null;
|
|
1332
1339
|
btc_fund_txid?: string | null;
|
|
1333
1340
|
btc_vhtlc_address: string;
|
|
@@ -1401,8 +1408,10 @@ export interface components {
|
|
|
1401
1408
|
*/
|
|
1402
1409
|
lightning_address?: string | null;
|
|
1403
1410
|
/**
|
|
1404
|
-
* @description BOLT11 invoice the user wants paid. Must carry an amount
|
|
1405
|
-
* pins the payout
|
|
1411
|
+
* @description BOLT11 invoice the user wants paid. Must carry an amount, which
|
|
1412
|
+
* pins the payout. By default the fees go on top of it and the lock
|
|
1413
|
+
* amount follows from the Lightning send fee quoted for this invoice;
|
|
1414
|
+
* pass `source_amount_sats` as well to lock a fixed amount instead.
|
|
1406
1415
|
* Mutually exclusive with `lightning_address` and `lnurl`.
|
|
1407
1416
|
*/
|
|
1408
1417
|
lightning_invoice?: string | null;
|
|
@@ -1417,10 +1426,20 @@ export interface components {
|
|
|
1417
1426
|
refund_pk: string;
|
|
1418
1427
|
/**
|
|
1419
1428
|
* Format: int64
|
|
1420
|
-
* @description Total amount the user wants to lock on Arkade in satoshis
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1429
|
+
* @description Total amount the user wants to lock on Arkade in satoshis; mutually
|
|
1430
|
+
* exclusive with `target_amount_sats`.
|
|
1431
|
+
*
|
|
1432
|
+
* With `lightning_address`/`lnurl` (send-max): fees are deducted from
|
|
1433
|
+
* the Lightning payout.
|
|
1434
|
+
*
|
|
1435
|
+
* With `lightning_invoice` (fixed lock): the VHTLC amount is exactly
|
|
1436
|
+
* this. It must cover invoice amount + protocol fee + the Lightning
|
|
1437
|
+
* send fee quoted for the invoice, else the request fails with a 400
|
|
1438
|
+
* naming the shortfall. Any surplus is charged as network fee, capped
|
|
1439
|
+
* at max(1% of the lock, 100 sats, the route's `/quote` send-fee
|
|
1440
|
+
* estimate); a larger surplus is refused. Typical flow: `/quote` with
|
|
1441
|
+
* this source amount, request an invoice over its `net_target_amount`,
|
|
1442
|
+
* then create with both.
|
|
1424
1443
|
*/
|
|
1425
1444
|
source_amount_sats?: number | null;
|
|
1426
1445
|
/**
|
|
@@ -1631,6 +1650,13 @@ export interface components {
|
|
|
1631
1650
|
bridge_target_chain?: string | null;
|
|
1632
1651
|
/** @description USDC address on the bridge destination chain. */
|
|
1633
1652
|
bridge_target_token_address?: string | null;
|
|
1653
|
+
/**
|
|
1654
|
+
* @description Transaction that delivered the bridged payout on the destination
|
|
1655
|
+
* chain, once the server has minted it there. Absent while the transfer
|
|
1656
|
+
* is in flight, and for payouts Circle's Forwarding Service delivers
|
|
1657
|
+
* (Circle's API reports that transaction).
|
|
1658
|
+
*/
|
|
1659
|
+
bridge_target_txid?: string | null;
|
|
1634
1660
|
/** @description On-chain claim transaction ID (server claim) */
|
|
1635
1661
|
btc_claim_txid?: string | null;
|
|
1636
1662
|
/** @description On-chain funding transaction ID */
|
|
@@ -1742,8 +1768,10 @@ export interface components {
|
|
|
1742
1768
|
*/
|
|
1743
1769
|
lightning_address?: string | null;
|
|
1744
1770
|
/**
|
|
1745
|
-
* @description BOLT11 invoice the user wants paid. Must carry an amount
|
|
1746
|
-
* pins the payout
|
|
1771
|
+
* @description BOLT11 invoice the user wants paid. Must carry an amount, which
|
|
1772
|
+
* pins the payout. By default the fees go on top of it and the lock
|
|
1773
|
+
* amount follows from the Lightning send fee quoted for this invoice;
|
|
1774
|
+
* pass `source_amount_sats` as well to lock a fixed amount instead.
|
|
1747
1775
|
* Mutually exclusive with `lightning_address` and `lnurl`.
|
|
1748
1776
|
*/
|
|
1749
1777
|
lightning_invoice?: string | null;
|
|
@@ -1758,10 +1786,19 @@ export interface components {
|
|
|
1758
1786
|
refund_pk: string;
|
|
1759
1787
|
/**
|
|
1760
1788
|
* Format: int64
|
|
1761
|
-
* @description Total amount the user wants to lock on-chain in satoshis
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1789
|
+
* @description Total amount the user wants to lock on-chain in satoshis; mutually
|
|
1790
|
+
* exclusive with `target_amount_sats`.
|
|
1791
|
+
*
|
|
1792
|
+
* With `lightning_address`/`lnurl` (send-max): fees are deducted from
|
|
1793
|
+
* the Lightning payout.
|
|
1794
|
+
*
|
|
1795
|
+
* With `lightning_invoice` (fixed lock): the HTLC amount is exactly
|
|
1796
|
+
* this. It must cover invoice amount + protocol fee + the Lightning
|
|
1797
|
+
* send fee quoted for the invoice + the server's on-chain claim fee,
|
|
1798
|
+
* else the request fails with a 400 naming the shortfall. Any surplus
|
|
1799
|
+
* is charged as network fee, capped at max(1% of the lock, 100 sats,
|
|
1800
|
+
* the route's `/quote` send-fee estimate); a larger surplus is
|
|
1801
|
+
* refused.
|
|
1765
1802
|
*/
|
|
1766
1803
|
source_amount_sats?: number | null;
|
|
1767
1804
|
/**
|
|
@@ -1858,8 +1895,8 @@ export interface components {
|
|
|
1858
1895
|
fee_token: components["schemas"]["Token"];
|
|
1859
1896
|
/**
|
|
1860
1897
|
* @description Flat USDC fee deducted from the bridged amount, recipient already
|
|
1861
|
-
* provisioned. Outbound: `forwardFee.high
|
|
1862
|
-
* `receiveMessage` ourselves). Stringified `u64`.
|
|
1898
|
+
* provisioned. Outbound: `forwardFee.high`, or `0` when `self_relayed`;
|
|
1899
|
+
* inbound: `0` (we call `receiveMessage` ourselves). Stringified `u64`.
|
|
1863
1900
|
*/
|
|
1864
1901
|
flat: string;
|
|
1865
1902
|
/**
|
|
@@ -1881,6 +1918,23 @@ export interface components {
|
|
|
1881
1918
|
proportional_fee_millionths: string;
|
|
1882
1919
|
/** @enum {string} */
|
|
1883
1920
|
router: "cctp";
|
|
1921
|
+
/**
|
|
1922
|
+
* @description `true` when the payout is priced as minted on the destination by
|
|
1923
|
+
* the server itself instead of Circle's Forwarding Service
|
|
1924
|
+
* (outbound to chains where it holds gas). `flat` is then `0`.
|
|
1925
|
+
*
|
|
1926
|
+
* The server only mints a burn it can attribute to a swap: that
|
|
1927
|
+
* swap's own claim, burned through the swap's coordinator and
|
|
1928
|
+
* minted to the swap's recorded payout address, without Circle's
|
|
1929
|
+
* forwarding hook. Claim calldata from `/dex-calldata` (with
|
|
1930
|
+
* `swap_id`) and `redeem-and-swap-calldata` is built that way. A
|
|
1931
|
+
* client that builds the burn itself may rely on this flag only
|
|
1932
|
+
* when it named the swap in the quote (`swap_id`) and its burn meets
|
|
1933
|
+
* those conditions; any other burn must request forwarding and pay
|
|
1934
|
+
* the forwarding fee, or nobody delivers it. Always `false`
|
|
1935
|
+
* inbound.
|
|
1936
|
+
*/
|
|
1937
|
+
self_relayed: boolean;
|
|
1884
1938
|
} | {
|
|
1885
1939
|
/**
|
|
1886
1940
|
* @description LayerZero messaging fee in sats: the live `quoteSend` fee converted
|
|
@@ -2410,6 +2464,14 @@ export interface components {
|
|
|
2410
2464
|
* Bounded server-side; out-of-range values return 400.
|
|
2411
2465
|
*/
|
|
2412
2466
|
slippage_bps: number;
|
|
2467
|
+
/**
|
|
2468
|
+
* Format: uuid
|
|
2469
|
+
* @description The swap this calldata claims. Only with it can the server deliver a
|
|
2470
|
+
* bridged USDC payout itself (no Circle forwarding fee): it delivers
|
|
2471
|
+
* what it can find again, the payout of a swap created to bridge to
|
|
2472
|
+
* that chain. Without it the payout uses Circle's Forwarding Service.
|
|
2473
|
+
*/
|
|
2474
|
+
swap_id?: string | null;
|
|
2413
2475
|
/** @description Target asset the swap will produce. */
|
|
2414
2476
|
to: components["schemas"]["Token"];
|
|
2415
2477
|
};
|
|
@@ -2539,6 +2601,13 @@ export interface components {
|
|
|
2539
2601
|
* Bounded server-side; out-of-range values return 400.
|
|
2540
2602
|
*/
|
|
2541
2603
|
slippage_bps: number;
|
|
2604
|
+
/**
|
|
2605
|
+
* Format: uuid
|
|
2606
|
+
* @description The swap whose bridged payout this quote prices, when it is one. Who
|
|
2607
|
+
* delivers a CCTP payout is then decided for that swap, as its claim
|
|
2608
|
+
* calldata decides it, instead of for the quoted amount.
|
|
2609
|
+
*/
|
|
2610
|
+
swap_id?: string | null;
|
|
2542
2611
|
/**
|
|
2543
2612
|
* @description Target asset. Same-chain quotes use the same chain id as `from`;
|
|
2544
2613
|
* cross-chain quotes bridge (a different EVM chain id, or a
|
|
@@ -3291,7 +3360,8 @@ export interface components {
|
|
|
3291
3360
|
/**
|
|
3292
3361
|
* Format: int64
|
|
3293
3362
|
* @description Provider-quoted Lightning send fee, charged as the network fee,
|
|
3294
|
-
* in satoshis
|
|
3363
|
+
* in satoshis (plus, for a fixed-lock invoice quote, the lock's
|
|
3364
|
+
* surplus over invoice + fees).
|
|
3295
3365
|
*/
|
|
3296
3366
|
network_fee_sats: number;
|
|
3297
3367
|
/**
|
|
@@ -3618,6 +3688,13 @@ export interface components {
|
|
|
3618
3688
|
bridge_target_chain?: string | null;
|
|
3619
3689
|
/** @description USDC address on the bridge destination chain. */
|
|
3620
3690
|
bridge_target_token_address?: string | null;
|
|
3691
|
+
/**
|
|
3692
|
+
* @description Transaction that delivered the bridged payout on the destination
|
|
3693
|
+
* chain, once the server has minted it there. Absent while the transfer
|
|
3694
|
+
* is in flight, and for payouts Circle's Forwarding Service delivers
|
|
3695
|
+
* (Circle's API reports that transaction).
|
|
3696
|
+
*/
|
|
3697
|
+
bridge_target_txid?: string | null;
|
|
3621
3698
|
/** @description EVM chain name (e.g. "Polygon", "Ethereum", "Arbitrum") */
|
|
3622
3699
|
chain: string;
|
|
3623
3700
|
/** @description EVM address that will sign the HTLC claim (SDK-derived for gasless claims) */
|
|
@@ -5312,15 +5389,19 @@ export interface operations {
|
|
|
5312
5389
|
source_token?: string | null;
|
|
5313
5390
|
/**
|
|
5314
5391
|
* @description Total to lock on the source chain, in the source token's smallest
|
|
5315
|
-
* unit (satoshis for Arkade and Bitcoin, token units for EVM);
|
|
5316
|
-
*
|
|
5317
|
-
*
|
|
5318
|
-
* `
|
|
5392
|
+
* unit (satoshis for Arkade and Bitcoin, token units for EVM); mutually
|
|
5393
|
+
* exclusive with `target_amount_sats`. With `lightning_address`/`lnurl`
|
|
5394
|
+
* fees are deducted from the Lightning payout (send-max). With
|
|
5395
|
+
* `lightning_invoice` (Arkade and Bitcoin only) it is a fixed lock:
|
|
5396
|
+
* the quote reports the same split create would persist (surplus over
|
|
5397
|
+
* invoice + fees charged as network fee) or the same 400 naming the
|
|
5398
|
+
* shortfall or excess surplus.
|
|
5319
5399
|
*/
|
|
5320
5400
|
source_amount?: string | null;
|
|
5321
5401
|
/**
|
|
5322
|
-
* @description BOLT11 invoice the user wants paid; pins the payout.
|
|
5323
|
-
*
|
|
5402
|
+
* @description BOLT11 invoice the user wants paid; pins the payout. Combine with
|
|
5403
|
+
* `source_amount` for a fixed lock. Mutually exclusive with
|
|
5404
|
+
* `lightning_address` and `lnurl`.
|
|
5324
5405
|
*/
|
|
5325
5406
|
lightning_invoice?: string | null;
|
|
5326
5407
|
/**
|
|
@@ -69,4 +69,7 @@ export interface ArkadeClaimResult {
|
|
|
69
69
|
* @throws Error if the claim fails
|
|
70
70
|
*/
|
|
71
71
|
export declare function buildArkadeClaim(params: ArkadeClaimParams): Promise<ArkadeClaimResult>;
|
|
72
|
-
|
|
72
|
+
/** Resume an existing claim, checking its recipient when supplied by the caller. */
|
|
73
|
+
export declare function continueArkadeClaim(params: Omit<ArkadeClaimParams, "destinationAddress"> & {
|
|
74
|
+
destinationAddress?: string;
|
|
75
|
+
}): Promise<ArkadeClaimResult>;
|
|
@@ -112,6 +112,8 @@ export interface StoredSwap {
|
|
|
112
112
|
* {@link lightningPaymentHash}, whichever tx it came from.
|
|
113
113
|
*/
|
|
114
114
|
evmFundTxid?: string;
|
|
115
|
+
/** Signed sponsored funding: reconcile before allowing another attempt. */
|
|
116
|
+
evmFundingUserOpHash?: string;
|
|
115
117
|
/**
|
|
116
118
|
* For an EVM → Lightning swap, the payment hash this client fixed at
|
|
117
119
|
* creation. Every funding path refuses to lock under any other hash (the
|
|
@@ -26,6 +26,18 @@ export declare class SwapVerificationError extends Error {
|
|
|
26
26
|
swapId?: string;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* A fixed-lock invoice swap (`lightningInvoice` + `sourceAmountSats`) must
|
|
31
|
+
* ask for exactly the requested lock: a caller like an escrow can only fund
|
|
32
|
+
* that amount, and a larger one would leave the swap underfunded.
|
|
33
|
+
*/
|
|
34
|
+
export declare function assertFixedLockAmount(options: {
|
|
35
|
+
lightningInvoice?: string;
|
|
36
|
+
sourceAmountSats?: number;
|
|
37
|
+
}, data: {
|
|
38
|
+
id?: string;
|
|
39
|
+
source_amount: string | number;
|
|
40
|
+
}): void;
|
|
29
41
|
/** A hex hash without `0x`, lowercase. */
|
|
30
42
|
export declare function normalizeHash(hash: string): string;
|
|
31
43
|
/**
|
|
@@ -116,12 +116,6 @@ export declare function isNativeLockTarget(chain: string, token: string): boolea
|
|
|
116
116
|
export declare function isEvmSwapSource(chain: string, token: string): boolean;
|
|
117
117
|
/** Native USDT on Tron is a send-only Legacy Mesh destination. */
|
|
118
118
|
export declare function isTronToken(chain: string): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Kill switch for paying out USDC on Ethereum and Polygon over CCTP from
|
|
121
|
-
* Arbitrum. With `false`, those payouts run on the chain directly again.
|
|
122
|
-
* Keep in sync with `CCTP_ROUTED_USDC_ENABLED` in the Rust SDK.
|
|
123
|
-
*/
|
|
124
|
-
export declare const CCTP_ROUTED_USDC_ENABLED = true;
|
|
125
119
|
/**
|
|
126
120
|
* Returns true for native USDC on Ethereum or Polygon as a swap *target*.
|
|
127
121
|
* Both chains have HTLCs, but USDC payouts to them settle on Arbitrum and
|
|
@@ -78,10 +78,17 @@ export type BridgeRate = {
|
|
|
78
78
|
* 0.013% = `130 / 1_000_000`. Stringified u128.
|
|
79
79
|
*/
|
|
80
80
|
proportional_fee_millionths: string;
|
|
81
|
-
/** Flat USDC fee deducted from the bridged amount, recipient already provisioned. Outbound: `forwardFee.high`; inbound: `"0"`. Stringified u64. */
|
|
81
|
+
/** Flat USDC fee deducted from the bridged amount, recipient already provisioned. Outbound: `forwardFee.high`, or `"0"` when `self_relayed`; inbound: `"0"`. Stringified u64. */
|
|
82
82
|
flat: string;
|
|
83
83
|
/** Flat-fee variant including a fresh non-EVM recipient's ATA rent (Solana). Equals `flat` otherwise; same units. Stringified u64. */
|
|
84
84
|
flat_with_setup: string;
|
|
85
|
+
/**
|
|
86
|
+
* `true` when the Satora server mints the USDC on the destination chain
|
|
87
|
+
* itself instead of Circle's Forwarding Service (outbound USDC on
|
|
88
|
+
* Polygon and Ethereum, while the server holds gas there). `flat` is
|
|
89
|
+
* then `"0"`. Absent on servers that predate it.
|
|
90
|
+
*/
|
|
91
|
+
self_relayed?: boolean;
|
|
85
92
|
} | {
|
|
86
93
|
router: "layerzero";
|
|
87
94
|
/** LayerZero messaging fee in sats (the live ETH fee converted at the current rate); add it to the network fee. Stringified u64. */
|
|
@@ -125,6 +132,7 @@ export type WireBridgeRate = {
|
|
|
125
132
|
proportional_fee_millionths: string;
|
|
126
133
|
flat: string;
|
|
127
134
|
flat_with_setup: string;
|
|
135
|
+
self_relayed?: boolean | null;
|
|
128
136
|
} | {
|
|
129
137
|
router: "layerzero";
|
|
130
138
|
native_fee_sats: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const SDK_NAME = "swap";
|
|
2
|
-
export declare const SDK_VERSION = "1.
|
|
3
|
-
export declare const SDK_COMMIT_HASH = "
|
|
2
|
+
export declare const SDK_VERSION = "1.11.1";
|
|
3
|
+
export declare const SDK_COMMIT_HASH = "082a5f12e1766f59a5ff63bef69e81ce27453535";
|
|
4
4
|
/** @deprecated Retained for source compatibility; requests no longer send it. */
|
|
5
|
-
export declare const SATORA_SERVER_VERSION = "0.3.
|
|
6
|
-
export declare const CLIENT_AGENT = "swap/1.
|
|
5
|
+
export declare const SATORA_SERVER_VERSION = "0.3.29";
|
|
6
|
+
export declare const CLIENT_AGENT = "swap/1.11.1";
|
|
7
7
|
export declare const DEFAULT_AA_BUNDLER_URL = "https://arb-mainnet.g.alchemy.com/v2/ZaG_75AoAHzPqzmys5jpD";
|
|
8
8
|
export declare const DEFAULT_AA_POLICY_ID = "878b1c90-5b53-4c9c-8892-6d7659dd2e72";
|
|
@@ -256,6 +256,8 @@ export declare class Client {
|
|
|
256
256
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
257
257
|
fundSwapGasless(...args: Parameters<LegacyClient["fundSwapGasless"]>): ReturnType<LegacyClient["fundSwapGasless"]>;
|
|
258
258
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
259
|
+
gaslessFundingPlan(...args: Parameters<LegacyClient["gaslessFundingPlan"]>): ReturnType<LegacyClient["gaslessFundingPlan"]>;
|
|
260
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
259
261
|
getEvmFundingExpectation(...args: Parameters<LegacyClient["getEvmFundingExpectation"]>): ReturnType<LegacyClient["getEvmFundingExpectation"]>;
|
|
260
262
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
261
263
|
getSwapDepositorKey(...args: Parameters<LegacyClient["getSwapDepositorKey"]>): ReturnType<LegacyClient["getSwapDepositorKey"]>;
|
|
@@ -66,11 +66,13 @@ export interface TrackCctpMessageOptions {
|
|
|
66
66
|
onStatusChange?: (status: CctpMessageStatus) => void;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Poll the IRIS V2 API until the CCTP message is
|
|
69
|
+
* Poll the IRIS V2 API until the CCTP message is delivered.
|
|
70
70
|
*
|
|
71
|
-
* Tracks attestation →
|
|
71
|
+
* Tracks attestation → delivery on the destination chain, whether Circle's
|
|
72
|
+
* Forwarding Service delivers the message or somebody else mints it (the
|
|
73
|
+
* Satora server does for USDC payouts on Polygon and Ethereum).
|
|
72
74
|
*
|
|
73
|
-
* @returns The message result with
|
|
75
|
+
* @returns The message result with delivery details (destination tx hash, amount, fee).
|
|
74
76
|
* @throws If the message is not delivered within the timeout.
|
|
75
77
|
*/
|
|
76
78
|
export declare function trackCctpMessage(options: TrackCctpMessageOptions): Promise<CctpMessageResult>;
|
|
@@ -16,6 +16,11 @@ export interface AttestationResponse {
|
|
|
16
16
|
forwardState?: string | null;
|
|
17
17
|
/** Transaction hash of the forward/mint on the destination chain. */
|
|
18
18
|
forwardTxHash?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Transaction that minted on the destination chain, whoever sent it.
|
|
21
|
+
* Set for messages delivered without the forwarding service too.
|
|
22
|
+
*/
|
|
23
|
+
destinationMintTxHash?: string | null;
|
|
19
24
|
/** Decoded CCTP message with amounts and fees. */
|
|
20
25
|
decodedMessage?: {
|
|
21
26
|
sourceDomain: string;
|
|
@@ -37,11 +42,15 @@ export interface AttestationResponse {
|
|
|
37
42
|
export interface CctpMessageResult {
|
|
38
43
|
/** Current message status. */
|
|
39
44
|
status: CctpMessageStatus;
|
|
40
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Transaction that delivered the USDC on the destination chain: Circle's
|
|
47
|
+
* forward, or the mint when the message was delivered without the
|
|
48
|
+
* forwarding service.
|
|
49
|
+
*/
|
|
41
50
|
forwardTxHash?: string;
|
|
42
51
|
/** Amount received on destination in smallest units (after fee deduction). */
|
|
43
52
|
amount?: string;
|
|
44
|
-
/**
|
|
53
|
+
/** CCTP fee executed in smallest units. */
|
|
45
54
|
feeExecuted?: string;
|
|
46
55
|
}
|
|
47
56
|
/** Parameters for initiating a CCTP bridge. */
|
|
@@ -100,6 +100,8 @@ export interface SubmitBalanceUserOpParams {
|
|
|
100
100
|
* into a retry if calldata ever asks for more than the recovered swap.
|
|
101
101
|
*/
|
|
102
102
|
expectedMaxSourceAmount?: bigint;
|
|
103
|
+
/** Persist the signed operation hash before any submission can reach the bundler. */
|
|
104
|
+
onSigned?: (userOpHash: Hex) => Promise<void>;
|
|
103
105
|
/** Optional logger sink. Silent by default. */
|
|
104
106
|
logger?: Logger;
|
|
105
107
|
/** Minimum log level to emit. Defaults to `silent`. */
|
|
@@ -36,4 +36,9 @@ export interface AaConfig {
|
|
|
36
36
|
* must have enough native gas token to pay for execution.
|
|
37
37
|
*/
|
|
38
38
|
paymasterPolicyId?: string;
|
|
39
|
+
/** Explicit local-test opt-in: fundSwapGasless may use account-paid gas.
|
|
40
|
+
* The deposit account must be prefunded with native ETH. Never advertised
|
|
41
|
+
* as sponsored; production deposit UIs should reject this mode.
|
|
42
|
+
*/
|
|
43
|
+
allowSelfPaidFunding?: boolean;
|
|
39
44
|
}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { Address, Hex } from "viem";
|
|
16
16
|
import { type ExpectedFunding } from "../evm/funding-pins.js";
|
|
17
|
+
/** Canonical Permit2 deployment — same on all EVM chains. */
|
|
18
|
+
export declare const PERMIT2_ADDRESS: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
17
19
|
/**
|
|
18
20
|
* Shape returned by the backend's
|
|
19
21
|
* `GET /v1/swap/:id/swap-and-lock-calldata-userop` endpoint.
|
|
@@ -76,6 +78,15 @@ export interface BuildCctpInboundBatchParams {
|
|
|
76
78
|
chainId: number;
|
|
77
79
|
/** Whether USDC is already at `smartAccountAddress` (skip receiveMessage). */
|
|
78
80
|
skipReceiveMessage?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The account's current `allowance(smartAccount, Permit2)` on the source
|
|
83
|
+
* token. When given, the approve step is composed from it: skipped when the
|
|
84
|
+
* allowance already covers the input, and preceded by an `approve(0)` reset
|
|
85
|
+
* when a smaller non-zero allowance lingers — tokens of the USDT family
|
|
86
|
+
* revert a non-zero → non-zero approve. When omitted, `approve(max)` is
|
|
87
|
+
* always sent (safe for USDC, whose approve overwrites).
|
|
88
|
+
*/
|
|
89
|
+
permit2Allowance?: bigint;
|
|
79
90
|
}
|
|
80
91
|
/** A single (target, data, value) call the smart account will execute. */
|
|
81
92
|
export interface BatchCall {
|
|
@@ -462,9 +462,12 @@ export interface GetLightningSendQuoteParams {
|
|
|
462
462
|
sourceToken?: string;
|
|
463
463
|
/**
|
|
464
464
|
* Total to lock on the source chain, in the source token's smallest
|
|
465
|
-
* unit (sats for Arkade and Bitcoin, token units for EVM);
|
|
466
|
-
*
|
|
467
|
-
*
|
|
465
|
+
* unit (sats for Arkade and Bitcoin, token units for EVM); mutually
|
|
466
|
+
* exclusive with `targetAmountSats`. With `lightningAddress`/`lnurl`
|
|
467
|
+
* fees are deducted from the Lightning payout (send-max). With
|
|
468
|
+
* `lightningInvoice` (Arkade and Bitcoin only) it is a fixed lock: the
|
|
469
|
+
* quote shows the split create would persist, surplus over invoice +
|
|
470
|
+
* fees charged as network fee, or fails like create would.
|
|
468
471
|
*/
|
|
469
472
|
sourceAmount?: bigint | number | string;
|
|
470
473
|
/**
|
|
@@ -474,7 +477,7 @@ export interface GetLightningSendQuoteParams {
|
|
|
474
477
|
sourceAmountSats?: number;
|
|
475
478
|
/**
|
|
476
479
|
* BOLT11 invoice the user wants paid; its amount pins the payout.
|
|
477
|
-
* `sourceAmount`
|
|
480
|
+
* Combine with `sourceAmount` for a fixed lock.
|
|
478
481
|
*/
|
|
479
482
|
lightningInvoice?: string;
|
|
480
483
|
/** Lightning address (`user@domain`). */
|
|
@@ -546,9 +549,12 @@ export interface ClientConfig {
|
|
|
546
549
|
baseUrl: string;
|
|
547
550
|
/**
|
|
548
551
|
* Optional default referral code (`referral_id` on the swap backend).
|
|
549
|
-
* If set, every
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
+
* If set, every quote (`getQuote`, `composeQuote`,
|
|
553
|
+
* `getLightningSendQuote`) and every create (`createSwap` and the
|
|
554
|
+
* direct `create*Swap` methods) that doesn't pass its own `referralCode`
|
|
555
|
+
* uses this value, so quote and create are priced with the same fees.
|
|
556
|
+
* Useful for SDK consumers that always attribute swaps to the same
|
|
557
|
+
* developer key.
|
|
552
558
|
*/
|
|
553
559
|
referralCode?: string;
|
|
554
560
|
/** Optional default headers to send with SDK API requests. */
|
|
@@ -623,8 +629,11 @@ export declare class ClientBuilder {
|
|
|
623
629
|
*/
|
|
624
630
|
withBaseUrl(baseUrl: string): this;
|
|
625
631
|
/**
|
|
626
|
-
* Sets a default referral code for every
|
|
627
|
-
*
|
|
632
|
+
* Sets a default referral code for every quote (`getQuote`,
|
|
633
|
+
* `composeQuote`, `getLightningSendQuote`) and every create
|
|
634
|
+
* (`createSwap` and the direct `create*Swap` methods), so quote and
|
|
635
|
+
* create are priced with the same fees. Per-call `referralCode` always
|
|
636
|
+
* wins.
|
|
628
637
|
* @returns The builder instance for chaining.
|
|
629
638
|
*/
|
|
630
639
|
withReferralCode(referralCode: string): this;
|
|
@@ -632,7 +641,8 @@ export declare class ClientBuilder {
|
|
|
632
641
|
* @deprecated Use {@link withReferralCode}. Kept as a backwards-compat
|
|
633
642
|
* alias for SDK consumers that haven't migrated from the old
|
|
634
643
|
* `X-Org-Code` model — both sides flow through the same per-call
|
|
635
|
-
* `referral_code` plumbing now
|
|
644
|
+
* `referral_code` plumbing now, so the default applies to every quote
|
|
645
|
+
* and create exactly like {@link withReferralCode}.
|
|
636
646
|
*/
|
|
637
647
|
withOrgCode(orgCode: string): this;
|
|
638
648
|
/**
|
|
@@ -1797,6 +1807,7 @@ export declare class Client {
|
|
|
1797
1807
|
* nonce: params.nonce,
|
|
1798
1808
|
* deadline: params.deadline,
|
|
1799
1809
|
* signature,
|
|
1810
|
+
* depositorCode: (await publicClient.getCode({ address: userWalletAddress })) ?? "0x",
|
|
1800
1811
|
* },
|
|
1801
1812
|
* );
|
|
1802
1813
|
* ```
|
|
@@ -1839,6 +1850,7 @@ export declare class Client {
|
|
|
1839
1850
|
* const signer: EvmSigner = {
|
|
1840
1851
|
* address: walletClient.account.address,
|
|
1841
1852
|
* chainId: walletClient.chain.id,
|
|
1853
|
+
* getCode: async (address) => (await publicClient.getCode({ address })) ?? "0x",
|
|
1842
1854
|
* signTypedData: (td) => walletClient.signTypedData({ ...td, account: walletClient.account }),
|
|
1843
1855
|
* sendTransaction: (tx) => walletClient.sendTransaction({ to: tx.to, data: tx.data, value: tx.value, type: tx.type, chain, gas: tx.gas }),
|
|
1844
1856
|
* waitForReceipt: (hash) => publicClient.waitForReceipt({ hash }),
|
|
@@ -2009,19 +2021,50 @@ export declare class Client {
|
|
|
2009
2021
|
userOpHash: string;
|
|
2010
2022
|
}>;
|
|
2011
2023
|
/**
|
|
2012
|
-
*
|
|
2024
|
+
* How {@link fundSwapGasless} funds a gasless swap locking on `chainId`,
|
|
2025
|
+
* decided before the user is shown a deposit address:
|
|
2013
2026
|
*
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2027
|
+
* - `sponsored` on Arbitrum, where the paymaster runs: this SDK submits
|
|
2028
|
+
* `approve(Permit2)` + `executeAndCreateWithPermit2` itself as one
|
|
2029
|
+
* paymaster-sponsored UserOp from the depositor's Kernel account. No
|
|
2030
|
+
* server relay, no ETH on the deposit account.
|
|
2031
|
+
* - `relay` on every other chain, which has no sponsorship policy: the
|
|
2032
|
+
* server's legacy relay submits the funding from the signed permits.
|
|
2033
|
+
*
|
|
2034
|
+
* Throws when the sponsored path applies but this client was built
|
|
2035
|
+
* without AA config and a paymaster policy. Explicit self-paid testing
|
|
2036
|
+
* returns `self-paid` and requires native ETH on the account,
|
|
2037
|
+
* so callers can refuse to request a deposit that
|
|
2038
|
+
* could not be moved afterwards.
|
|
2039
|
+
*/
|
|
2040
|
+
gaslessFundingPlan(chainId: number): {
|
|
2041
|
+
mode: "sponsored" | "self-paid" | "relay";
|
|
2042
|
+
};
|
|
2043
|
+
/**
|
|
2044
|
+
* Fund an EVM-sourced gasless swap. No wallet or ETH is required by
|
|
2045
|
+
* default; explicit self-paid testing requires native ETH.
|
|
2046
|
+
* {@link gaslessFundingPlan} decides the path from the swap's chain:
|
|
2047
|
+
*
|
|
2048
|
+
* On Arbitrum the SDK funds the swap itself: it submits
|
|
2049
|
+
* `approve(Permit2)` (only when the allowance needs it, with a zero-reset
|
|
2050
|
+
* for USDT-style tokens — no EIP-2612 support needed) +
|
|
2051
|
+
* `executeAndCreateWithPermit2` as one paymaster-sponsored UserOp from
|
|
2052
|
+
* the depositor's own Kernel account (EIP-7702), the same mechanism the
|
|
2053
|
+
* CCTP-inbound settlement and refund continuations use. A sponsorship or
|
|
2054
|
+
* configuration failure surfaces as an error — there is no fallback to
|
|
2055
|
+
* the server relay.
|
|
2056
|
+
*
|
|
2057
|
+
* On other chains it signs the Permit2 authorization and (optionally) an
|
|
2058
|
+
* EIP-2612 permit off-chain, then POSTs them to the server's legacy
|
|
2059
|
+
* relay, which submits the on-chain transactions on behalf of the user.
|
|
2017
2060
|
*
|
|
2018
2061
|
* @param swapId - The UUID of the swap (must have been created with gasless=true)
|
|
2019
|
-
* @returns The
|
|
2062
|
+
* @returns The funding transaction hash
|
|
2020
2063
|
*
|
|
2021
2064
|
* @example
|
|
2022
2065
|
* ```ts
|
|
2023
2066
|
* const result = await client.fundSwapGasless(swap.response.id);
|
|
2024
|
-
* console.log("Funded
|
|
2067
|
+
* console.log("Funded:", result.txHash);
|
|
2025
2068
|
* ```
|
|
2026
2069
|
*/
|
|
2027
2070
|
fundSwapGasless(swapId: string, options?: {
|
|
@@ -2064,8 +2107,8 @@ export declare class Client {
|
|
|
2064
2107
|
* deterministic EVM signing key for this wallet without requiring a
|
|
2065
2108
|
* specific swap to be stored locally.
|
|
2066
2109
|
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2110
|
+
* This returns only the shared `m/44'/60'/0'/0/0` account, not a
|
|
2111
|
+
* per-swap deposit key. Intended for legacy standalone recovery tools
|
|
2069
2112
|
* where the user supplies the burn details manually and a per-swap
|
|
2070
2113
|
* record may no longer exist (e.g. fresh device, cleared site data).
|
|
2071
2114
|
*/
|
|
@@ -18,6 +18,14 @@ import type { ArkadeToLightningSwapOptions, ArkadeToLightningSwapResult, CreateS
|
|
|
18
18
|
* (send-max: fees deducted from the payout) or `targetAmountSats` (exact
|
|
19
19
|
* payout: fees added on top).
|
|
20
20
|
*
|
|
21
|
+
* `lightningInvoice` + `sourceAmountSats` is a fixed lock: the VHTLC is
|
|
22
|
+
* exactly `sourceAmountSats`, which must cover invoice + protocol fee +
|
|
23
|
+
* Lightning send fee (else a 400 names the shortfall); the surplus is
|
|
24
|
+
* charged as network fee, up to a cap. Flow for a fixed budget:
|
|
25
|
+
* `getQuote({ sourceAmount })`, invoice its `net_target_amount`, then
|
|
26
|
+
* create with `{ lightningInvoice, sourceAmountSats }`. The returned
|
|
27
|
+
* `source_amount` is checked to equal `sourceAmountSats`.
|
|
28
|
+
*
|
|
21
29
|
* Unlike the other directions, the swap's hash lock is the invoice's
|
|
22
30
|
* payment hash — the derived swap key is only used for the refund path
|
|
23
31
|
* (`refund_pk`), so a duplicate-hash 409 is not retried with a new key:
|
|
@@ -13,6 +13,14 @@ import type { BitcoinToLightningSwapOptions, BitcoinToLightningSwapResult, Creat
|
|
|
13
13
|
* (send-max: fees deducted from the payout) or `targetAmountSats` (exact
|
|
14
14
|
* payout: fees added on top).
|
|
15
15
|
*
|
|
16
|
+
* `lightningInvoice` + `sourceAmountSats` is a fixed lock: the HTLC is
|
|
17
|
+
* exactly `sourceAmountSats`, which must cover invoice + protocol fee +
|
|
18
|
+
* Lightning send fee (else a 400 names the shortfall); the surplus is
|
|
19
|
+
* charged as network fee, up to a cap. Flow for a fixed budget:
|
|
20
|
+
* `getQuote({ sourceAmount })`, invoice its `net_target_amount`, then
|
|
21
|
+
* create with `{ lightningInvoice, sourceAmountSats }`. The returned
|
|
22
|
+
* `source_amount` is checked to equal `sourceAmountSats`.
|
|
23
|
+
*
|
|
16
24
|
* As for Arkade → Lightning, the swap's hash lock is the invoice's payment
|
|
17
25
|
* hash; the derived swap key is only the HTLC's refund key, so a
|
|
18
26
|
* duplicate-hash 409 is not retried with a new key: it means this exact
|
|
@@ -381,14 +381,20 @@ export type ArkadeToLightningSwapOptions = {
|
|
|
381
381
|
extraFees?: number;
|
|
382
382
|
} & ({
|
|
383
383
|
/**
|
|
384
|
-
* BOLT11 invoice to pay. Its amount pins the payout
|
|
385
|
-
* `
|
|
386
|
-
*
|
|
384
|
+
* BOLT11 invoice to pay. Its amount pins the payout; an optional
|
|
385
|
+
* `targetAmountSats` is cross-checked against the invoice by the
|
|
386
|
+
* server.
|
|
387
387
|
*/
|
|
388
388
|
lightningInvoice: string;
|
|
389
389
|
lightningAddress?: undefined;
|
|
390
390
|
lnurl?: undefined;
|
|
391
|
-
|
|
391
|
+
/**
|
|
392
|
+
* Optional fixed lock in sats: lock exactly this instead of invoice
|
|
393
|
+
* + fees. Must cover invoice + protocol fee + Lightning send fee;
|
|
394
|
+
* the surplus is charged as network fee (capped). Mutually exclusive
|
|
395
|
+
* with `targetAmountSats`.
|
|
396
|
+
*/
|
|
397
|
+
sourceAmountSats?: number;
|
|
392
398
|
targetAmountSats?: number;
|
|
393
399
|
} | ({
|
|
394
400
|
/** Lightning address (`user@domain`) resolved into an invoice over the payout amount. */
|
|
@@ -507,6 +513,12 @@ export interface CreateSwapContext {
|
|
|
507
513
|
evmAddress: string;
|
|
508
514
|
/** Jump the key index forward by `n` (used to skip past reused indices). */
|
|
509
515
|
skipKeyIndices?: (n: number) => Promise<void>;
|
|
516
|
+
/**
|
|
517
|
+
* Client-level default referral code (`withReferralCode` / `withOrgCode`),
|
|
518
|
+
* sent when a create call doesn't pass its own `referralCode`, so a create
|
|
519
|
+
* is priced like the matching `getQuote`.
|
|
520
|
+
*/
|
|
521
|
+
referralCode?: string;
|
|
510
522
|
/** Optional logger sink. Silent by default. */
|
|
511
523
|
logger?: Logger;
|
|
512
524
|
/** Minimum log level to emit. Defaults to `silent`. */
|