@satora/swap 1.11.1 → 1.13.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/bitcoin-reader-electrum-2N4LJCGD.cjs +9 -0
- package/dist/{bitcoin-reader-electrum-VCQ5TQ44.cjs.map → bitcoin-reader-electrum-2N4LJCGD.cjs.map} +1 -1
- package/dist/bitcoin-reader-electrum-VLYRII3T.js +9 -0
- package/dist/bitcoin-reader-esplora-CAR4P52J.cjs +16 -0
- package/dist/bitcoin-reader-esplora-CAR4P52J.cjs.map +1 -0
- package/dist/{bitcoin-reader-esplora-CGPF4H5Y.js → bitcoin-reader-esplora-LC673MQT.js} +4 -2
- package/dist/{chunk-WQMAL2VD.js → chunk-34OYIFOU.js} +764 -141
- package/dist/chunk-34OYIFOU.js.map +1 -0
- package/dist/{chunk-4NVWIR74.cjs → chunk-3633KDTW.cjs} +1128 -505
- package/dist/chunk-3633KDTW.cjs.map +1 -0
- package/dist/{chunk-LSCRTQOS.js → chunk-CUYLQTRF.js} +15 -20
- package/dist/chunk-CUYLQTRF.js.map +1 -0
- package/dist/{chunk-INHFP222.cjs → chunk-CY5M5X6S.cjs} +28 -30
- package/dist/chunk-CY5M5X6S.cjs.map +1 -0
- package/dist/{chunk-JZTF4JNH.cjs → chunk-EI5ILLQ3.cjs} +2 -2
- package/dist/{chunk-JZTF4JNH.cjs.map → chunk-EI5ILLQ3.cjs.map} +1 -1
- package/dist/{chunk-5DQHR3RO.cjs → chunk-FJS6RGUR.cjs} +16 -21
- package/dist/chunk-FJS6RGUR.cjs.map +1 -0
- package/dist/{chunk-3ZMSZSAV.js → chunk-I2NF63VZ.js} +27 -29
- package/dist/chunk-I2NF63VZ.js.map +1 -0
- package/dist/{chunk-JHZHRY7S.js → chunk-K2Q4JWB6.js} +2 -2
- package/dist/{chunk-JHZHRY7S.js.map → chunk-K2Q4JWB6.js.map} +1 -1
- package/dist/{chunk-TT3J2OOS.js → chunk-KMBGRQS7.js} +5 -5
- package/dist/{chunk-TT3J2OOS.js.map → chunk-KMBGRQS7.js.map} +1 -1
- package/dist/{chunk-Q4TOBBAN.cjs → chunk-LZQZYSOZ.cjs} +5 -5
- package/dist/{chunk-Q4TOBBAN.cjs.map → chunk-LZQZYSOZ.cjs.map} +1 -1
- package/dist/delegate.cjs +2 -2
- package/dist/delegate.js +1 -1
- package/dist/{dist-SHY7I6SH.js → dist-3N76II5O.js} +16 -4
- package/dist/dist-KQINAMDC.cjs +406 -0
- package/dist/{dist-MHRQ5FFV.cjs.map → dist-KQINAMDC.cjs.map} +1 -1
- package/dist/{fundSwap-UBCHMUP4-BEMQNSFQ.cjs → fundSwap-2D4IPYU4-4NELKB3Q.cjs} +7 -7
- package/dist/{fundSwap-UBCHMUP4-BEMQNSFQ.cjs.map → fundSwap-2D4IPYU4-4NELKB3Q.cjs.map} +1 -1
- package/dist/{fundSwap-UBCHMUP4-WBLYE6MC.js → fundSwap-2D4IPYU4-CDM3WRUF.js} +3 -3
- package/dist/index.cjs +41 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -11
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +26 -5
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +26 -5
- package/dist/node.js.map +1 -1
- package/dist/types/cjs/pure/api/client.d.cts +1 -0
- package/dist/types/cjs/pure/client.d.cts +44 -12
- package/dist/types/cjs/pure/compose-quote.d.cts +14 -1
- package/dist/types/cjs/pure/create/bitcoin-payout.d.cts +17 -0
- package/dist/types/cjs/pure/create/evm-to-arkade.d.cts +0 -5
- package/dist/types/cjs/pure/create/evm-to-lightning.d.cts +0 -8
- package/dist/types/cjs/pure/create/funding-terms.d.cts +2 -1
- package/dist/types/cjs/pure/create/index.d.cts +2 -1
- package/dist/types/cjs/pure/create/payment-safety.d.cts +2 -0
- package/dist/types/cjs/pure/create/payout-slippage.d.cts +29 -0
- package/dist/types/cjs/pure/create/spark-to-evm.d.cts +7 -0
- package/dist/types/cjs/pure/create/types.d.cts +102 -3
- package/dist/types/cjs/pure/esplora.d.cts +2 -0
- package/dist/types/cjs/pure/evm/funding-pins.d.cts +2 -0
- package/dist/types/cjs/pure/generated/api.d.cts +352 -2
- package/dist/types/cjs/pure/index.d.cts +6 -4
- package/dist/types/cjs/pure/refund/onchain.d.cts +4 -0
- package/dist/types/cjs/pure/storage/index.d.cts +1 -1
- package/dist/types/cjs/pure/storage/types.d.cts +22 -0
- package/dist/types/cjs/pure/swap-verification.d.cts +3 -1
- package/dist/types/cjs/pure/tokens.d.cts +5 -0
- package/dist/types/cjs/pure/types/chain.d.cts +2 -2
- package/dist/types/cjs/pure/types/index.d.cts +1 -0
- package/dist/types/cjs/pure/types/promo-code.d.cts +15 -0
- package/dist/types/cjs/pure/types/quote.d.cts +7 -0
- package/dist/types/cjs/pure/types/referral-fee.d.cts +8 -0
- package/dist/types/cjs/pure/version.d.cts +4 -4
- package/dist/types/cjs/swap/client.d.cts +2 -0
- package/dist/types/cjs/swap/contracts/bitcoin-reader-esplora.d.cts +5 -0
- package/dist/types/esm/pure/api/client.d.ts +1 -0
- package/dist/types/esm/pure/client.d.ts +44 -12
- package/dist/types/esm/pure/compose-quote.d.ts +14 -1
- package/dist/types/esm/pure/create/bitcoin-payout.d.ts +17 -0
- package/dist/types/esm/pure/create/evm-to-arkade.d.ts +0 -5
- package/dist/types/esm/pure/create/evm-to-lightning.d.ts +0 -8
- package/dist/types/esm/pure/create/funding-terms.d.ts +2 -1
- package/dist/types/esm/pure/create/index.d.ts +2 -1
- package/dist/types/esm/pure/create/payment-safety.d.ts +2 -0
- package/dist/types/esm/pure/create/payout-slippage.d.ts +29 -0
- package/dist/types/esm/pure/create/spark-to-evm.d.ts +7 -0
- package/dist/types/esm/pure/create/types.d.ts +102 -3
- package/dist/types/esm/pure/esplora.d.ts +2 -0
- package/dist/types/esm/pure/evm/funding-pins.d.ts +2 -0
- package/dist/types/esm/pure/generated/api.d.ts +352 -2
- package/dist/types/esm/pure/index.d.ts +6 -4
- package/dist/types/esm/pure/refund/onchain.d.ts +4 -0
- package/dist/types/esm/pure/storage/index.d.ts +1 -1
- package/dist/types/esm/pure/storage/types.d.ts +22 -0
- package/dist/types/esm/pure/swap-verification.d.ts +3 -1
- package/dist/types/esm/pure/tokens.d.ts +5 -0
- package/dist/types/esm/pure/types/chain.d.ts +2 -2
- package/dist/types/esm/pure/types/index.d.ts +1 -0
- package/dist/types/esm/pure/types/promo-code.d.ts +15 -0
- package/dist/types/esm/pure/types/quote.d.ts +7 -0
- package/dist/types/esm/pure/types/referral-fee.d.ts +8 -0
- package/dist/types/esm/pure/version.d.ts +4 -4
- package/dist/types/esm/swap/client.d.ts +2 -0
- package/dist/types/esm/swap/contracts/bitcoin-reader-esplora.d.ts +5 -0
- package/package.json +2 -2
- package/dist/bitcoin-reader-electrum-4PNSDHIA.js +0 -9
- package/dist/bitcoin-reader-electrum-VCQ5TQ44.cjs +0 -9
- package/dist/bitcoin-reader-esplora-6RH7S4BR.cjs +0 -14
- package/dist/bitcoin-reader-esplora-6RH7S4BR.cjs.map +0 -1
- package/dist/chunk-3ZMSZSAV.js.map +0 -1
- package/dist/chunk-4NVWIR74.cjs.map +0 -1
- package/dist/chunk-5DQHR3RO.cjs.map +0 -1
- package/dist/chunk-INHFP222.cjs.map +0 -1
- package/dist/chunk-LSCRTQOS.js.map +0 -1
- package/dist/chunk-WQMAL2VD.js.map +0 -1
- package/dist/dist-MHRQ5FFV.cjs +0 -394
- /package/dist/{bitcoin-reader-electrum-4PNSDHIA.js.map → bitcoin-reader-electrum-VLYRII3T.js.map} +0 -0
- /package/dist/{bitcoin-reader-esplora-CGPF4H5Y.js.map → bitcoin-reader-esplora-LC673MQT.js.map} +0 -0
- /package/dist/{dist-SHY7I6SH.js.map → dist-3N76II5O.js.map} +0 -0
- /package/dist/{fundSwap-UBCHMUP4-WBLYE6MC.js.map → fundSwap-2D4IPYU4-CDM3WRUF.js.map} +0 -0
|
@@ -38,6 +38,7 @@ export interface Asset {
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
export declare const Asset: {
|
|
41
|
+
readonly BTC_SPARK: Asset;
|
|
41
42
|
readonly BTC_LIGHTNING: Asset;
|
|
42
43
|
readonly BTC_ARKADE: Asset;
|
|
43
44
|
readonly BTC_ONCHAIN: Asset;
|
|
@@ -192,3 +193,7 @@ export declare function getCctpBridgeTokens(): BridgeTokenInfo[];
|
|
|
192
193
|
* Excludes source chains (those already have USDT0 tokens from the backend).
|
|
193
194
|
*/
|
|
194
195
|
export declare function getUsdt0BridgeTokens(): BridgeTokenInfo[];
|
|
196
|
+
/** Bitcoin on native Spark. */
|
|
197
|
+
export declare function isSpark(token: {
|
|
198
|
+
chain: string;
|
|
199
|
+
}): boolean;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Hand-written rather than re-exported from codegen so the SDK surface stays
|
|
13
13
|
* decoupled; the union widens additively as new bridge chains land.
|
|
14
14
|
*/
|
|
15
|
-
export type Chain = "Arkade" | "Lightning" | "Bitcoin" | "Solana" | "Tron" | "1" | "137" | "42161" | "30" | "31" | "10" | "8453" | "43114" | "130" | "59144" | "146" | "480" | "143" | "1329" | "50" | "999" | "57073";
|
|
15
|
+
export type Chain = "Arkade" | "Lightning" | "Spark" | "Bitcoin" | "Solana" | "Tron" | "1" | "137" | "42161" | "30" | "31" | "10" | "8453" | "43114" | "130" | "59144" | "146" | "480" | "143" | "1329" | "50" | "999" | "57073";
|
|
16
16
|
/**
|
|
17
17
|
* The chain identifiers the **server** actually speaks on the wire — mirrors
|
|
18
18
|
* `crate::Chain` and the generated `components["schemas"]["Chain"]`. Bridge
|
|
@@ -20,4 +20,4 @@ export type Chain = "Arkade" | "Lightning" | "Bitcoin" | "Solana" | "Tron" | "1"
|
|
|
20
20
|
* carried in `bridge_target_chain`. Use this for anything sent to / received
|
|
21
21
|
* from the server; use {@link Chain} for the SDK's public surface.
|
|
22
22
|
*/
|
|
23
|
-
export type WireChain = "Arkade" | "Lightning" | "Bitcoin" | "1" | "137" | "42161" | "30" | "31";
|
|
23
|
+
export type WireChain = "Arkade" | "Lightning" | "Spark" | "Bitcoin" | "1" | "137" | "42161" | "30" | "31";
|
|
@@ -10,6 +10,7 @@ export type { Chain, WireChain } from "./chain.cjs";
|
|
|
10
10
|
export { type ChainConfigEntry, type ChainConfigResponse, fromWireChainConfigResponse, type TokenRef, type WireChainConfigResponse, } from "./chain-config.cjs";
|
|
11
11
|
export { type BridgeRate, type BridgeRouter, type DexQuoteAmount, type DexQuoteResponse, fromWireDexQuoteResponse, type Token, type TokenAmount, type WireDexQuoteResponse, } from "./dex-quote.cjs";
|
|
12
12
|
export { fromWireNetworkFeePairEntry, fromWireNetworkFeesResponse, type NetworkFee, type NetworkFeePairEntry, type NetworkFeesResponse, type WireNetworkFeesResponse, } from "./network-fees.cjs";
|
|
13
|
+
export type { AppliedPromo } from "./promo-code.cjs";
|
|
13
14
|
export { fromWireQuoteResponse, type QuoteResponse, type WireQuoteResponse, } from "./quote.cjs";
|
|
14
15
|
export { fromWireReferralFeeResponse, type ReferralFeeResponse, type WireReferralFeeResponse, } from "./referral-fee.cjs";
|
|
15
16
|
export { fromWireSwapPairsResponse, type SwapPairInfo, type SwapPairsResponse, type WireSwapPairsResponse, } from "./swap-pairs.cjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The promo code a quote was priced with, on `QuoteResponse.promo` and
|
|
3
|
+
* `ReferralFeeResponse.promo`. The quote's `protocol_fee_rate` and
|
|
4
|
+
* `max_amount` already include it.
|
|
5
|
+
*/
|
|
6
|
+
export interface AppliedPromo {
|
|
7
|
+
code: string;
|
|
8
|
+
/**
|
|
9
|
+
* The promo's base fee as a decimal fraction (`0.001` = 0.1%). The swap's
|
|
10
|
+
* base fee is the lower of it and the route's; any extra fee is added on top.
|
|
11
|
+
*/
|
|
12
|
+
fee_rate: number;
|
|
13
|
+
/** Largest swap the code applies to, in sats. Lifts the route maximum when higher. */
|
|
14
|
+
max_amount_sats: number;
|
|
15
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AppliedPromo } from "./promo-code.cjs";
|
|
1
2
|
/**
|
|
2
3
|
* `QuoteResponse` — end-to-end pricing for a swap between BTC and an
|
|
3
4
|
* EVM/Arkade/Lightning target.
|
|
@@ -57,6 +58,11 @@ export interface QuoteResponse {
|
|
|
57
58
|
* request, or for inbound CCTP swaps.
|
|
58
59
|
*/
|
|
59
60
|
bridge_fee?: number | null;
|
|
61
|
+
/**
|
|
62
|
+
* The promo code this quote was priced with, when `promoCode` was passed.
|
|
63
|
+
* `protocol_fee_rate` and `max_amount` already include it.
|
|
64
|
+
*/
|
|
65
|
+
promo?: AppliedPromo;
|
|
60
66
|
}
|
|
61
67
|
/**
|
|
62
68
|
* Wire payload shape for `GET /quote` — matches the OpenAPI-generated
|
|
@@ -75,6 +81,7 @@ export interface WireQuoteResponse {
|
|
|
75
81
|
net_source_amount: string;
|
|
76
82
|
net_target_amount: string;
|
|
77
83
|
bridge_fee?: number | null;
|
|
84
|
+
promo?: AppliedPromo | null;
|
|
78
85
|
}
|
|
79
86
|
/**
|
|
80
87
|
* Translate the wire payload into the SDK-facing type.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AppliedPromo } from "./promo-code.cjs";
|
|
1
2
|
/**
|
|
2
3
|
* `ReferralFeeResponse` — the referral / extra-fee delta for a referral code.
|
|
3
4
|
*
|
|
@@ -20,12 +21,19 @@ export interface ReferralFeeResponse {
|
|
|
20
21
|
* means the pair fee applies.
|
|
21
22
|
*/
|
|
22
23
|
base_fee_rate?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The promo, when a `promoCode` was passed. The base fee is the **lower**
|
|
26
|
+
* of its `fee_rate` and `base_fee_rate ?? fee_percentage`; `extra_fee_rate`
|
|
27
|
+
* is still added on top.
|
|
28
|
+
*/
|
|
29
|
+
promo?: AppliedPromo;
|
|
23
30
|
/** Partner label for the referral code, when registered. Informational. */
|
|
24
31
|
referral_label?: string;
|
|
25
32
|
}
|
|
26
33
|
export interface WireReferralFeeResponse {
|
|
27
34
|
extra_fee_rate: number;
|
|
28
35
|
base_fee_rate?: number | null;
|
|
36
|
+
promo?: AppliedPromo | null;
|
|
29
37
|
referral_label?: string | null;
|
|
30
38
|
}
|
|
31
39
|
export declare function fromWireReferralFeeResponse(wire: WireReferralFeeResponse): ReferralFeeResponse;
|
|
@@ -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.13.0";
|
|
3
|
+
export declare const SDK_COMMIT_HASH = "2a9d67ccaf674a45dad1053243942d6043b9c0f0";
|
|
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.31";
|
|
6
|
+
export declare const CLIENT_AGENT = "swap/1.13.0";
|
|
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";
|
|
@@ -225,6 +225,8 @@ export declare class Client {
|
|
|
225
225
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
226
226
|
createLightningToEvmSwap(...args: Parameters<LegacyClient["createLightningToEvmSwap"]>): ReturnType<LegacyClient["createLightningToEvmSwap"]>;
|
|
227
227
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
228
|
+
createSparkToEvmSwap(...args: Parameters<LegacyClient["createSparkToEvmSwap"]>): ReturnType<LegacyClient["createSparkToEvmSwap"]>;
|
|
229
|
+
/** Delegated to the legacy client (migration checkpoint). */
|
|
228
230
|
createLightningToBitcoinSwap(...args: Parameters<LegacyClient["createLightningToBitcoinSwap"]>): ReturnType<LegacyClient["createLightningToBitcoinSwap"]>;
|
|
229
231
|
/** Delegated to the legacy client (migration checkpoint). */
|
|
230
232
|
createBitcoinToLightningSwap(...args: Parameters<LegacyClient["createBitcoinToLightningSwap"]>): ReturnType<LegacyClient["createBitcoinToLightningSwap"]>;
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { BitcoinHtlcFacts } from "./bitcoin.cjs";
|
|
11
11
|
import type { BitcoinChainReader } from "./bitcoin-manager.cjs";
|
|
12
|
+
/**
|
|
13
|
+
* Most outputs a client's funding is counted from, as the server's on-chain
|
|
14
|
+
* HTLC watcher counts it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MAX_FUNDING_OUTPUTS = 2;
|
|
12
17
|
/** The slice of esplora's tx JSON we read. */
|
|
13
18
|
type EsploraTx = {
|
|
14
19
|
vin: Array<{
|
|
@@ -7,7 +7,7 @@ import type { CctpFundSwapFromSolanaResult, SolanaCctpProgressStep } from "./cct
|
|
|
7
7
|
import type { SolanaSigner } from "./cctp-inbound/solana/types.js";
|
|
8
8
|
import type { AaConfig } from "./cctp-inbound/types.js";
|
|
9
9
|
import { type ComposeQuoteParams } from "./compose-quote.js";
|
|
10
|
-
import { type ArkadeToEvmSwapOptions, type ArkadeToEvmSwapResult, type ArkadeToLightningSwapOptions, type ArkadeToLightningSwapResult, type BitcoinToArkadeSwapOptions, type BitcoinToArkadeSwapResult, type BitcoinToEvmSwapOptions, type BitcoinToEvmSwapResult, type BitcoinToLightningSwapOptions, type BitcoinToLightningSwapResult, type CreateSwapOptions, type CreateSwapResult, type EvmToArkadeSwapGenericOptions, type EvmToArkadeSwapGenericResult, type EvmToBitcoinSwapOptions, type EvmToBitcoinSwapResult, type EvmToLightningSwapOptions, type EvmToLightningSwapResult, type LightningToArkadeSwapOptions, type LightningToArkadeSwapResult, type LightningToBitcoinSwapOptions, type LightningToBitcoinSwapResult, type LightningToEvmSwapOptions, type LightningToEvmSwapResult } from "./create/index.js";
|
|
10
|
+
import { type ArkadeToEvmSwapOptions, type ArkadeToEvmSwapResult, type ArkadeToLightningSwapOptions, type ArkadeToLightningSwapResult, type BitcoinToArkadeSwapOptions, type BitcoinToArkadeSwapResult, type BitcoinToEvmSwapOptions, type BitcoinToEvmSwapResult, type BitcoinToLightningSwapOptions, type BitcoinToLightningSwapResult, type CreateSwapOptions, type CreateSwapResult, type EvmToArkadeSwapGenericOptions, type EvmToArkadeSwapGenericResult, type EvmToBitcoinSwapOptions, type EvmToBitcoinSwapResult, type EvmToLightningSwapOptions, type EvmToLightningSwapResult, type LightningToArkadeSwapOptions, type LightningToArkadeSwapResult, type LightningToBitcoinSwapOptions, type LightningToBitcoinSwapResult, type LightningToEvmSwapOptions, type LightningToEvmSwapResult, type SparkToEvmSwapOptions, type SparkToEvmSwapResult } from "./create/index.js";
|
|
11
11
|
import { type ExpectedFunding, type FundingPins } from "./evm/funding-pins.js";
|
|
12
12
|
import { type CollabRefundEvmTypedData, type Permit2SignedFundingCallData, type UnsignedPermit2FundingData } from "./evm/index.js";
|
|
13
13
|
import { type EvmSigner } from "./evm/wallet.js";
|
|
@@ -16,9 +16,9 @@ import { type ClaimGaslessResult, type ClaimResult } from "./redeem/index.js";
|
|
|
16
16
|
import { type RifRelayConfig } from "./redeem/rif-relay.js";
|
|
17
17
|
import { Signer, type SwapParams } from "./signer/index.js";
|
|
18
18
|
import { type EvmRehashRecord, type StoredSwap, type SwapStorage, type WalletStorage } from "./storage/index.js";
|
|
19
|
-
import { type Chain, type ChainConfigResponse, type DexQuoteAmount, type DexQuoteResponse, type NetworkFeesResponse, type QuoteResponse, type ReferralFeeResponse, type SwapPairsResponse, type Token } from "./types/index.js";
|
|
19
|
+
import { type AppliedPromo, type Chain, type ChainConfigResponse, type DexQuoteAmount, type DexQuoteResponse, type NetworkFeesResponse, type QuoteResponse, type ReferralFeeResponse, type SwapPairsResponse, type Token } from "./types/index.js";
|
|
20
20
|
import { type SwapStatusHandler } from "./ws.js";
|
|
21
|
-
export type { ArkadeToEvmSwapOptions, ArkadeToEvmSwapResult, ArkadeToLightningSwapOptions, ArkadeToLightningSwapResult, BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResponse, BitcoinToEvmSwapResult, BitcoinToLightningSwapOptions, BitcoinToLightningSwapResult, BtcToEvmSwapOptions, CreateSwapOptions, CreateSwapResult, EvmChain, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToBitcoinSwapOptions, EvmToBitcoinSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, LightningToBitcoinSwapOptions, LightningToBitcoinSwapResult, LightningToEvmSwapOptions, LightningToEvmSwapResponse, LightningToEvmSwapResult, UsdcBridgeParams, } from "./create/index.js";
|
|
21
|
+
export type { ArkadeToEvmSwapOptions, ArkadeToEvmSwapResult, ArkadeToLightningSwapOptions, ArkadeToLightningSwapResult, BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResponse, BitcoinToEvmSwapResult, BitcoinToLightningSwapOptions, BitcoinToLightningSwapResult, BtcToEvmSwapOptions, CreateSwapOptions, CreateSwapResult, EvmChain, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToBitcoinSwapOptions, EvmToBitcoinSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, LightningToBitcoinSwapOptions, LightningToBitcoinSwapResult, LightningToEvmSwapOptions, LightningToEvmSwapResponse, LightningToEvmSwapResult, SparkToEvmSwapOptions, SparkToEvmSwapResponse, SparkToEvmSwapResult, UsdcBridgeParams, } from "./create/index.js";
|
|
22
22
|
export { buildCollabRefundEvmDigest, buildCollabRefundEvmTypedData, buildEip2612PermitDigest, buildPermit2FundingDigest, buildRedeemCalls, buildRedeemDigest, type CollabRefundEvmDigestParams, type CollabRefundEvmTypedData, type CoordinatorCall, type Eip2612PermitParams, type ExecuteAndCreateWithPermit2Params, encodeExecuteAndCreateWithPermit2, encodeRedeemAndExecute, encodeRefundTo, PERMIT2_ADDRESS, type Permit2FundingParams, type Permit2SignedFundingCallData, type RedeemAndExecuteCallData, type RedeemAndExecuteParams, type RedeemDigestParams, type RefundToParams, } from "./evm/index.js";
|
|
23
23
|
export type { ClaimGaslessResult, ClaimResult, CoordinatorClaimData, EthereumClaimData, } from "./redeem/index.js";
|
|
24
24
|
/** A support agent's Nostr identity */
|
|
@@ -342,13 +342,18 @@ export interface ClaimOptions {
|
|
|
342
342
|
/**
|
|
343
343
|
* Bitcoin destination address for on-chain claims (evm_to_bitcoin and
|
|
344
344
|
* lightning_to_bitcoin); falls back to the address the swap was created with.
|
|
345
|
+
* Not allowed when the swap stores Bitcoin payout recipients: those are paid.
|
|
345
346
|
*/
|
|
346
347
|
destinationAddress?: string;
|
|
347
348
|
/**
|
|
348
349
|
* Fee rate in sat/vB for on-chain Bitcoin claims (default: the explorer's
|
|
349
|
-
* two-block estimate, at least 2)
|
|
350
|
+
* two-block estimate, at least 2). For a swap with stored payout recipients
|
|
351
|
+
* it must be above zero; the committed fee is raised out of surplus to meet
|
|
352
|
+
* it, up to the 100,000-sat payout fee cap.
|
|
350
353
|
*/
|
|
351
354
|
feeRateSatPerVb?: number;
|
|
355
|
+
/** Relay policy supplied by an operator when the explorer does not expose it. */
|
|
356
|
+
minimumRelayFeeRateSatPerVb?: number;
|
|
352
357
|
/**
|
|
353
358
|
* For EVM-to-Bitcoin claims: if the funding (HTLC) output has not been
|
|
354
359
|
* indexed by the block explorer yet, keep polling for up to this many
|
|
@@ -425,6 +430,13 @@ export interface GetQuoteParams {
|
|
|
425
430
|
* so the quoted fee matches what's charged.
|
|
426
431
|
*/
|
|
427
432
|
extraFees?: number;
|
|
433
|
+
/**
|
|
434
|
+
* Optional promo code. Its rate replaces the base fee, and
|
|
435
|
+
* its cap may lift the route maximum. Pass it identically on the quote
|
|
436
|
+
* and the create. Rejected (400) when unknown, expired, used up, or the
|
|
437
|
+
* swap is larger than it allows.
|
|
438
|
+
*/
|
|
439
|
+
promoCode?: string;
|
|
428
440
|
/**
|
|
429
441
|
* Optional Lightning destination (BOLT11 invoice, lightning address or
|
|
430
442
|
* LNURL) for Arkade/EVM → Lightning quotes. When set, the quote is served
|
|
@@ -497,6 +509,13 @@ export interface GetLightningSendQuoteParams {
|
|
|
497
509
|
* Must be passed identically on the corresponding createSwap.
|
|
498
510
|
*/
|
|
499
511
|
extraFees?: number;
|
|
512
|
+
/**
|
|
513
|
+
* Optional promo code. Its rate replaces the base fee, and
|
|
514
|
+
* its cap may lift the route maximum. Pass it identically on the quote
|
|
515
|
+
* and the create. Rejected (400) when unknown, expired, used up, or the
|
|
516
|
+
* swap is larger than it allows.
|
|
517
|
+
*/
|
|
518
|
+
promoCode?: string;
|
|
500
519
|
}
|
|
501
520
|
/**
|
|
502
521
|
* Exact quote for a swap paying out over Lightning. Amounts in sats unless
|
|
@@ -534,6 +553,11 @@ export interface LightningSendQuote {
|
|
|
534
553
|
* already sats.
|
|
535
554
|
*/
|
|
536
555
|
exchangeRate: string;
|
|
556
|
+
/**
|
|
557
|
+
* The promo code this quote was priced with, when `promoCode` was passed.
|
|
558
|
+
* `protocolFeeRate` and `maxAmountSats` already include it.
|
|
559
|
+
*/
|
|
560
|
+
promo?: AppliedPromo;
|
|
537
561
|
}
|
|
538
562
|
/**
|
|
539
563
|
* Default Electrum WebSocket endpoints by network — Satora's own Fulcrum for
|
|
@@ -885,8 +909,8 @@ export declare class Client {
|
|
|
885
909
|
/**
|
|
886
910
|
* Get the deterministic EVM address for this SDK key.
|
|
887
911
|
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
912
|
+
* Legacy wallet-level address. New gasless swaps use their own deposit
|
|
913
|
+
* address; read it from the swap response or getSwapDepositorKey(swapId).
|
|
890
914
|
*
|
|
891
915
|
* @returns Checksummed EVM address (0x-prefixed).
|
|
892
916
|
*/
|
|
@@ -978,6 +1002,13 @@ export declare class Client {
|
|
|
978
1002
|
getReferralFee(params: {
|
|
979
1003
|
referralCode?: string;
|
|
980
1004
|
extraFees?: number;
|
|
1005
|
+
/**
|
|
1006
|
+
* Optional promo code. Its rate replaces the base fee, and
|
|
1007
|
+
* its cap may lift the route maximum. Pass it identically on the quote
|
|
1008
|
+
* and the create. Rejected (400) when unknown, expired, used up, or the
|
|
1009
|
+
* swap is larger than it allows.
|
|
1010
|
+
*/
|
|
1011
|
+
promoCode?: string;
|
|
981
1012
|
}): Promise<ReferralFeeResponse>;
|
|
982
1013
|
/**
|
|
983
1014
|
* Per-pair network-fee estimates in sats at current gas/mining prices.
|
|
@@ -1595,6 +1626,7 @@ export declare class Client {
|
|
|
1595
1626
|
* ```
|
|
1596
1627
|
*/
|
|
1597
1628
|
createLightningToEvmSwap(options: LightningToEvmSwapOptions): Promise<LightningToEvmSwapResult>;
|
|
1629
|
+
createSparkToEvmSwap(options: SparkToEvmSwapOptions): Promise<SparkToEvmSwapResult>;
|
|
1598
1630
|
/**
|
|
1599
1631
|
* Creates a new Arkade to Lightning swap.
|
|
1600
1632
|
*
|
|
@@ -1992,10 +2024,9 @@ export declare class Client {
|
|
|
1992
2024
|
* address, an Arkade address, or for Lightning a BOLT11 invoice (its amount
|
|
1993
2025
|
* must be covered by the refund), a Lightning address or an LNURL.
|
|
1994
2026
|
* @param options.target - The payout type; defaults to the old swap's.
|
|
1995
|
-
* @param options.signer - A signer for
|
|
1996
|
-
*
|
|
1997
|
-
*
|
|
1998
|
-
* paymaster only sponsors funding from the depositor's account.
|
|
2027
|
+
* @param options.signer - A signer for the refunded deposit account. Defaults
|
|
2028
|
+
* to its SDK key. The continuation explicitly reuses that funded account
|
|
2029
|
+
* instead of allocating a new deposit address.
|
|
1999
2030
|
*/
|
|
2000
2031
|
continueRefundedEvmSwap(oldSwapId: string, options: {
|
|
2001
2032
|
targetAddress: string;
|
|
@@ -2101,14 +2132,15 @@ export declare class Client {
|
|
|
2101
2132
|
getSwapDepositorKey(swapId: string): Promise<{
|
|
2102
2133
|
privateKey: string;
|
|
2103
2134
|
address: string;
|
|
2135
|
+
keyIndex?: number;
|
|
2104
2136
|
}>;
|
|
2105
2137
|
/**
|
|
2106
2138
|
* Wallet-level variant of {@link getSwapDepositorKey} — returns the
|
|
2107
2139
|
* deterministic EVM signing key for this wallet without requiring a
|
|
2108
2140
|
* specific swap to be stored locally.
|
|
2109
2141
|
*
|
|
2110
|
-
*
|
|
2111
|
-
* per-swap
|
|
2142
|
+
* Only for legacy wallet-level deposits (`m/44'/60'/0'/0/0`).
|
|
2143
|
+
* Use getSwapDepositorKey for per-swap deposits. Intended for recovery tools
|
|
2112
2144
|
* where the user supplies the burn details manually and a per-swap
|
|
2113
2145
|
* record may no longer exist (e.g. fresh device, cleared site data).
|
|
2114
2146
|
*/
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* Foreign-target EVM↔EVM (neither side BTC) is not supported and throws
|
|
26
26
|
* `UnsupportedComposeQuotePath`.
|
|
27
27
|
*/
|
|
28
|
-
import type { Chain, ChainConfigResponse, DexQuoteResponse, NetworkFeesResponse, QuoteResponse, SwapPairsResponse, Token } from "./types/index.js";
|
|
28
|
+
import type { AppliedPromo, Chain, ChainConfigResponse, DexQuoteResponse, NetworkFeesResponse, QuoteResponse, SwapPairsResponse, Token } from "./types/index.js";
|
|
29
29
|
export declare class UnsupportedComposeQuotePath extends Error {
|
|
30
30
|
constructor(message: string);
|
|
31
31
|
}
|
|
@@ -43,6 +43,13 @@ export interface ComposeQuoteParams {
|
|
|
43
43
|
referralCode?: string;
|
|
44
44
|
/** Per-swap extra-fee surcharge (bps), capped per referral key. */
|
|
45
45
|
extraFees?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Optional promo code. Its rate replaces the base fee, and
|
|
48
|
+
* its cap may lift the route maximum. Pass it identically on the quote
|
|
49
|
+
* and the create. Rejected (400) when unknown, expired, used up, or the
|
|
50
|
+
* swap is larger than it allows.
|
|
51
|
+
*/
|
|
52
|
+
promoCode?: string;
|
|
46
53
|
/**
|
|
47
54
|
* `true` when a Solana CCTP recipient has no USDC ATA yet — folds the higher
|
|
48
55
|
* ATA-setup bridge fee. Only meaningful for Solana targets.
|
|
@@ -72,6 +79,12 @@ export interface ComposeQuoteDeps {
|
|
|
72
79
|
* added. Omitted for keys without a partner rate.
|
|
73
80
|
*/
|
|
74
81
|
referralBaseFeeRate?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Promo from `/referral-fee`. The base fee is the lower of its `fee_rate`
|
|
84
|
+
* and `referralBaseFeeRate ?? fee_percentage`, and its `max_amount_sats`
|
|
85
|
+
* lifts the pair maximum, mirroring the server's `with_promo`.
|
|
86
|
+
*/
|
|
87
|
+
referralPromo?: AppliedPromo;
|
|
75
88
|
/**
|
|
76
89
|
* DEX-leg quote primitive — `Client.getDexQuote` once bound to the
|
|
77
90
|
* underlying HTTP client.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as btc from "@scure/btc-signer";
|
|
2
|
+
import type { BitcoinPayout } from "../storage/types.js";
|
|
3
|
+
/** Upper bound for a payout claim fee, committed or raised to meet a fee rate. */
|
|
4
|
+
export declare const MAX_PAYOUT_FEE_SATS = 100000n;
|
|
5
|
+
/** Validate exact recipient commitments before signing. Duplicate addresses stay separate. */
|
|
6
|
+
export declare function validateBitcoinPayout(payout: BitcoinPayout, network: typeof btc.NETWORK): {
|
|
7
|
+
total: bigint;
|
|
8
|
+
fee: bigint;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The recipient amounts a claim of `funded` sats pays: each commitment plus a
|
|
12
|
+
* share of the surplus in proportion to it, rounding leftovers one sat each in
|
|
13
|
+
* list order. `fee` defaults to the committed fee; a claim that raises its fee
|
|
14
|
+
* to meet a fee rate pays from the surplus, so pass the actual fee to match it.
|
|
15
|
+
* Throws if the funding cannot cover the commitments and fee.
|
|
16
|
+
*/
|
|
17
|
+
export declare function allocateBitcoinPayout(payout: BitcoinPayout, funded: bigint, fee?: bigint): BitcoinPayout;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EVM to Arkade swap creation.
|
|
3
|
-
*
|
|
4
|
-
* Supports swapping tokens from Polygon, Arbitrum, or Ethereum to BTC on Arkade.
|
|
5
|
-
*/
|
|
6
1
|
import type { CreateSwapContext, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult } from "./types.js";
|
|
7
2
|
/**
|
|
8
3
|
* Creates a new EVM-to-Arkade swap via the generic endpoint.
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EVM to Lightning swap creation.
|
|
3
|
-
*
|
|
4
|
-
* The user locks an ERC-20 token on an EVM chain in an HTLCErc20 (via the
|
|
5
|
-
* coordinator) whose hash lock is the payment hash of the Lightning
|
|
6
|
-
* invoice they want paid; the server pays the invoice and claims the HTLC
|
|
7
|
-
* with the revealed preimage.
|
|
8
|
-
*/
|
|
9
1
|
import type { CreateSwapContext, EvmToLightningSwapOptions, EvmToLightningSwapResult } from "./types.js";
|
|
10
2
|
/**
|
|
11
3
|
* Creates a new EVM to Lightning swap.
|
|
@@ -6,6 +6,7 @@ import type { EvmFundingTerms } from "../evm/funding-pins.js";
|
|
|
6
6
|
* tokens and input are what every later funding payload must match.
|
|
7
7
|
*/
|
|
8
8
|
export declare function fundingTermsOf(data: {
|
|
9
|
+
client_evm_address?: string | null;
|
|
9
10
|
evm_chain_id?: number | null;
|
|
10
11
|
evm_coordinator_address?: string | null;
|
|
11
12
|
evm_htlc_address?: string | null;
|
|
@@ -18,4 +19,4 @@ export declare function fundingTermsOf(data: {
|
|
|
18
19
|
token_id?: string | null;
|
|
19
20
|
} | null;
|
|
20
21
|
evm_htlc_token?: string | null;
|
|
21
|
-
}): EvmFundingTerms | undefined;
|
|
22
|
+
}, depositor?: string): EvmFundingTerms | undefined;
|
|
@@ -20,4 +20,5 @@ export { createLightningToArkadeSwap } from "./lightning-to-arkade.js";
|
|
|
20
20
|
export { createLightningToBitcoinSwap } from "./lightning-to-bitcoin.js";
|
|
21
21
|
export { createLightningToEvmSwap } from "./lightning-to-evm.js";
|
|
22
22
|
export { DuplicateInvoiceError } from "./retry.js";
|
|
23
|
-
export
|
|
23
|
+
export { createSparkToEvmSwap } from "./spark-to-evm.js";
|
|
24
|
+
export type { ArkadeToEvmSwapOptions, ArkadeToEvmSwapResult, ArkadeToLightningSwapOptions, ArkadeToLightningSwapResult, BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResponse, BitcoinToEvmSwapResult, BitcoinToLightningSwapOptions, BitcoinToLightningSwapResult, BtcToEvmSwapOptions, CreateSwapContext, CreateSwapOptions, CreateSwapResult, EvmChain, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToBitcoinSwapOptions, EvmToBitcoinSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, LightningToArkadeSwapOptions, LightningToArkadeSwapResult, LightningToBitcoinSwapOptions, LightningToBitcoinSwapResult, LightningToEvmSwapOptions, LightningToEvmSwapResponse, LightningToEvmSwapResult, SparkToEvmSwapOptions, SparkToEvmSwapResponse, SparkToEvmSwapResult, UsdcBridgeParams, } from "./types.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as btc from "@scure/btc-signer";
|
|
2
|
+
import type { BitcoinPayout } from "../storage/types.js";
|
|
3
|
+
/** A requested payment: nominal recipient amounts, the claim fee and how far below them DEX execution may land. */
|
|
4
|
+
export interface BitcoinPaymentRequest {
|
|
5
|
+
recipients: {
|
|
6
|
+
address: string;
|
|
7
|
+
amountSats: string;
|
|
8
|
+
}[];
|
|
9
|
+
feeSats: string;
|
|
10
|
+
/** Maximum reduction per recipient, in basis points (0–100). Default 0. */
|
|
11
|
+
maxSlippageBps?: number;
|
|
12
|
+
}
|
|
13
|
+
/** The network of a Bitcoin address, so recipients can be checked against the recovery address. */
|
|
14
|
+
export declare function bitcoinNetworkOf(address: string): typeof btc.NETWORK;
|
|
15
|
+
/**
|
|
16
|
+
* Turn a payment request into the recipient commitments a claim enforces.
|
|
17
|
+
*
|
|
18
|
+
* Each recipient commits to its floor (nominal less the tolerance). The claim
|
|
19
|
+
* splits any surplus in proportion to the floors, so a payment funded at its
|
|
20
|
+
* nominal total pays roughly the nominal amounts. `minimumPayoutSats` is the
|
|
21
|
+
* floor total plus the fee: the least the server may fund the HTLC with.
|
|
22
|
+
*/
|
|
23
|
+
export declare function commitBitcoinPayment(request: BitcoinPaymentRequest, network: typeof btc.NETWORK): {
|
|
24
|
+
payout: BitcoinPayout;
|
|
25
|
+
minimumPayoutSats: bigint;
|
|
26
|
+
nominalSats: bigint;
|
|
27
|
+
};
|
|
28
|
+
/** Minimum HTLC funding for a payment request: floors plus the fee. */
|
|
29
|
+
export declare function minimumBitcoinPayout(request: BitcoinPaymentRequest, network: typeof btc.NETWORK): bigint;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CreateSwapContext, SparkToEvmSwapOptions, SparkToEvmSwapResult } from "./types.js";
|
|
2
|
+
export declare function createSparkToEvmSwap(options: SparkToEvmSwapOptions, ctx: CreateSwapContext,
|
|
3
|
+
/**
|
|
4
|
+
* The lock's claim address when it is not this swap's own key: the
|
|
5
|
+
* recipient's RIF Relay smart wallet on a chain that claims through RIF.
|
|
6
|
+
*/
|
|
7
|
+
claimingAddressOverride?: string): Promise<SparkToEvmSwapResult>;
|