@sodax/sdk 2.0.0-rc.2 → 2.0.0-rc.20

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.
Files changed (57) hide show
  1. package/README.md +12 -64
  2. package/dist/index.cjs +4900 -1452
  3. package/dist/index.d.cts +1603 -374
  4. package/dist/index.d.ts +1603 -374
  5. package/dist/index.mjs +4841 -1430
  6. package/package.json +27 -24
  7. package/ai-exported/AGENTS.md +0 -99
  8. package/ai-exported/integration/README.md +0 -41
  9. package/ai-exported/integration/ai-rules.md +0 -75
  10. package/ai-exported/integration/architecture.md +0 -519
  11. package/ai-exported/integration/chain-specifics.md +0 -189
  12. package/ai-exported/integration/features/README.md +0 -19
  13. package/ai-exported/integration/features/auxiliary-services.md +0 -189
  14. package/ai-exported/integration/features/bridge.md +0 -136
  15. package/ai-exported/integration/features/dex.md +0 -182
  16. package/ai-exported/integration/features/icx-bnusd-baln.md +0 -181
  17. package/ai-exported/integration/features/money-market.md +0 -198
  18. package/ai-exported/integration/features/staking.md +0 -166
  19. package/ai-exported/integration/features/swap.md +0 -207
  20. package/ai-exported/integration/quickstart.md +0 -213
  21. package/ai-exported/integration/recipes/README.md +0 -21
  22. package/ai-exported/integration/recipes/backend-server-init.md +0 -69
  23. package/ai-exported/integration/recipes/chain-key-narrowing.md +0 -65
  24. package/ai-exported/integration/recipes/gas-estimation.md +0 -33
  25. package/ai-exported/integration/recipes/initialize-sodax.md +0 -53
  26. package/ai-exported/integration/recipes/raw-tx-flow.md +0 -71
  27. package/ai-exported/integration/recipes/result-and-errors.md +0 -104
  28. package/ai-exported/integration/recipes/signed-tx-flow.md +0 -46
  29. package/ai-exported/integration/recipes/testing.md +0 -101
  30. package/ai-exported/integration/reference/README.md +0 -18
  31. package/ai-exported/integration/reference/chain-keys.md +0 -67
  32. package/ai-exported/integration/reference/error-codes.md +0 -165
  33. package/ai-exported/integration/reference/glossary.md +0 -32
  34. package/ai-exported/integration/reference/public-api.md +0 -138
  35. package/ai-exported/integration/reference/wallet-providers.md +0 -62
  36. package/ai-exported/migration/README.md +0 -58
  37. package/ai-exported/migration/ai-rules.md +0 -80
  38. package/ai-exported/migration/breaking-changes/architecture.md +0 -342
  39. package/ai-exported/migration/breaking-changes/result-and-errors.md +0 -363
  40. package/ai-exported/migration/breaking-changes/type-system.md +0 -321
  41. package/ai-exported/migration/checklist.md +0 -61
  42. package/ai-exported/migration/features/README.md +0 -35
  43. package/ai-exported/migration/features/auxiliary-services.md +0 -156
  44. package/ai-exported/migration/features/bridge.md +0 -125
  45. package/ai-exported/migration/features/dex.md +0 -143
  46. package/ai-exported/migration/features/icx-bnusd-baln.md +0 -151
  47. package/ai-exported/migration/features/money-market.md +0 -214
  48. package/ai-exported/migration/features/staking.md +0 -138
  49. package/ai-exported/migration/features/swap.md +0 -198
  50. package/ai-exported/migration/recipes.md +0 -288
  51. package/ai-exported/migration/reference/README.md +0 -18
  52. package/ai-exported/migration/reference/deleted-exports.md +0 -126
  53. package/ai-exported/migration/reference/error-code-crosswalk.md +0 -104
  54. package/ai-exported/migration/reference/return-shapes.md +0 -49
  55. package/ai-exported/migration/reference/sodax-config.md +0 -52
  56. package/dist/index.cjs.map +0 -1
  57. package/dist/index.mjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,21 +1,23 @@
1
- import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, HttpUrl, NearChainKey, FillData, NearRawTransaction, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, IconAddress, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, IWalletProvider, GetWalletProviderType, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, SpokeExecActionParams, FeeAmount, Hash as Hash$1, IcxTokenType, IconEoaAddress, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig } from '@sodax/types';
1
+ import { SodaxFeature, ISwapsApiV2, Result, SwapsApiConfig, SodaxLogger, GetSwapTokensResponseV2, GetSwapTokensByChainResponseV2, QuoteRequestV2, QuoteQueryV2, QuoteResponseV2, DeadlineQueryV2, DeadlineResponseV2, CreateIntentParamsV2, AllowanceCheckResponseV2, ApproveResponseV2, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusRequestV2, StatusResponseV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashRequestV2, IntentHashResponseV2, IntentPacketRequestV2, IntentPacketResponseV2, IntentExtraDataRequestV2, IntentExtraDataResponseV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateRequestV2, GasEstimateResponseV2, FeeQueryV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusQueryV2, SubmitTxStatusResponseV2, IConfigApiV1, ApiConfig, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, AnalyticsDetailLevel, AnalyticsEventPhase, AnalyticsOption, PartnerFee, SodaxConfig, SodaxOptions, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, LeverageYieldConfig, DexConfig, GetSpokeChainConfigType, SodaxDefaultConfig, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, HookKind, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, HttpUrl, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, BitcoinRawTransaction, NearChainKey, FillData, NearRawTransaction, INearWalletProvider, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveCoin, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, IconAddress, IWalletProvider, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, GetWalletProviderType, SodaxLoggerOption, SpokeExecActionParams, FeeAmount, Hash as Hash$1, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, IconEoaAddress, IcxTokenType, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig, LeverageYieldVault } from '@sodax/types';
2
2
  export * from '@sodax/types';
3
+ export { SodaxFeature } from '@sodax/types';
3
4
  import * as viem from 'viem';
4
- import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, HttpTransport, Hash, GetLogsReturnType } from 'viem';
5
- import { ClarityValue } from '@stacks/transactions';
6
- import { StacksNetwork } from '@stacks/network';
7
- import * as bitcoin from 'bitcoinjs-lib';
5
+ import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, Hash, HttpTransport, GetLogsReturnType } from 'viem';
6
+ import { StacksNetwork, ClarityValue } from '@sodax/libs/stacks/core';
7
+ import { networks, Psbt } from 'bitcoinjs-lib';
8
8
  import { JsonRpcProvider } from 'near-api-js';
9
9
  import { Transaction, TransactionResult } from '@mysten/sui/transactions';
10
10
  import { SuiClient } from '@mysten/sui/client';
11
- import { rpc, Transaction as Transaction$1, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr, Address as Address$2 } from '@stellar/stellar-sdk';
12
- import { Connection as Connection$1, TransactionInstruction, PublicKey } from '@solana/web3.js';
11
+ import { rpc, Transaction as Transaction$1, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr } from '@stellar/stellar-sdk';
12
+ import { Connection as Connection$1, PublicKey, TransactionInstruction } from '@solana/web3.js';
13
13
  import { IconService } from 'icon-sdk-js';
14
14
  import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
15
15
  import { NetworkEndpoints } from '@injectivelabs/networks';
16
- import * as anchor from '@coral-xyz/anchor';
16
+ import * as _coral_xyz_anchor from '@coral-xyz/anchor';
17
+ import { AnchorProvider, Program } from '@coral-xyz/anchor';
17
18
  import { Price, Token } from '@pancakeswap/swap-sdk-core';
18
19
  import BigNumber$1 from 'bignumber.js';
20
+ export { SwapsApiError, SwapsApiErrorCode, SwapsApiErrorContext } from '@sodax/swaps-api';
19
21
 
20
22
  /**
21
23
  * Unified error vocabulary for the SODAX SDK.
@@ -30,10 +32,14 @@ import BigNumber$1 from 'bignumber.js';
30
32
  * The closed-union type `SodaxErrorCode` is the default generic of `SodaxError<C>`, so any
31
33
  * throw with an unlisted string code is a compile error — additions go through this file.
32
34
  */
35
+
33
36
  /**
34
37
  * Reason-only error codes. Each code answers "what kind of failure was this?", not
35
38
  * "which feature?".
36
39
  *
40
+ * - `USER_REJECTED` — the connected wallet reported a user-initiated rejection of the
41
+ * signing / connection / approval prompt. Cancellation is a normal flow, not a failure per
42
+ * se — consumers branch on this code to render a "Cancelled" UI.
37
43
  * - `VALIDATION_FAILED` — a precondition / invariant tripped before any external call.
38
44
  * - `INTENT_CREATION_FAILED` — building the intent / calldata / payload failed (typically
39
45
  * in a `create*Intent` method).
@@ -53,16 +59,12 @@ import BigNumber$1 from 'bignumber.js';
53
59
  * because retry semantics differ — re-estimation is cheap, retry-on-failure is the norm).
54
60
  * - `LOOKUP_FAILED` — any other read-only on-chain query / off-chain config fetch.
55
61
  * `context.method` partitions this code (`'getStakingInfo'`, `'getBridgeableAmount'`, …).
56
- * - `EXTERNAL_API_ERROR` — an upstream API call failed (e.g. solver, backend). `context.api`
62
+ * - `EXTERNAL_API_ERROR` — an upstream API call failed (e.g. solver, backend, swaps). `context.api`
57
63
  * identifies which service.
58
64
  * - `UNKNOWN` — last-resort catch in an outer `try`. Should be extremely rare in production.
59
65
  */
60
- type SodaxErrorCode = 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'EXECUTION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'GAS_ESTIMATION_FAILED' | 'LOOKUP_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN';
61
- /**
62
- * The producing feature of a SodaxError. Required at construction so consumers /
63
- * loggers always have a feature tag.
64
- */
65
- type SodaxFeature = 'swap' | 'moneyMarket' | 'bridge' | 'staking' | 'migration' | 'dex' | 'partner' | 'recovery';
66
+ type SodaxErrorCode = 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'EXECUTION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'GAS_ESTIMATION_FAILED' | 'LOOKUP_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN';
67
+
66
68
  /**
67
69
  * Orchestration phase tag attached via `context.phase`. Canonical superset across all
68
70
  * features — all features draw from this list rather than minting their own.
@@ -108,15 +110,15 @@ type SodaxErrorContext = {
108
110
  srcChainKey?: string;
109
111
  dstChainKey?: string;
110
112
  relayCode?: RelayCode;
111
- api?: 'solver' | 'backend';
113
+ api?: 'solver' | 'backend' | 'swaps';
112
114
  method?: string;
113
115
  direction?: 'forward' | 'reverse';
114
116
  field?: string;
115
117
  reason?: string;
116
118
  [key: string]: unknown;
117
119
  };
118
- type CreateIntentErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'UNKNOWN'>;
119
- type ApproveErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'APPROVE_FAILED' | 'UNKNOWN'>;
120
+ type CreateIntentErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'UNKNOWN'>;
121
+ type ApproveErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'APPROVE_FAILED' | 'UNKNOWN'>;
120
122
  type AllowanceCheckErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'UNKNOWN'>;
121
123
  type GasEstimationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'GAS_ESTIMATION_FAILED' | 'UNKNOWN'>;
122
124
  type LookupErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
@@ -131,9 +133,9 @@ declare const GAS_ESTIMATION_CODES: ReadonlySet<GasEstimationErrorCode>;
131
133
  /** Codes any read-only lookup method can return. */
132
134
  declare const LOOKUP_CODES: ReadonlySet<LookupErrorCode>;
133
135
  /** Runtime list of all valid error codes — useful for membership checks and exhaustive switches. */
134
- declare const SODAX_ERROR_CODES: readonly ["VALIDATION_FAILED", "INTENT_CREATION_FAILED", "EXECUTION_FAILED", "TX_VERIFICATION_FAILED", "TX_SUBMIT_FAILED", "RELAY_TIMEOUT", "RELAY_FAILED", "APPROVE_FAILED", "ALLOWANCE_CHECK_FAILED", "GAS_ESTIMATION_FAILED", "LOOKUP_FAILED", "EXTERNAL_API_ERROR", "UNKNOWN"];
136
+ declare const SODAX_ERROR_CODES: readonly ["USER_REJECTED", "VALIDATION_FAILED", "INTENT_CREATION_FAILED", "EXECUTION_FAILED", "TX_VERIFICATION_FAILED", "TX_SUBMIT_FAILED", "RELAY_TIMEOUT", "RELAY_FAILED", "APPROVE_FAILED", "ALLOWANCE_CHECK_FAILED", "GAS_ESTIMATION_FAILED", "LOOKUP_FAILED", "EXTERNAL_API_ERROR", "UNKNOWN"];
135
137
  /** Runtime list of all valid feature tags. */
136
- declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery"];
138
+ declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery", "backend", "leverageYield"];
137
139
 
138
140
  /**
139
141
  * Canonical error type for the SODAX SDK.
@@ -310,12 +312,22 @@ type Ctx = Partial<SodaxErrorContext>;
310
312
  declare function lookupFailed(feature: SodaxFeature, method: string, cause: unknown, context?: Ctx): SodaxError<'LOOKUP_FAILED'>;
311
313
  /** `TX_VERIFICATION_FAILED` — spoke `verifyTxHash` returned false / threw. */
312
314
  declare function verifyFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'TX_VERIFICATION_FAILED'>;
313
- /** `INTENT_CREATION_FAILED` — spoke deposit / sendMessage / intent build failed. */
314
- declare function intentCreationFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'INTENT_CREATION_FAILED'>;
315
+ /**
316
+ * `INTENT_CREATION_FAILED` spoke deposit / sendMessage / intent build failed.
317
+ *
318
+ * Wraps the wallet-sign step. If the cause matches a wallet rejection shape, classifies as
319
+ * `USER_REJECTED` instead so consumers can branch on a single canonical "cancelled" code.
320
+ */
321
+ declare function intentCreationFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'USER_REJECTED' | 'INTENT_CREATION_FAILED'>;
315
322
  /** `EXECUTION_FAILED` — orchestrator-level catch-all. `context.action` discriminates the op. */
316
323
  declare function executionFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'EXECUTION_FAILED'>;
317
- /** `APPROVE_FAILED` — token approval call failed. */
318
- declare function approveFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'APPROVE_FAILED'>;
324
+ /**
325
+ * `APPROVE_FAILED` token approval call failed.
326
+ *
327
+ * Wraps the wallet-sign step. If the cause matches a wallet rejection shape, classifies as
328
+ * `USER_REJECTED` instead.
329
+ */
330
+ declare function approveFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'USER_REJECTED' | 'APPROVE_FAILED'>;
319
331
  /** `ALLOWANCE_CHECK_FAILED` — reading on-chain allowance failed. */
320
332
  declare function allowanceCheckFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'ALLOWANCE_CHECK_FAILED'>;
321
333
  /** `GAS_ESTIMATION_FAILED` — gas estimation call failed. */
@@ -4851,6 +4863,113 @@ declare const ProtocolIntentsAbi: readonly [{
4851
4863
  }];
4852
4864
  }];
4853
4865
  readonly stateMutability: "view";
4866
+ }, {
4867
+ readonly type: "function";
4868
+ readonly name: "cancelIntent";
4869
+ readonly inputs: readonly [{
4870
+ readonly name: "fromToken";
4871
+ readonly type: "address";
4872
+ readonly internalType: "address";
4873
+ }, {
4874
+ readonly name: "toToken";
4875
+ readonly type: "address";
4876
+ readonly internalType: "address";
4877
+ }];
4878
+ readonly outputs: readonly [];
4879
+ readonly stateMutability: "nonpayable";
4880
+ }, {
4881
+ readonly type: "function";
4882
+ readonly name: "getUserIntent";
4883
+ readonly inputs: readonly [{
4884
+ readonly name: "user";
4885
+ readonly type: "address";
4886
+ readonly internalType: "address";
4887
+ }, {
4888
+ readonly name: "fromToken";
4889
+ readonly type: "address";
4890
+ readonly internalType: "address";
4891
+ }, {
4892
+ readonly name: "toToken";
4893
+ readonly type: "address";
4894
+ readonly internalType: "address";
4895
+ }];
4896
+ readonly outputs: readonly [{
4897
+ readonly name: "intentHash";
4898
+ readonly type: "bytes32";
4899
+ readonly internalType: "bytes32";
4900
+ }];
4901
+ readonly stateMutability: "view";
4902
+ }, {
4903
+ readonly type: "function";
4904
+ readonly name: "getIntentDetails";
4905
+ readonly inputs: readonly [{
4906
+ readonly name: "intentHash";
4907
+ readonly type: "bytes32";
4908
+ readonly internalType: "bytes32";
4909
+ }];
4910
+ readonly outputs: readonly [{
4911
+ readonly name: "intent";
4912
+ readonly type: "tuple";
4913
+ readonly internalType: "struct Intents.Intent";
4914
+ readonly components: readonly [{
4915
+ readonly name: "intentId";
4916
+ readonly type: "uint256";
4917
+ readonly internalType: "uint256";
4918
+ }, {
4919
+ readonly name: "creator";
4920
+ readonly type: "address";
4921
+ readonly internalType: "address";
4922
+ }, {
4923
+ readonly name: "inputToken";
4924
+ readonly type: "address";
4925
+ readonly internalType: "address";
4926
+ }, {
4927
+ readonly name: "outputToken";
4928
+ readonly type: "address";
4929
+ readonly internalType: "address";
4930
+ }, {
4931
+ readonly name: "inputAmount";
4932
+ readonly type: "uint256";
4933
+ readonly internalType: "uint256";
4934
+ }, {
4935
+ readonly name: "minOutputAmount";
4936
+ readonly type: "uint256";
4937
+ readonly internalType: "uint256";
4938
+ }, {
4939
+ readonly name: "deadline";
4940
+ readonly type: "uint256";
4941
+ readonly internalType: "uint256";
4942
+ }, {
4943
+ readonly name: "allowPartialFill";
4944
+ readonly type: "bool";
4945
+ readonly internalType: "bool";
4946
+ }, {
4947
+ readonly name: "srcChain";
4948
+ readonly type: "uint256";
4949
+ readonly internalType: "uint256";
4950
+ }, {
4951
+ readonly name: "dstChain";
4952
+ readonly type: "uint256";
4953
+ readonly internalType: "uint256";
4954
+ }, {
4955
+ readonly name: "srcAddress";
4956
+ readonly type: "bytes";
4957
+ readonly internalType: "bytes";
4958
+ }, {
4959
+ readonly name: "dstAddress";
4960
+ readonly type: "bytes";
4961
+ readonly internalType: "bytes";
4962
+ }, {
4963
+ readonly name: "solver";
4964
+ readonly type: "address";
4965
+ readonly internalType: "address";
4966
+ }, {
4967
+ readonly name: "data";
4968
+ readonly type: "bytes";
4969
+ readonly internalType: "bytes";
4970
+ }];
4971
+ }];
4972
+ readonly stateMutability: "view";
4854
4973
  }];
4855
4974
 
4856
4975
  declare const sonicWalletFactoryAbi: readonly [{
@@ -7383,6 +7502,122 @@ type RequestOverrideConfig = {
7383
7502
  timeout?: number;
7384
7503
  headers?: Record<string, string>;
7385
7504
  };
7505
+
7506
+ /**
7507
+ * {@link ISwapsApiV2} with every method's return wrapped in `Result<T>` and an
7508
+ * optional trailing `RequestOverrideConfig`. `SwapsApiService` implements this
7509
+ * (rather than `ISwapsApiV2` directly) because it never throws — like
7510
+ * `BackendApiService`, it returns `{ ok: false }` on failure instead of
7511
+ * `Promise<T>` rejection. The mapped type keeps the class in lockstep with the
7512
+ * canonical interface: every endpoint is covered with its exact payload types.
7513
+ */
7514
+ type ResultifiedSwapsApiV2 = {
7515
+ [K in keyof ISwapsApiV2]: ISwapsApiV2[K] extends (...args: infer A) => Promise<infer R> ? (...args: [...A, config?: RequestOverrideConfig]) => Promise<Result<R>> : never;
7516
+ };
7517
+ /**
7518
+ * HTTP client for the backend **Swaps API v2** (`/swaps/*`).
7519
+ *
7520
+ * A thin adapter over the standalone `@sodax/swaps-api` package (the single source of the wire
7521
+ * client — request building, per-chain `tx` validation/transform, response schemas, HTTP + retry).
7522
+ * This service adds the SDK conventions on top: `Result<T>` (it never throws), a `SodaxLogger`,
7523
+ * `SwapsApiConfig`/`ApiConfig` resolution, and per-call `RequestOverrideConfig`.
7524
+ *
7525
+ * All public methods return `Promise<Result<T>>`. On network failure, timeout, non-2xx HTTP
7526
+ * response, or response-shape validation failure, the returned Result has `ok: false` with a
7527
+ * canonical `SodaxError<'EXTERNAL_API_ERROR'>` (`feature: 'backend'`, `context.api: 'swaps'`,
7528
+ * `context.endpoint`); the underlying `SwapsApiError` is preserved on `error.cause`.
7529
+ *
7530
+ * Per-call request overrides (base URL, timeout, headers) can be passed as the optional last
7531
+ * argument to any method via `RequestOverrideConfig`.
7532
+ *
7533
+ * Reachable on the Sodax facade as `sodax.api.swaps`.
7534
+ */
7535
+ declare class SwapsApiService implements ResultifiedSwapsApiV2 {
7536
+ private readonly config;
7537
+ private readonly headers;
7538
+ private readonly logger;
7539
+ constructor(config: SwapsApiConfig, logger?: SodaxLogger);
7540
+ /**
7541
+ * Build a `@sodax/swaps-api` client for a single call. Maps the SDK's `SwapsApiConfig`
7542
+ * (`baseURL`/`timeout`/`headers`) to the package's config (`baseUrl`/`timeout`/`headers`), layering
7543
+ * the optional per-call `RequestOverrideConfig` on top (override wins per field; headers merge).
7544
+ * `timeout` falls back to the backend-API default so a config that omits it still gets a ceiling
7545
+ * rather than an unbounded request. Constructed per call so `setHeaders` mutations and per-call
7546
+ * overrides both take effect without caching stale state.
7547
+ */
7548
+ private buildClient;
7549
+ /**
7550
+ * Run one delegated `SwapsApi` call and wrap it in `Result<T>`. A thrown `SwapsApiError`
7551
+ * (network/timeout/HTTP/parse/validation) becomes `{ ok: false }` with a canonical
7552
+ * `SodaxError<'EXTERNAL_API_ERROR'>`; the original error is kept as `cause`, and its
7553
+ * `code`/`status`/`issues` are projected into `context` so consumers can discriminate failure
7554
+ * kinds without unwrapping `cause`. Only a RESPONSE-shape validation failure is tagged
7555
+ * `reason: 'invalid_response_shape'` — a request-side validation error is a caller bug, not a
7556
+ * backend fault.
7557
+ */
7558
+ private toResult;
7559
+ /**
7560
+ * Drop the SDK-only display field `feeAmount` before an intent reaches the strict wire serializer.
7561
+ * `sodax.swaps.createIntent` returns `Intent & FeeAmount`, which is structurally assignable to the
7562
+ * wire `IntentRequestV2` and so gets passed straight into the intent-carrying endpoints; the extra
7563
+ * bigint would trip `serializeIntentRequest`. This is a no-op for an already-clean `IntentRequestV2`.
7564
+ */
7565
+ private static toWireIntent;
7566
+ /** Fetch all supported swap tokens grouped by SpokeChainKey. */
7567
+ getTokens(config?: RequestOverrideConfig): Promise<Result<GetSwapTokensResponseV2>>;
7568
+ /** Fetch supported swap tokens for a single SpokeChainKey. */
7569
+ getTokensByChain(chainKey: string, config?: RequestOverrideConfig): Promise<Result<GetSwapTokensByChainResponseV2>>;
7570
+ /**
7571
+ * Get a solver quote for a cross-chain swap. Pass `query.includeTxData = true` to also build an
7572
+ * unsigned create-intent transaction (`txData`); in that case `srcAddress`/`dstAddress` are required.
7573
+ */
7574
+ getQuote(body: QuoteRequestV2, query?: QuoteQueryV2, config?: RequestOverrideConfig): Promise<Result<QuoteResponseV2>>;
7575
+ /** Compute a swap deadline (hub timestamp + `offsetSeconds`, default 300s). */
7576
+ getDeadline(query?: DeadlineQueryV2, config?: RequestOverrideConfig): Promise<Result<DeadlineResponseV2>>;
7577
+ /** Check whether the source token allowance is already sufficient for the intent. */
7578
+ checkAllowance(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<AllowanceCheckResponseV2>>;
7579
+ /** Build an unsigned token-approval transaction for the source token. */
7580
+ approve(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<ApproveResponseV2>>;
7581
+ /** Build an unsigned create-intent transaction. */
7582
+ createIntent(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<CreateIntentResponseV2>>;
7583
+ /** Submit the broadcast intent tx to the relay. */
7584
+ submitIntent(body: SubmitIntentRequestV2, config?: RequestOverrideConfig): Promise<Result<SubmitIntentResponseV2>>;
7585
+ /** Poll the solver for intent execution status. */
7586
+ getStatus(body: StatusRequestV2, config?: RequestOverrideConfig): Promise<Result<StatusResponseV2>>;
7587
+ /** Build an unsigned cancel-intent transaction (the `intent` bigint numerics serialize to strings). */
7588
+ cancelIntent(body: CancelIntentRequestV2, config?: RequestOverrideConfig): Promise<Result<CancelIntentResponseV2>>;
7589
+ /** Compute the keccak256 hash of an Intent struct (bigint numerics serialize to strings). */
7590
+ getIntentHash(body: IntentHashRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentHashResponseV2>>;
7591
+ /** Long-poll the relayer until the fill packet lands on the destination chain. */
7592
+ getSolvedIntentPacket(body: IntentPacketRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentPacketResponseV2>>;
7593
+ /** Recover the relay extra data needed by `/swaps/intents/submit` (provide EITHER `txHash` OR `intent`). */
7594
+ getIntentSubmitTxExtraData(body: IntentExtraDataRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentExtraDataResponseV2>>;
7595
+ /** Get the on-chain fill state for an intent by its hub-chain tx hash. */
7596
+ getFilledIntent(txHash: string, config?: RequestOverrideConfig): Promise<Result<IntentStateV2>>;
7597
+ /** Look up an Intent struct by its hub-chain creation tx hash. */
7598
+ getIntent(txHash: string, config?: RequestOverrideConfig): Promise<Result<GetIntentResponseV2>>;
7599
+ /** Build an unsigned create-limit-order-intent transaction (create-intent with optional `deadline`). */
7600
+ createLimitOrderIntent(body: CreateLimitOrderParamsV2, config?: RequestOverrideConfig): Promise<Result<CreateLimitOrderResponseV2>>;
7601
+ /** Estimate gas for a raw transaction on a spoke chain (bigint `tx` numerics serialize to strings). */
7602
+ estimateGas(body: GasEstimateRequestV2, config?: RequestOverrideConfig): Promise<Result<GasEstimateResponseV2>>;
7603
+ /** Compute the partner fee for a given input amount. */
7604
+ getPartnerFee(query: FeeQueryV2, config?: RequestOverrideConfig): Promise<Result<FeeResponseV2>>;
7605
+ /** Compute the protocol (solver) fee for a given input amount. */
7606
+ getSolverFee(query: FeeQueryV2, config?: RequestOverrideConfig): Promise<Result<FeeResponseV2>>;
7607
+ /** Submit a swap transaction to be processed (relay, post-execution, etc.). Idempotent on `(txHash, srcChainKey)`. */
7608
+ submitTx(body: SubmitTxRequestV2, config?: RequestOverrideConfig): Promise<Result<SubmitTxResponseV2>>;
7609
+ /** Get the processing status of a submitted swap transaction by `(txHash, srcChainKey)`. */
7610
+ getSubmitTxStatus(query: SubmitTxStatusQueryV2, config?: RequestOverrideConfig): Promise<Result<SubmitTxStatusResponseV2>>;
7611
+ /**
7612
+ * Merge additional headers into the service's default header set. Existing
7613
+ * keys are overwritten; keys absent from `headers` are preserved. Applied to
7614
+ * every subsequent call (the delegated client is rebuilt per call).
7615
+ */
7616
+ setHeaders(headers: Record<string, string>): void;
7617
+ /** Return the base URL the service is currently pointing at. */
7618
+ getBaseURL(): string;
7619
+ }
7620
+
7386
7621
  /** Full details of a single swap intent as stored and returned by the backend. */
7387
7622
  interface IntentResponse {
7388
7623
  intentHash: string;
@@ -7394,16 +7629,16 @@ interface IntentResponse {
7394
7629
  intent: {
7395
7630
  intentId: string;
7396
7631
  creator: string;
7397
- inputToken: `0x${string}`;
7398
- outputToken: `0x${string}`;
7632
+ inputToken: string;
7633
+ outputToken: string;
7399
7634
  inputAmount: string;
7400
7635
  minOutputAmount: string;
7401
7636
  deadline: string;
7402
7637
  allowPartialFill: boolean;
7403
7638
  srcChain: number;
7404
7639
  dstChain: number;
7405
- srcAddress: `0x${string}`;
7406
- dstAddress: `0x${string}`;
7640
+ srcAddress: string;
7641
+ dstAddress: string;
7407
7642
  solver: string;
7408
7643
  data: string;
7409
7644
  };
@@ -7516,36 +7751,54 @@ interface MoneyMarketBorrowers {
7516
7751
  * - **Money market** — query per-user positions, per-reserve asset stats,
7517
7752
  * and paginated borrower/supplier lists.
7518
7753
  *
7519
- * All public methods return `Promise<Result<T>>` — they never throw. On
7520
- * network failure, timeout, or a non-2xx HTTP response the returned Result
7521
- * has `ok: false` with a descriptive `Error` in the `error` field.
7754
+ * All public methods return `Promise<Result<T>>` — they never throw. On network
7755
+ * failure, timeout, non-2xx HTTP response, or unexpected response shape the
7756
+ * returned Result has `ok: false` with a canonical `SodaxError<'EXTERNAL_API_ERROR'>`
7757
+ * (`feature: 'backend'`, `context.api: 'backend'`) in the `error` field; the
7758
+ * underlying failure is preserved on `error.cause`.
7522
7759
  *
7523
7760
  * Per-call request overrides (base URL, timeout, headers) can be passed as
7524
7761
  * the optional last argument to any method via `RequestOverrideConfig`.
7525
7762
  */
7526
- declare class BackendApiService implements IConfigApi {
7763
+ declare class BackendApiService implements IConfigApiV1 {
7764
+ readonly swaps: SwapsApiService;
7527
7765
  private readonly config;
7528
7766
  private readonly headers;
7529
- constructor(config: ApiConfig);
7530
- /**
7531
- * Execute a single HTTP request and return the parsed JSON body.
7532
- *
7533
- * Applies an `AbortController`-backed timeout (falls back to `this.config.timeout`
7534
- * when `config.timeout` is absent). Throws on non-2xx status codes or when the
7535
- * request exceeds the timeout, so callers should use {@link request} instead of
7536
- * calling this directly.
7537
- *
7538
- * @throws `Error('HTTP_REQUEST_FAILED')` on non-2xx responses.
7539
- * @throws `Error('REQUEST_TIMEOUT')` when the request exceeds the timeout.
7540
- * @throws `Error('UNKNOWN_REQUEST_ERROR')` for any other unexpected failure.
7541
- */
7542
- private makeRequest;
7767
+ private readonly logger;
7768
+ constructor(config: ApiConfig, logger?: SodaxLogger);
7543
7769
  /**
7544
7770
  * Wraps {@link makeRequest} in a `Result<T>` so all errors are captured rather
7545
7771
  * than propagated as thrown exceptions. Every public endpoint method delegates
7546
7772
  * here instead of calling `makeRequest` directly.
7547
7773
  */
7774
+ /**
7775
+ * Fold any per-call override (carried on `config` alongside `method`/`body`) over the service
7776
+ * defaults: baseURL truthy-fallback (an empty-string override defers to the default), timeout
7777
+ * nullish-fallback, headers merged (override wins per key). Mirrors the original makeRequest merge.
7778
+ */
7779
+ private resolveRequestConfig;
7780
+ /**
7781
+ * Wrap a thrown transport failure (HTTP_REQUEST_FAILED / REQUEST_TIMEOUT / network error) as the
7782
+ * canonical backend `SodaxError` — identical shape to SwapsApiService; the underlying failure is
7783
+ * preserved on `error.cause`.
7784
+ */
7785
+ private toExternalApiError;
7786
+ /**
7787
+ * Issue a request and validate the JSON body against `schema`, wrapping the result in `Result<T>`.
7788
+ * Mirrors {@link SwapsApiService}: a 2xx body that fails the schema is surfaced as
7789
+ * `EXTERNAL_API_ERROR` (`context.reason: 'invalid_response_shape'`) rather than returned untyped.
7790
+ * Every data/token/money-market method delegates here; the config/relay reads use
7791
+ * {@link requestUnvalidated} instead.
7792
+ */
7548
7793
  private request;
7794
+ /**
7795
+ * Issue a request WITHOUT response-shape validation (passthrough typing). Reserved for the
7796
+ * config/relay reads whose shapes are too large/brittle to schema-validate (`SodaxConfig` via
7797
+ * `getAllConfig`, `SpokeChainConfigMap` via `getSpokeChainConfig`) or carry `bigint` values that
7798
+ * cannot survive JSON validation (`getRelayChainIdMap`). `ConfigService` version-gates and falls
7799
+ * back to packaged defaults, so it relies on no response-shape guarantee from these endpoints.
7800
+ */
7801
+ private requestUnvalidated;
7549
7802
  /**
7550
7803
  * Fetch a swap intent by the hub-chain transaction hash that created it.
7551
7804
  *
@@ -7564,34 +7817,6 @@ declare class BackendApiService implements IConfigApi {
7564
7817
  * @returns `Result<IntentResponse>` — on success, the full intent details.
7565
7818
  */
7566
7819
  getIntentByHash(intentHash: string, config?: RequestOverrideConfig): Promise<Result<IntentResponse>>;
7567
- /**
7568
- * Submit a signed spoke-chain swap transaction to the backend for processing.
7569
- *
7570
- * The backend relays the transaction to the hub chain, posts execution data
7571
- * to the solver, and advances the intent through its lifecycle. The response
7572
- * shape is validated at runtime via a type guard; an invalid shape is
7573
- * returned as `{ ok: false }`.
7574
- *
7575
- * @param params - The signed transaction hash, source chain key, sender wallet
7576
- * address, intent data, and relay data required to process the swap.
7577
- * @returns `Result<SubmitSwapTxResponse>` — on success, a confirmation object
7578
- * with `success: true` and a human-readable `message`.
7579
- */
7580
- submitSwapTx(params: SubmitSwapTxRequest, config?: RequestOverrideConfig): Promise<Result<SubmitSwapTxResponse>>;
7581
- /**
7582
- * Poll the backend relay pipeline for the current status of a previously
7583
- * submitted swap transaction.
7584
- *
7585
- * Status progresses through: `pending` → `verifying` → `verified` →
7586
- * `relaying` → `relayed` → `posting_execution` → `executed` (or `failed`).
7587
- *
7588
- * @param params - Object containing the source-chain transaction hash and,
7589
- * optionally, the source chain key to disambiguate cross-chain hashes.
7590
- * @returns `Result<SubmitSwapTxStatusResponse>` — on success, includes the
7591
- * current `status`, any `failureReason`, and (once executed) the
7592
- * `dstIntentTxHash` on the hub chain.
7593
- */
7594
- getSubmitSwapTxStatus(params: GetSubmitSwapTxStatusParams, config?: RequestOverrideConfig): Promise<Result<SubmitSwapTxStatusResponse>>;
7595
7820
  /**
7596
7821
  * Fetch a paginated snapshot of the solver orderbook — open swap intents
7597
7822
  * that are currently waiting to be filled by the solver.
@@ -7797,6 +8022,10 @@ declare class BackendApiService implements IConfigApi {
7797
8022
  * without constructing a new service instance. Existing header keys are
7798
8023
  * overwritten; keys absent from `headers` are preserved.
7799
8024
  *
8025
+ * The headers are also fanned out to the sub-services (`swaps`), which hold
8026
+ * their own header copies — so a token set here applies to every request made
8027
+ * through this client, including `swaps.*`.
8028
+ *
7800
8029
  * @param headers - Key-value pairs to add or overwrite in the default headers.
7801
8030
  */
7802
8031
  setHeaders(headers: Record<string, string>): void;
@@ -7808,16 +8037,107 @@ declare class BackendApiService implements IConfigApi {
7808
8037
  getBaseURL(): string;
7809
8038
  }
7810
8039
 
8040
+ /**
8041
+ * Optional per-phase payload builders for {@link ResolvedAnalytics.trackResult}. Each is a lazy thunk
8042
+ * invoked only if its event actually emits, so payloads are never built when analytics is off.
8043
+ * `success` receives the resolved value, `failure` the `Result` error.
8044
+ */
8045
+ interface AnalyticsActionData<T, E> {
8046
+ start?: () => Record<string, unknown>;
8047
+ success?: (value: T) => Record<string, unknown>;
8048
+ failure?: (error: E) => Record<string, unknown>;
8049
+ }
8050
+ /**
8051
+ * The SDK-internal analytics emitter, resolved once from the consumer's {@link AnalyticsOption} and
8052
+ * held on `ConfigService` (`config.analytics`).
8053
+ *
8054
+ * Services never touch the raw config — they call {@link ResolvedAnalytics.emit}, which is the only
8055
+ * gate. When analytics is disabled, off for a feature/action, or above the configured detail level,
8056
+ * the `build` thunk is never invoked, so event payloads are never constructed on hot feature paths.
8057
+ * This is what keeps feature code free of analytics overhead unless a consumer explicitly opts in.
8058
+ */
8059
+ interface ResolvedAnalytics {
8060
+ /**
8061
+ * Whether an event for `feature`/`action` at `level` would be emitted. Call sites rarely need this
8062
+ * directly — {@link emit} checks it internally — but it is exposed for the rare case where even
8063
+ * deciding what to emit is itself costly. Omit `action` to ask whether the feature is tracked at all.
8064
+ */
8065
+ isEnabled(feature: SodaxFeature, action?: string, level?: AnalyticsDetailLevel): boolean;
8066
+ /**
8067
+ * Emit one user-action event. `build` produces the optional structured payload and is invoked
8068
+ * lazily — only when the event passes the enabled/feature/action/level gate — so disabled analytics
8069
+ * costs nothing but a boolean check at the call site. A faulty consumer tracker can never break a
8070
+ * feature flow: delivery is wrapped and fire-and-forget.
8071
+ */
8072
+ emit(feature: SodaxFeature, action: string, phase: AnalyticsEventPhase, build?: () => Record<string, unknown>, level?: AnalyticsDetailLevel): void;
8073
+ /**
8074
+ * Wrap a `Result`-returning action flow: emit `start` before `run`, then `success` or `failure`
8075
+ * from the resolved `Result` (and `failure` + rethrow if `run` throws), returning the `Result`
8076
+ * unchanged. This is the canonical way to instrument a feature method — one call at the boundary
8077
+ * covers every internal return point, so action code stays free of scattered emit calls.
8078
+ */
8079
+ trackResult<T, E>(feature: SodaxFeature, action: string, run: () => Promise<Result<T, E>>, data?: AnalyticsActionData<T, E>): Promise<Result<T, E>>;
8080
+ }
8081
+ /** Disabled emitter: every gate is closed, `build` is never called, nothing is delivered. */
8082
+ declare const noopAnalytics: ResolvedAnalytics;
8083
+ /**
8084
+ * Resolve an {@link AnalyticsOption} (a config object, `false`, or `undefined`) into a concrete
8085
+ * {@link ResolvedAnalytics}.
8086
+ *
8087
+ * Defaults to {@link noopAnalytics} so analytics is **off** unless a consumer opts in with an
8088
+ * `AnalyticsConfig`. This mirrors `resolveLogger` but with the opposite default — logging is on by
8089
+ * default, analytics is off — per issue #175 ("no needless invocations unless explicitly enabled").
8090
+ */
8091
+ declare function resolveAnalytics(option: AnalyticsOption | undefined): ResolvedAnalytics;
8092
+
7811
8093
  type ConfigServiceConstructorParams = {
7812
8094
  api: BackendApiService;
7813
8095
  config: SodaxConfig;
8096
+ /**
8097
+ * The raw user-provided config override (the `SodaxOptions` passed to `new Sodax(...)`),
8098
+ * NOT the merged result. Re-applied on top of dynamic config in {@link ConfigService.initialize} so
8099
+ * that a remote config fetch never clobbers explicit user overrides.
8100
+ */
8101
+ userConfig?: SodaxOptions;
8102
+ /**
8103
+ * Pre-resolved SDK log sink. Held outside the swappable `SodaxConfig` so a dynamic config fetch
8104
+ * in {@link ConfigService.initialize} never replaces it. Defaults to the console logger when omitted.
8105
+ */
8106
+ logger?: SodaxLogger;
8107
+ /**
8108
+ * Pre-resolved analytics emitter. Like {@link logger}, held outside the swappable `SodaxConfig` so a
8109
+ * dynamic config fetch never replaces it. Defaults to the no-op (disabled) emitter when omitted.
8110
+ */
8111
+ analytics?: ResolvedAnalytics;
8112
+ /**
8113
+ * Global partner fee (the `fee` option passed to `new Sodax(...)`). Held outside the swappable
8114
+ * `SodaxConfig` — like {@link logger} — so a dynamic config fetch never replaces it. The backend
8115
+ * never supplies it; it is purely a client-side option.
8116
+ */
8117
+ fee?: PartnerFee;
7814
8118
  };
7815
8119
  /**
7816
8120
  * ConfigApiService - Service for fetching configuration data from the backend API or fallbacking to default values
7817
8121
  */
7818
8122
  declare class ConfigService {
7819
8123
  private sodax;
7820
- private readonly api;
8124
+ /**
8125
+ * SDK log sink. Resolved once at construction and kept independent of {@link sodax} so that
8126
+ * {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.logger`.
8127
+ */
8128
+ readonly logger: SodaxLogger;
8129
+ /**
8130
+ * Analytics emitter. Resolved once at construction and kept independent of {@link sodax} so that
8131
+ * {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.analytics`;
8132
+ * disabled (no-op) unless the consumer passed an `analytics` config to `new Sodax(...)`.
8133
+ */
8134
+ readonly analytics: ResolvedAnalytics;
8135
+ /**
8136
+ * Global partner fee. Resolved once at construction and kept independent of {@link sodax} so that
8137
+ * {@link initialize}'s dynamic-config swap never clobbers it. The backend never supplies it — it is
8138
+ * a client-side option set via `new Sodax({ fee })`. Per-feature overrides live on the feature config.
8139
+ */
8140
+ readonly fee: PartnerFee | undefined;
7821
8141
  private initialized;
7822
8142
  private supportedHubAssetsSet;
7823
8143
  private supportedSodaVaultAssetsSet;
@@ -7828,7 +8148,7 @@ declare class ConfigService {
7828
8148
  private stakedATokenAddressesSet;
7829
8149
  private chainToSupportedTokenAddressMap;
7830
8150
  private hubAssetToXTokenMap;
7831
- constructor({ api, config }: ConfigServiceConstructorParams);
8151
+ constructor({ api, config, userConfig, logger, analytics, fee }: ConfigServiceConstructorParams);
7832
8152
  initialize(): Promise<Result<void>>;
7833
8153
  getChains(): GetChainsApiResponse;
7834
8154
  getSwapTokens(): GetSwapTokensApiResponse;
@@ -7839,6 +8159,14 @@ declare class ConfigService {
7839
8159
  getMoneyMarketReserveAssets(): GetMoneyMarketReserveAssetsApiResponse;
7840
8160
  isValidOriginalAssetAddress(chainId: SpokeChainKey, asset: OriginalAssetAddress): boolean;
7841
8161
  getOriginalAssetAddress(chainId: SpokeChainKey, hubAsset: Address): OriginalAssetAddress | undefined;
8162
+ /**
8163
+ * Resolves the {@link XToken} descriptor (hub asset, vault, decimals) for a hub-asset address.
8164
+ *
8165
+ * Useful when a caller holds a hub asset directly on Sonic that has no spoke-token entry under
8166
+ * the hub chain — e.g. a partner BTC fee held as the BTC hub asset, which only exists as a spoke
8167
+ * token on Bitcoin. Returns `undefined` when the address is not a known hub asset.
8168
+ */
8169
+ getXTokenFromHubAsset(hubAsset: string): XToken | undefined;
7842
8170
  getSpokeTokenFromOriginalAssetAddress(chainId: SpokeChainKey, originalAssetAddress: OriginalAssetAddress): XToken | undefined;
7843
8171
  isValidHubAsset(hubAsset: Address): boolean;
7844
8172
  /**
@@ -7881,6 +8209,11 @@ declare class ConfigService {
7881
8209
  get swaps(): SwapsConfig;
7882
8210
  get bridge(): BridgeConfig;
7883
8211
  get moneyMarket(): MoneyMarketConfig;
8212
+ get leverageYield(): LeverageYieldConfig;
8213
+ get swapPartnerFee(): PartnerFee | undefined;
8214
+ get moneyMarketPartnerFee(): PartnerFee | undefined;
8215
+ get bridgePartnerFee(): PartnerFee | undefined;
8216
+ get leverageYieldPartnerFee(): PartnerFee | undefined;
7884
8217
  get dex(): DexConfig;
7885
8218
  getChainConfig<K extends SpokeChainKey>(key: K): GetSpokeChainConfigType<K>;
7886
8219
  get sodaxConfig(): SodaxConfig;
@@ -7893,6 +8226,27 @@ declare class ConfigService {
7893
8226
  */
7894
8227
  declare function parseTokenArrayFromJson(input: unknown): readonly XToken[];
7895
8228
 
8229
+ /**
8230
+ * Layers a user SodaxOptions override on top of a full base config (the static default in the
8231
+ * Sodax constructor, or the dynamic config in {@link ConfigService.initialize}).
8232
+ *
8233
+ * Every field is deep-merged, so a user can override `api.timeout` without dropping the sibling `api.baseURL`,
8234
+ * and can set a per-feature `partnerFee` (`swaps` / `moneyMarket` / `bridge` / `leverageYield`) without
8235
+ * disturbing that feature's other defaults. A per-feature `partnerFee` is never present on the base config —
8236
+ * it is a `SodaxOptions`/feature-options field, not part of `SodaxDefaultConfig` or the backend dynamic
8237
+ * config, so it never travels on the wire. Every fee override therefore lands on an empty slot and a complete
8238
+ * `PartnerFee` is written wholesale; there is no base variant to merge against, so no partial-variant hybrid
8239
+ * (`{address, amount, percentage}`) can arise. `PartnerFee` is a discriminated union and downstream
8240
+ * discrimination treats any object with a bigint `amount` as the amount variant (see `isPartnerFeeAmount` /
8241
+ * `calculateFeeAmount`), which is exactly why a fee override must be a complete `PartnerFee`, not a partial.
8242
+ *
8243
+ * The global `fee` is NOT merged here: it is a `SodaxOptions` client option (like `logger`), resolved once
8244
+ * and held on `ConfigService.fee`, where it acts as the per-feature fee fallback (`featureFee ?? fee`, via
8245
+ * `ConfigService.swapPartnerFee` / `moneyMarketPartnerFee` / `bridgePartnerFee`). Config merging and
8246
+ * effective-fee resolution are separate concerns, so the merge layer deliberately leaves `fee` alone.
8247
+ */
8248
+ declare function mergeSodaxConfig(base: SodaxDefaultConfig, override: SodaxOptions): SodaxConfig;
8249
+
7896
8250
  /**
7897
8251
  * ABI-encode an array of ContractCall objects.
7898
8252
  * @param calls An array of ContractCall objects.
@@ -8059,6 +8413,8 @@ type OptionalSkipSimulation$1 = {
8059
8413
  };
8060
8414
  type DepositParams<C extends SpokeChainKey, Raw extends boolean = boolean> = {
8061
8415
  srcAddress: GetAddressType<C>;
8416
+ srcPublicKey?: string;
8417
+ accessToken?: string;
8062
8418
  srcChainKey: C;
8063
8419
  to: HubAddress;
8064
8420
  token: GetTokenAddressType<C>;
@@ -8172,6 +8528,17 @@ type RawDestinationParams = {
8172
8528
  dstAddress: string;
8173
8529
  };
8174
8530
 
8531
+ /**
8532
+ * High-level request for routing an intent's output through a deployed delivery hook. Pick a hook by
8533
+ * its {@link HookKind}; the SDK resolves the hook's deployed address and encodes the payload it expects
8534
+ * (so address and codec can never drift). The recipient is taken from the intent's `dstAddress`.
8535
+ *
8536
+ * Prefer this over setting {@link CreateIntentParams.deliveryData} + `dstAddress` by hand — those remain
8537
+ * available as a low-level escape hatch for hooks not yet in the registry.
8538
+ */
8539
+ type HookRequest = {
8540
+ kind: typeof HookKind.HYPERCORE_DEPOSIT;
8541
+ };
8175
8542
  type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
8176
8543
  inputToken: string;
8177
8544
  outputToken: string;
@@ -8185,6 +8552,21 @@ type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
8185
8552
  dstAddress: string;
8186
8553
  solver?: Address;
8187
8554
  data: Hex;
8555
+ /**
8556
+ * High-level delivery-hook selector. When set, the SDK routes the output through the chosen hook:
8557
+ * it overrides `dstAddress` with the hook's deployed address and encodes `deliveryData` from this
8558
+ * request (the recipient is the `dstAddress` you supply). This is the preferred way to use hooks —
8559
+ * the hook address and its payload codec come from the registry, so they can never drift.
8560
+ */
8561
+ hook?: HookRequest;
8562
+ /**
8563
+ * Low-level delivery payload forwarded with the output transfer — an escape hatch for hooks not in
8564
+ * the registry. On arrival at the destination spoke, `SpokeAssetManager` calls
8565
+ * `ISpokeReceiver(dstAddress).hook(token, amount, deliveryData)`. Opaque bytes whose schema is
8566
+ * defined by the destination receiver; when set, you must also point `dstAddress` at that receiver.
8567
+ * Prefer {@link hook} when the target is a registered hook. Ignored when {@link hook} is set.
8568
+ */
8569
+ deliveryData?: Hex;
8188
8570
  };
8189
8571
  /**
8190
8572
  * Parameters for creating a limit order intent.
@@ -8193,6 +8575,29 @@ type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
8193
8575
  type CreateLimitOrderParams<K extends SpokeChainKey = SpokeChainKey> = Omit<CreateIntentParams<K>, 'deadline'> & {
8194
8576
  deadline?: bigint;
8195
8577
  };
8578
+ type SrcPublicKeySlot<K extends SpokeChainKey> = GetChainType<K> extends 'STACKS' ? {
8579
+ srcPublicKey?: string;
8580
+ } : {
8581
+ srcPublicKey?: never;
8582
+ };
8583
+ /** Bound Exchange (Radfi) inputs for raw Bitcoin TRADING-mode swap intents. */
8584
+ type BitcoinBoundExtras = {
8585
+ /** Bound token, for raw Bitcoin TRADING callers; falls back to the RadfiProvider instance token when omitted. */
8586
+ accessToken?: string;
8587
+ };
8588
+ type BitcoinBoundSlot<K extends SpokeChainKey> = GetChainType<K> extends 'BITCOIN' ? {
8589
+ bound?: BitcoinBoundExtras;
8590
+ } : {
8591
+ bound?: never;
8592
+ };
8593
+ /**
8594
+ * Per-action extras for swap intent creation, supplied via the `extras` slot of the swap
8595
+ * action params.
8596
+ */
8597
+ type SwapExtras<K extends SpokeChainKey = SpokeChainKey> = {
8598
+ /** Overrides the configured swap partner fee for this action; falls back to config when omitted. */
8599
+ partnerFee?: PartnerFee;
8600
+ } & SrcPublicKeySlot<K> & BitcoinBoundSlot<K>;
8196
8601
  type Intent = {
8197
8602
  intentId: bigint;
8198
8603
  creator: Address;
@@ -8210,7 +8615,10 @@ type Intent = {
8210
8615
  data: Hex;
8211
8616
  };
8212
8617
  declare enum IntentDataType {
8213
- FEE = 1
8618
+ ARRAY = 0,
8619
+ FEE = 1,
8620
+ HOOK = 2,
8621
+ DELIVERY = 3
8214
8622
  }
8215
8623
  type FeeData = {
8216
8624
  fee: bigint;
@@ -8227,22 +8635,6 @@ type IntentState = {
8227
8635
  pendingPayment: boolean;
8228
8636
  };
8229
8637
 
8230
- type SonicSpokeDepositParams<Raw extends boolean> = {
8231
- srcAddress: Address$1;
8232
- srcChainKey: SonicChainKey;
8233
- to: HubAddress;
8234
- token: Address$1;
8235
- amount: bigint;
8236
- data: Hex;
8237
- } & WalletProviderSlot<SonicChainKey, Raw>;
8238
- type SonicDepositParams = {
8239
- srcAddress: Address$1;
8240
- srcChainKey: SonicChainKey;
8241
- to: HubAddress;
8242
- token: Address$1;
8243
- amount: bigint;
8244
- data: Hex;
8245
- };
8246
8638
  type WithdrawInfo = {
8247
8639
  aTokenAddress: Address$1;
8248
8640
  aTokenAmount: bigint;
@@ -8267,15 +8659,9 @@ type CreateSonicSwapIntentParams<Raw extends boolean> = {
8267
8659
  chainConfig: HubConfig;
8268
8660
  };
8269
8661
  } & WalletProviderSlot<SonicChainKey, Raw>;
8270
- type ApproveSonicWithdrawParams<Raw extends boolean> = {
8271
- srcAddress: Address$1;
8272
- srcChainKey: SonicChainKey;
8273
- from: Address$1;
8274
- withdrawInfo: WithdrawInfo;
8275
- } & WalletProviderSlot<SonicChainKey, Raw>;
8276
8662
  declare class SonicSpokeService {
8277
8663
  private readonly config;
8278
- readonly publicClient: PublicClient<HttpTransport>;
8664
+ readonly publicClient: PublicClient;
8279
8665
  private readonly pollingIntervalMs;
8280
8666
  private readonly maxTimeoutMs;
8281
8667
  constructor(config: ConfigService);
@@ -8316,7 +8702,7 @@ declare class SonicSpokeService {
8316
8702
  getUserRouter(params: GetUserRouterParams): Promise<HubAddress>;
8317
8703
  /**
8318
8704
  * Deposit tokens to the spoke chain using the Sonic wallet abstraction.
8319
- * @param {SonicSpokeDepositParams<Raw>} params - The parameters for the deposit
8705
+ * @param {DepositParams<SonicChainKey, Raw>} params - The parameters for the deposit
8320
8706
  * @returns {Promise<TxReturnType<SonicChainKey, Raw>>} A promise that resolves to the transaction hash
8321
8707
  */
8322
8708
  deposit<Raw extends boolean>(params: DepositParams<SonicChainKey, Raw>): Promise<TxReturnType<SonicChainKey, Raw>>;
@@ -8340,11 +8726,11 @@ type EvmHubProviderConstructorParams = {
8340
8726
  config: ConfigService;
8341
8727
  };
8342
8728
  declare class EvmHubProvider {
8343
- readonly publicClient: PublicClient<HttpTransport>;
8729
+ readonly publicClient: PublicClient;
8344
8730
  readonly chainConfig: HubConfig;
8345
8731
  readonly config: ConfigService;
8346
8732
  readonly service: SonicSpokeService;
8347
- readonly hubAddressMap: Map<`${string}:0xa86a.avax` | `${string}:0xa4b1.arbitrum` | `${string}:0x2105.base` | `${string}:0x38.bsc` | `${string}:injective-1` | `${string}:sonic` | `${string}:0x1.icon` | `${string}:sui` | `${string}:0xa.optimism` | `${string}:0x89.polygon` | `${string}:solana` | `${string}:stellar` | `${string}:hyper` | `${string}:lightlink` | `${string}:near` | `${string}:ethereum` | `${string}:bitcoin` | `${string}:redbelly` | `${string}:0x2019.kaia` | `${string}:stacks`, `0x${string}`>;
8733
+ readonly hubAddressMap: Map<`${string}:0xa86a.avax` | `${string}:0xa4b1.arbitrum` | `${string}:0x2105.base` | `${string}:0x38.bsc` | `${string}:injective-1` | `${string}:sonic` | `${string}:0x1.icon` | `${string}:sui` | `${string}:0xa.optimism` | `${string}:0x89.polygon` | `${string}:solana` | `${string}:stellar` | `${string}:hyper` | `${string}:lightlink` | `${string}:near` | `${string}:ethereum` | `${string}:bitcoin` | `${string}:redbelly` | `${string}:0x2019.kaia` | `${string}:stacks` | `${string}:hedera`, `0x${string}`>;
8348
8734
  constructor({ config }: EvmHubProviderConstructorParams);
8349
8735
  /**
8350
8736
  * Gets the cached user's hub wallet address for a spoke chain address.
@@ -8434,10 +8820,10 @@ declare class EvmVaultTokenService {
8434
8820
  * Fetches token information for a specific token in the vault.
8435
8821
  * @param vault - The address of the vault.
8436
8822
  * @param token - The address of the token.
8437
- * @param publicClient - PublicClient<HttpTransport>
8823
+ * @param publicClient - PublicClient
8438
8824
  * @returns Token information as a TokenInfo object.
8439
8825
  */
8440
- static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient<HttpTransport>): Promise<TokenInfo>;
8826
+ static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient): Promise<TokenInfo>;
8441
8827
  /**
8442
8828
  * Fetches token information for a list of tokens in a vault using a multicall.
8443
8829
  * @param vault - The address of the vault contract.
@@ -8445,21 +8831,21 @@ declare class EvmVaultTokenService {
8445
8831
  * @param publicClient - The Viem PublicClient instance used to interact with the blockchain.
8446
8832
  * @returns A promise that resolves to an array of TokenInfo objects, one for each provided token.
8447
8833
  */
8448
- static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient<HttpTransport>): Promise<TokenInfo[]>;
8834
+ static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient): Promise<TokenInfo[]>;
8449
8835
  /**
8450
8836
  * Retrieves the reserves of the vault.
8451
8837
  * @param vault - The address of the vault.
8452
- * @param publicClient - PublicClient<HttpTransport>
8838
+ * @param publicClient - PublicClient
8453
8839
  * @returns An object containing tokens and their balances.
8454
8840
  */
8455
- static getVaultReserves(vault: Address$1, publicClient: PublicClient<HttpTransport>): Promise<VaultReserves>;
8841
+ static getVaultReserves(vault: Address$1, publicClient: PublicClient): Promise<VaultReserves>;
8456
8842
  /**
8457
8843
  * Retrieves all token information for the vault.
8458
8844
  * @param vault - The address of the vault.
8459
- * @param publicClient - PublicClient<HttpTransport>
8845
+ * @param publicClient - PublicClient
8460
8846
  * @returns A promise that resolves to an object containing tokens, their infos, and reserves.
8461
8847
  */
8462
- static getAllTokenInfo(vault: Address$1, publicClient: PublicClient<HttpTransport>): Promise<{
8848
+ static getAllTokenInfo(vault: Address$1, publicClient: PublicClient): Promise<{
8463
8849
  tokens: readonly Address$1[];
8464
8850
  infos: readonly TokenInfo[];
8465
8851
  reserves: readonly bigint[];
@@ -8621,41 +9007,148 @@ declare class StacksSpokeService {
8621
9007
  waitForTransactionReceipt(params: WaitForTxReceiptParams<StacksChainKey>): Promise<Result<WaitForTxReceiptReturnType<StacksChainKey>>>;
8622
9008
  }
8623
9009
 
8624
- /**
8625
- * Raw error body shape returned by the Radfi HTTP API on non-2xx responses.
8626
- * The human-readable detail typically lives at `error.details` (nested), with
8627
- * `code` carrying a Radfi-specific identifier (e.g. "2002" insufficientBTCBalance,
8628
- * "4008" duplicatedPubKey) and `message` an i18n key.
8629
- */
8630
- type RadfiErrorBody = {
8631
- code?: string;
8632
- message?: string;
8633
- details?: string;
8634
- error?: {
8635
- details?: string;
8636
- message?: string;
8637
- };
9010
+ type RelayExtraData = {
9011
+ address: Hex;
9012
+ payload: Hex;
8638
9013
  };
8639
9014
  /**
8640
- * Structured error from a Radfi HTTP request. Exposes `status` (HTTP), `code`
8641
- * (Radfi-specific identifier), and `details` (human-readable) so callers can
8642
- * discriminate without fragile string-matching on `message`. The raw response
8643
- * body is preserved on `cause` for structured logging.
9015
+ * Signed Bitcoin on-demand payload (money-market borrow/withdraw) carried in the relay submit
9016
+ * `data` as a JSON object not a stringified JSON. There is no broadcast tx for these.
9017
+ * `public_key` is the signer's public key, required by the relay to verify a BIP-322 signature
9018
+ * (BIP-322 is not public-key-recoverable, unlike BIP-137).
8644
9019
  */
8645
- declare class RadfiApiError extends Error {
8646
- readonly status: number;
8647
- readonly code?: string;
8648
- readonly details?: string;
8649
- readonly cause?: unknown;
8650
- constructor(status: number, body: RadfiErrorBody, fallback: string);
8651
- }
8652
- type RadfiTradingWallet = {
8653
- tradingAddress: string;
8654
- userAddress: string;
8655
- userPublicKey: string;
9020
+ type OnDemandRelayData = {
9021
+ payload_hex: string;
9022
+ signature?: string;
9023
+ public_key?: string;
8656
9024
  };
8657
- type RadfiAuthResult = {
8658
- accessToken: string;
9025
+ type IntentDeliveryInfo = {
9026
+ srcChainKey: SpokeChainKey;
9027
+ srcTxHash: string;
9028
+ srcAddress: string;
9029
+ dstChainKey: SpokeChainKey;
9030
+ dstTxHash: string;
9031
+ dstAddress: string;
9032
+ };
9033
+ type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
9034
+ type PacketData = {
9035
+ src_chain_id: number;
9036
+ src_tx_hash: string;
9037
+ src_address: string;
9038
+ status: RelayTxStatus;
9039
+ dst_chain_id: number;
9040
+ conn_sn: number;
9041
+ dst_address: string;
9042
+ dst_tx_hash: string;
9043
+ signatures: string[];
9044
+ payload: string;
9045
+ };
9046
+ type WaitUntilIntentExecutedPayload = {
9047
+ intentRelayChainId: string;
9048
+ srcTxHash: string;
9049
+ timeout?: number;
9050
+ apiUrl: HttpUrl;
9051
+ /**
9052
+ * Disambiguates when a single src tx emits multiple relay packets. Receives the candidates
9053
+ * already filtered by `srcTxHash` and returns the desired one (or undefined to keep polling).
9054
+ * Defaults to "first candidate" — the legacy behavior for single-packet flows.
9055
+ */
9056
+ selectPacket?: (packets: PacketData[]) => PacketData | undefined;
9057
+ };
9058
+ type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
9059
+ type IntentRelayRequest<T extends RelayAction> = {
9060
+ action: T;
9061
+ params: T extends 'submit' ? {
9062
+ chain_id: string;
9063
+ tx_hash: string;
9064
+ data?: RelayExtraData | OnDemandRelayData;
9065
+ } : T extends 'get_transaction_packets' ? {
9066
+ chain_id: string;
9067
+ tx_hash: string;
9068
+ } : T extends 'get_packet' ? {
9069
+ chain_id: string;
9070
+ tx_hash: string;
9071
+ conn_sn: string;
9072
+ } : never;
9073
+ };
9074
+
9075
+ /**
9076
+ * Types derived from Core SDK specific types
9077
+ * NOTE: common (non Core SDK specific) types should be put in @sodax/types package
9078
+ */
9079
+ type HubProvider = EvmHubProvider;
9080
+ type RateLimitConfig = {
9081
+ maxAvailable: number;
9082
+ ratePerSecond: number;
9083
+ available: number;
9084
+ };
9085
+ /**
9086
+ * Structural types
9087
+ */
9088
+ type OptionalRaw<R extends boolean> = {
9089
+ raw?: R;
9090
+ };
9091
+ type OptionalSkipSimulation = {
9092
+ skipSimulation?: boolean;
9093
+ };
9094
+ type OptionalTimeout = {
9095
+ timeout?: number;
9096
+ };
9097
+ type TxHashPair = {
9098
+ srcChainTxHash: string;
9099
+ dstChainTxHash: string;
9100
+ };
9101
+ type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
9102
+ tx: TxReturnType<K, Raw>;
9103
+ relayData: RelayExtraData;
9104
+ };
9105
+
9106
+ type DestinationParamsType = RawDestinationParams;
9107
+
9108
+ /**
9109
+ * Raw error body shape returned by the Bound Exchange HTTP API on non-2xx responses.
9110
+ * The human-readable detail typically lives at `error.details` (nested), with
9111
+ * `code` carrying a Bound Exchange-specific identifier (e.g. "2002" insufficientBTCBalance,
9112
+ * "4008" duplicatedPubKey) and `message` an i18n key.
9113
+ */
9114
+ type RadfiErrorBody = {
9115
+ code?: string;
9116
+ message?: string;
9117
+ details?: string;
9118
+ error?: {
9119
+ details?: string;
9120
+ message?: string;
9121
+ };
9122
+ };
9123
+ /**
9124
+ * Shape of a parsed Bound Exchange JSON response: the {@link RadfiErrorBody} envelope fields plus an
9125
+ * optional, per-call typed `data` payload. Modeled as a superset of `RadfiErrorBody` so a parsed body
9126
+ * can be handed straight to {@link RadfiApiError} on the error path. `data` is optional because Bound
9127
+ * can answer 2xx with a logical-error envelope (no `data`); callers guard before dereferencing it.
9128
+ */
9129
+ type RadfiResponseEnvelope<T = unknown> = RadfiErrorBody & {
9130
+ data?: T;
9131
+ };
9132
+ /**
9133
+ * Structured error from a Bound Exchange HTTP request. Exposes `status` (HTTP), `code`
9134
+ * (Bound Exchange-specific identifier), and `details` (human-readable) so callers can
9135
+ * discriminate without fragile string-matching on `message`. The raw response
9136
+ * body is preserved on `cause` for structured logging.
9137
+ */
9138
+ declare class RadfiApiError extends Error {
9139
+ readonly status: number;
9140
+ readonly code?: string;
9141
+ readonly details?: string;
9142
+ readonly cause?: unknown;
9143
+ constructor(status: number, body: RadfiErrorBody, fallback: string);
9144
+ }
9145
+ type RadfiTradingWallet = {
9146
+ tradingAddress: string;
9147
+ userAddress: string;
9148
+ userPublicKey: string;
9149
+ };
9150
+ type RadfiAuthResult = {
9151
+ accessToken: string;
8659
9152
  refreshToken: string;
8660
9153
  tradingAddress: string;
8661
9154
  };
@@ -8713,7 +9206,7 @@ declare class RadfiProvider {
8713
9206
  refreshToken: string;
8714
9207
  constructor(config: RadfiConfig);
8715
9208
  /**
8716
- * Authenticate with Radfi: BIP322-sign a login message, then call the Radfi API.
9209
+ * Authenticate with Bound Exchange: BIP322-sign a login message, then call the Bound Exchange API.
8717
9210
  * Returns accessToken, refreshToken, and tradingAddress.
8718
9211
  */
8719
9212
  authenticateWithWallet(walletProvider: IBitcoinWalletProvider, cachedPublicKey?: string): Promise<{
@@ -8723,8 +9216,8 @@ declare class RadfiProvider {
8723
9216
  publicKey: string;
8724
9217
  }>;
8725
9218
  /**
8726
- * Ensure a valid Radfi access token is set on this provider.
8727
- * If a token exists, validates it via the Radfi API.
9219
+ * Ensure a valid Bound Exchange access token is set on this provider.
9220
+ * If a token exists, validates it via the Bound Exchange API.
8728
9221
  * If invalid, tries refreshing with the refresh token first.
8729
9222
  * If refresh also fails, falls back to full re-authentication (BIP322 sign).
8730
9223
  */
@@ -8744,7 +9237,7 @@ declare class RadfiProvider {
8744
9237
  walletAddress: string;
8745
9238
  publicKey: string;
8746
9239
  }, accessToken: string): Promise<RadfiTradingWallet>;
8747
- getTradingWallet(userAddress: string, accessToken?: string): Promise<RadfiTradingWallet>;
9240
+ getTradingWallet(userAddress: string): Promise<RadfiTradingWallet>;
8748
9241
  getBalance(address: string): Promise<RadfiWalletBalance>;
8749
9242
  checkIfTradingWalletExists(userAddress: string): Promise<boolean>;
8750
9243
  createWithdrawTransaction(params: {
@@ -8754,9 +9247,18 @@ declare class RadfiProvider {
8754
9247
  userAddress: string;
8755
9248
  data: string;
8756
9249
  }, accessToken: string): Promise<RadfiDepositTxResponse>;
9250
+ /**
9251
+ * Co-sign and broadcast a `sodax-withdraw` deposit via the Bound Exchange API.
9252
+ *
9253
+ * `relayData` ({ address, payload }) is the same `RelayExtraData` the SDK returns from
9254
+ * `createIntent()` / money-market supply etc. It is optional and non-breaking: when supplied,
9255
+ * the Bound Exchange backend persists it so it can auto-resubmit the intent relay if the relay
9256
+ * gets stuck (otherwise a stuck relay eventually refunds instead of completing the swap).
9257
+ */
8757
9258
  requestRadfiSignature(params: {
8758
9259
  userAddress: string;
8759
9260
  signedBase64Tx: string;
9261
+ relayData?: RelayExtraData;
8760
9262
  }, accessToken: string): Promise<string>;
8761
9263
  /**
8762
9264
  * Fetch expired (or near-expiry) UTXOs for a trading wallet address from UMS API.
@@ -8766,7 +9268,7 @@ declare class RadfiProvider {
8766
9268
  pageSize?: number;
8767
9269
  }): Promise<RadfiUtxoListResponse>;
8768
9270
  /**
8769
- * Build a renew-utxo transaction via the Radfi API.
9271
+ * Build a renew-utxo transaction via the Bound Exchange API.
8770
9272
  * Returns a PSBT that needs to be signed by the user.
8771
9273
  */
8772
9274
  buildRenewUtxoTransaction(params: {
@@ -8774,8 +9276,8 @@ declare class RadfiProvider {
8774
9276
  txIdVouts: string[];
8775
9277
  }, accessToken: string): Promise<RadfiBuildTxResponse>;
8776
9278
  /**
8777
- * Sign and broadcast a renew-utxo transaction via the Radfi API.
8778
- * The user signs the PSBT first, then Radfi co-signs and broadcasts.
9279
+ * Sign and broadcast a renew-utxo transaction via the Bound Exchange API.
9280
+ * The user signs the PSBT first, then Bound Exchange co-signs and broadcasts.
8779
9281
  */
8780
9282
  signAndBroadcastRenewUtxo(params: {
8781
9283
  userAddress: string;
@@ -8792,7 +9294,7 @@ declare class RadfiProvider {
8792
9294
  withdrawTo: string;
8793
9295
  }, accessToken: string): Promise<RadfiBuildTxResponse>;
8794
9296
  /**
8795
- * Sign and broadcast a withdraw transaction via Radfi.
9297
+ * Sign and broadcast a withdraw transaction via Bound Exchange.
8796
9298
  */
8797
9299
  signAndBroadcastWithdraw(params: {
8798
9300
  userAddress: string;
@@ -8807,6 +9309,27 @@ declare class RadfiProvider {
8807
9309
  tokenId: string;
8808
9310
  withdrawTo: string;
8809
9311
  }, accessToken: string): Promise<RadfiMaxSpentResponse>;
9312
+ /**
9313
+ * Resolve the bearer credential for an authenticated Bound Exchange call, failing fast when none
9314
+ * is available. A server-side raw-build caller that never ran the interactive sign-in would
9315
+ * otherwise send `Authorization: Bearer ` (empty) and get an opaque 403 from Bound's gateway;
9316
+ * throwing here turns that into an actionable client-side error naming the fix. We deliberately do
9317
+ * NOT validate the token's contents (expiry / scope / signature) — only Bound can, and an invalid
9318
+ * token still surfaces as a legible 401/403 via `parseJsonBody`.
9319
+ */
9320
+ private resolveAuth;
9321
+ /**
9322
+ * Parse a Bound Exchange response body as JSON defensively.
9323
+ *
9324
+ * Bound (or an upstream gateway / WAF / CDN) can answer a request with an HTML error page
9325
+ * instead of JSON — e.g. an unauthenticated call, a blocked origin, a 404, or a 5xx. Calling
9326
+ * `res.json()` on that throws a cryptic `SyntaxError: Unexpected token '<'` that masks the real
9327
+ * HTTP status and bubbles up as an opaque failure (it surfaced as a `createIntent` /
9328
+ * `INTENT_CREATION_FAILED` "is not valid JSON" error on the Bitcoin raw-tx path). Reading the
9329
+ * body as text first and parsing it ourselves lets us raise a `RadfiApiError` carrying the
9330
+ * actual status code and a body snippet instead.
9331
+ */
9332
+ private parseJsonBody;
8810
9333
  private request;
8811
9334
  }
8812
9335
 
@@ -8820,38 +9343,34 @@ interface BtcPayload {
8820
9343
  timestamp: number;
8821
9344
  address_type: BtcAddressType;
8822
9345
  }
9346
+ /**
9347
+ * Calculate the actual vbytes of an OP_RETURN output given the payload byte length.
9348
+ * Accounts for variable-length pushdata opcodes and script-length varints.
9349
+ */
9350
+ declare function calcOpReturnOutputVbytes(payloadByteLength: number): number;
8823
9351
  /**
8824
9352
  * Estimate transaction size in vbytes.
8825
9353
  * @param addressType — caller's address type for accurate per-input weight.
8826
9354
  * P2PKH ≈ 148 vB, P2SH-P2WPKH ≈ 91 vB, P2WPKH ≈ 68 vB, P2TR ≈ 58 vB.
8827
9355
  * Defaults to P2WPKH (68 vB) when omitted.
9356
+ * @param opReturnOutputVbytes — actual OP_RETURN output size in vbytes.
9357
+ * Use calcOpReturnOutputVbytes() when the payload size is known. Defaults to 44 vB (~33-byte payload).
8828
9358
  */
8829
- declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType): number;
9359
+ declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType, opReturnOutputVbytes?: number): number;
8830
9360
  declare function encodeBtcPayloadToBytes(payload: BtcPayload): string;
8831
9361
  /**
8832
9362
  * Normalize a signed PSBT to base64 format.
8833
9363
  * Unisat/OKX wallets return hex, Xverse returns base64.
8834
- * Radfi API expects base64.
9364
+ * Bound Exchange API expects base64.
8835
9365
  */
8836
9366
  declare function normalizePsbtToBase64(signedPsbt: string): string;
9367
+ /**
9368
+ * Normalize a wallet message signature to base64. The intent relay requires the on-demand
9369
+ * withdrawal signature as base64. Browser wallets (UniSat/Xverse/OKX) already return base64; a hex
9370
+ * signature (e.g. a private-key wallet) is encoded. Mirrors `normalizePsbtToBase64`.
9371
+ */
9372
+ declare function normalizeSignatureToBase64(signature: string): string;
8837
9373
 
8838
- type BitcoinSpokeDepositParams = {
8839
- srcChainKey: BitcoinChainKey;
8840
- srcAddress: GetAddressType<BitcoinChainKey>;
8841
- to: HubAddress;
8842
- token: string;
8843
- amount: bigint;
8844
- data: Hex;
8845
- accessToken?: string;
8846
- };
8847
- type BitcoinTransferToHubParams = {
8848
- srcChainKey: BitcoinChainKey;
8849
- srcAddress: GetAddressType<BitcoinChainKey>;
8850
- token: string;
8851
- amount: bigint;
8852
- data?: Hex;
8853
- accessToken?: string;
8854
- };
8855
9374
  type BitcoinUTXO = {
8856
9375
  txid: string;
8857
9376
  vout: number;
@@ -8872,6 +9391,7 @@ interface BitcoinTransactionResult {
8872
9391
  interface OnDemandBtcPayload {
8873
9392
  payload_hex: string;
8874
9393
  signature?: string;
9394
+ public_key?: string;
8875
9395
  }
8876
9396
  declare class BitcoinSpokeService {
8877
9397
  private readonly config;
@@ -8881,7 +9401,7 @@ declare class BitcoinSpokeService {
8881
9401
  private readonly pollingIntervalMs;
8882
9402
  private readonly maxTimeoutMs;
8883
9403
  constructor(config: ConfigService);
8884
- getBtcNetwork(chainId: BitcoinChainKey): bitcoin.networks.Network;
9404
+ getBtcNetwork(chainId: BitcoinChainKey): networks.Network;
8885
9405
  getBalance(tokenAddress: string, walletAddress: string): Promise<bigint>;
8886
9406
  fetchScriptPubKey(utxo: BitcoinUTXO): Promise<string>;
8887
9407
  /**
@@ -8917,7 +9437,7 @@ declare class BitcoinSpokeService {
8917
9437
  */
8918
9438
  getDeposit(params: GetDepositParams<BitcoinChainKey>): Promise<bigint>;
8919
9439
  /**
8920
- * Fund the Radfi trading wallet by sending BTC from the user's personal wallet
9440
+ * Fund the Bound Exchange trading wallet by sending BTC from the user's personal wallet
8921
9441
  *
8922
9442
  * @param {bigint} amount - Amount in satoshis to send
8923
9443
  * @param {BitcoinSpokeProvider} spokeProvider - The Bitcoin spoke provider (must have signing capability)
@@ -8938,27 +9458,68 @@ declare class BitcoinSpokeService {
8938
9458
  sendMessage<Raw extends boolean>(params: SendMessageParams<BitcoinChainKey, Raw> & {
8939
9459
  walletMode?: WalletMode;
8940
9460
  }): Promise<TxReturnType<BitcoinChainKey, Raw>>;
9461
+ /**
9462
+ * Build the relay submit/poll identity for an on-demand action (borrow/withdraw).
9463
+ *
9464
+ * Bitcoin borrow/withdraw are on-demand: there is no broadcast transaction — the spoke result is
9465
+ * the signed payload JSON produced by {@link encodeWithdrawalData}/{@link sendMessage}. The relay
9466
+ * accepts the submit under the literal `withdraw` tx_hash with the signed payload (as a JSON object)
9467
+ * in `data`, then tracks the resulting packet under a derived id: `od:` + keccak256 of the ASCII
9468
+ * `payload_hex` string (hash the hex characters, not the decoded bytes). Polling must use that
9469
+ * derived id (`pollTxHash`), not `withdraw`.
9470
+ *
9471
+ * @param tx - The JSON-stringified signed payload returned by `sendMessage` / `encodeWithdrawalData`.
9472
+ */
9473
+ getOnDemandRelayIdentity(tx: string): {
9474
+ srcTxHash: string;
9475
+ data: OnDemandRelayData;
9476
+ pollTxHash: string;
9477
+ };
8941
9478
  /**
8942
9479
  * Build a priority Bitcoin transaction with proper fee calculation
8943
9480
  */
8944
9481
  buildBitcoinTransaction(utxos: BitcoinUTXO[], outputs: Array<{
8945
9482
  address: string;
8946
9483
  value: number;
8947
- }>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number): Promise<bitcoin.Psbt>;
9484
+ }>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number, opReturnOutputVbytes?: number): Promise<Psbt>;
8948
9485
  /**
8949
9486
  * Deposit operation - transfer BTC to the asset manager
8950
9487
  */
8951
- deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw> & {
9488
+ deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw>): Promise<TxReturnType<BitcoinChainKey, Raw>>;
9489
+ /**
9490
+ * Sign and submit a TRADING-wallet raw transaction — the Bound-built *unsigned* PSBT returned by
9491
+ * `deposit({ raw: true })` / the Swaps API (`createIntent().tx.data`). Signs it with the wallet
9492
+ * provider's key, then sends it to Bound Exchange to co-sign with the second 2-of-2 key and
9493
+ * broadcast. Returns the broadcast tx id.
9494
+ *
9495
+ * This is the client-side completion of the TRADING deposit flow: the backend builds the PSBT
9496
+ * (it can't broadcast — the user's signature is missing), the client signs here, and Bound
9497
+ * co-signs + broadcasts. `relayData` ({ address, payload }) is the relay identity returned by
9498
+ * `createIntent()`; forwarding it lets Bound auto-resubmit a stuck relay. It is **not** recoverable
9499
+ * from `rawTx` (whose `to` is the asset manager, not the hub wallet), so callers must supply it.
9500
+ *
9501
+ * @throws if the chain is not in `TRADING` wallet mode (raw txs only exist in TRADING mode).
9502
+ */
9503
+ signAndSubmitRawTransaction(params: {
9504
+ rawTx: BitcoinRawTransaction;
9505
+ walletProvider: IBitcoinWalletProvider;
9506
+ relayData?: RelayExtraData;
8952
9507
  accessToken?: string;
8953
- }): Promise<TxReturnType<BitcoinChainKey, Raw>>;
9508
+ }): Promise<string>;
8954
9509
  /**
8955
9510
  * Build deposit PSBT with embedded cross-chain data
8956
9511
  */
8957
- buildDepositPsbt(walletAddress: string, walletProvider: IBitcoinWalletProvider, srcChainKey: BitcoinChainKey, token: string, amount: bigint, data: string, utxos: BitcoinUTXO[]): Promise<bitcoin.Psbt>;
9512
+ buildDepositPsbt(walletAddress: string, walletProvider: IBitcoinWalletProvider, srcChainKey: BitcoinChainKey, token: string, amount: bigint, data: string, utxos: BitcoinUTXO[]): Promise<Psbt>;
8958
9513
  /**
8959
9514
  * Fetch UTXOs for an address
8960
9515
  */
8961
9516
  fetchUTXOs(address: string): Promise<BitcoinUTXO[]>;
9517
+ /**
9518
+ * Returns the set of "txid:vout" outpoints currently being spent by
9519
+ * unconfirmed transactions in the mempool for the given address.
9520
+ * Used to prevent double-spend when building a new PSBT.
9521
+ */
9522
+ private fetchMempoolSpentOutpoints;
8962
9523
  /**
8963
9524
  * Fetch raw transaction hex
8964
9525
  */
@@ -8969,7 +9530,7 @@ declare class BitcoinSpokeService {
8969
9530
  /**
8970
9531
  * Sign and broadcast a Bitcoin transaction
8971
9532
  */
8972
- signAndBroadcastTransaction(psbt: bitcoin.Psbt | string, walletProvider: IBitcoinWalletProvider): Promise<string>;
9533
+ signAndBroadcastTransaction(psbt: Psbt | string, walletProvider: IBitcoinWalletProvider): Promise<string>;
8973
9534
  /**
8974
9535
  * Broadcast a signed transaction
8975
9536
  */
@@ -8977,77 +9538,11 @@ declare class BitcoinSpokeService {
8977
9538
  waitForTransactionReceipt(params: WaitForTxReceiptParams<BitcoinChainKey>): Promise<Result<WaitForTxReceiptReturnType<BitcoinChainKey>>>;
8978
9539
  }
8979
9540
 
8980
- type RelayExtraData = {
8981
- address: Hex;
8982
- payload: Hex;
8983
- };
8984
- type IntentDeliveryInfo = {
8985
- srcChainKey: SpokeChainKey;
8986
- srcTxHash: string;
8987
- srcAddress: string;
8988
- dstChainKey: SpokeChainKey;
8989
- dstTxHash: string;
8990
- dstAddress: string;
8991
- };
8992
- type WaitUntilIntentExecutedPayload = {
8993
- intentRelayChainId: string;
8994
- srcTxHash: string;
8995
- timeout?: number;
8996
- apiUrl: HttpUrl;
8997
- };
8998
- type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
8999
- type IntentRelayRequest<T extends RelayAction> = {
9000
- action: T;
9001
- params: T extends 'submit' ? {
9002
- chain_id: string;
9003
- tx_hash: string;
9004
- data?: RelayExtraData;
9005
- } : T extends 'get_transaction_packets' ? {
9006
- chain_id: string;
9007
- tx_hash: string;
9008
- } : T extends 'get_packet' ? {
9009
- chain_id: string;
9010
- tx_hash: string;
9011
- conn_sn: string;
9012
- } : never;
9013
- };
9014
-
9015
- /**
9016
- * Types derived from Core SDK specific types
9017
- * NOTE: common (non Core SDK specific) types should be put in @sodax/types package
9018
- */
9019
- type HubProvider = EvmHubProvider;
9020
- type RateLimitConfig = {
9021
- maxAvailable: number;
9022
- ratePerSecond: number;
9023
- available: number;
9024
- };
9025
- /**
9026
- * Structural types
9027
- */
9028
- type OptionalRaw<R extends boolean> = {
9029
- raw?: R;
9030
- };
9031
- type OptionalSkipSimulation = {
9032
- skipSimulation?: boolean;
9033
- };
9034
- type OptionalTimeout = {
9035
- timeout?: number;
9036
- };
9037
- type TxHashPair = {
9038
- srcChainTxHash: string;
9039
- dstChainTxHash: string;
9040
- };
9041
- type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
9042
- tx: TxReturnType<K, Raw>;
9043
- relayData: RelayExtraData;
9044
- };
9045
-
9046
- type DestinationParamsType = RawDestinationParams;
9047
-
9048
9541
  type QueryResponse = string | number | boolean | object | undefined;
9049
9542
  type CallResponse = string | number | object | bigint | boolean;
9050
9543
  declare const NEAR_DEFAULT_GAS: bigint;
9544
+ /** NEP-141 default storage bond for a one-time `storage_deposit` registration (0.00125 NEAR). */
9545
+ declare const NEAR_STORAGE_DEPOSIT: bigint;
9051
9546
  declare class NearSpokeService {
9052
9547
  private readonly config;
9053
9548
  readonly rpcProvider: JsonRpcProvider;
@@ -9078,6 +9573,34 @@ declare class NearSpokeService {
9078
9573
  * @returns {Promise<bigint>} The balance of the token.
9079
9574
  */
9080
9575
  getDeposit(params: GetDepositParams<NearChainKey>): Promise<bigint>;
9576
+ /**
9577
+ * Whether `accountId` is storage-registered on a NEP-141 `token` contract. NEP-141 requires an
9578
+ * account to pay a one-time storage bond before it can receive (hold a balance of) the token, so
9579
+ * this gates any leg that delivers a token to a user on NEAR (swap output on NEAR, bridge into
9580
+ * NEAR, money-market borrow/withdraw to NEAR).
9581
+ *
9582
+ * Native NEAR is not a NEP-141 token and has no storage registration, so this returns `true` for
9583
+ * the native token. The view goes through {@link queryContract}, i.e. the configurable RPC from
9584
+ * chain config — a custom `rpcUrl` passed to the SDK is honoured.
9585
+ */
9586
+ isStorageRegistered(token: string, accountId: string): Promise<boolean>;
9587
+ /**
9588
+ * Build (and, unless `raw`, submit) a NEP-141 `storage_deposit` registration for `accountId` on
9589
+ * the `token` contract. Call this when {@link isStorageRegistered} is `false` before a token is
9590
+ * delivered to the account on NEAR.
9591
+ *
9592
+ * Native NEAR has no storage registration — passing the native token throws.
9593
+ *
9594
+ * @param params.deposit Storage bond to attach; defaults to {@link NEAR_STORAGE_DEPOSIT}
9595
+ * (0.00125 NEAR). Override per token if its `storage_balance_bounds.min` differs.
9596
+ */
9597
+ registerStorage<Raw extends boolean = false>(params: {
9598
+ token: string;
9599
+ accountId: string;
9600
+ walletProvider: INearWalletProvider;
9601
+ deposit?: bigint;
9602
+ raw?: Raw;
9603
+ }): Promise<TxReturnType<NearChainKey, Raw>>;
9081
9604
  /**
9082
9605
  * Sends a message to the hub chain.
9083
9606
  * @param {SendMessageParams} params - Includes dstChainKey, the chain key of the hub chain.
@@ -9128,7 +9651,6 @@ declare class SuiSpokeService {
9128
9651
  stateId: string;
9129
9652
  };
9130
9653
  getNativeCoin(tx: Transaction, amount: bigint): Promise<SuiNativeCoinResult>;
9131
- static getAddressBCSBytes(suiaddress: string): Hex;
9132
9654
  encodeSimulationParams(token: string, assetManager: string): {
9133
9655
  encodedToken: Hex;
9134
9656
  encodedSrcAddress: Hex;
@@ -9151,20 +9673,19 @@ declare class SuiSpokeService {
9151
9673
  estimateGas({ tx }: EstimateGasParams<SuiChainKey>): Promise<SuiGasEstimate>;
9152
9674
  /**
9153
9675
  * Get the balance of the token in the spoke chain.
9154
- * @param {Address} token - The address of the token to get the balance of.
9155
- * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
9676
+ * @param {GetDepositParams<SuiChainKey>} params - The src chain key, src address, and token address.
9156
9677
  * @returns {Promise<bigint>} The balance of the token.
9157
9678
  */
9158
9679
  getDeposit(params: GetDepositParams<SuiChainKey>): Promise<bigint>;
9159
9680
  /**
9160
9681
  * Fetch the asset manager config from the spoke chain.
9161
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
9682
+ * @param {SuiChainKey} chainId - The Sui chain key.
9162
9683
  * @returns {Promise<string>} The asset manager config.
9163
9684
  */
9164
9685
  fetchAssetManagerAddress(chainId: SuiChainKey): Promise<string>;
9165
9686
  /**
9166
9687
  * Fetch the latest asset manager package id from the spoke chain.
9167
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
9688
+ * @param {SuiChainKey} chainId - The Sui chain key.
9168
9689
  * @returns {Promise<string>} The latest asset manager package id.
9169
9690
  */
9170
9691
  fetchLatestAssetManagerPackageId(chainId: SuiChainKey): Promise<string>;
@@ -9196,19 +9717,6 @@ declare class CustomStellarAccount {
9196
9717
  decrementSequenceNumber(): void;
9197
9718
  resetSequenceNumber(): void;
9198
9719
  }
9199
- type StellarSpokeDepositParams = {
9200
- from: Hex$1;
9201
- to?: HubAddress;
9202
- token: string;
9203
- amount: bigint;
9204
- data: Hex$1;
9205
- };
9206
- type StellarTransferToHubParams = {
9207
- token: string;
9208
- recipient: Address$2;
9209
- amount: bigint;
9210
- data: Hex$1;
9211
- };
9212
9720
  type RequestTrustlineParams<S extends StellarChainKey, Raw extends boolean> = {
9213
9721
  srcAddress: string;
9214
9722
  srcChainKey: S;
@@ -9277,19 +9785,6 @@ declare class StellarSpokeService {
9277
9785
  waitForTransactionReceipt(params: WaitForTxReceiptParams<StellarChainKey>): Promise<Result<WaitForTxReceiptReturnType<StellarChainKey>>>;
9278
9786
  }
9279
9787
 
9280
- type SolanaSpokeDepositParams = {
9281
- from: SolanaBase58PublicKey;
9282
- to?: HubAddress;
9283
- token: SolanaBase58PublicKey;
9284
- amount: bigint;
9285
- data: Hex$1;
9286
- };
9287
- type SolanaTransferToHubParams = {
9288
- token: PublicKey;
9289
- recipient: string;
9290
- amount: string;
9291
- data: Hex$1;
9292
- };
9293
9788
  declare class SolanaSpokeService {
9294
9789
  private readonly config;
9295
9790
  private readonly rpcUrl;
@@ -9325,31 +9820,15 @@ declare class SolanaSpokeService {
9325
9820
  waitForTransactionReceipt(params: WaitForTxReceiptParams<SolanaChainKey>): Promise<Result<WaitForTxReceiptReturnType<SolanaChainKey>>>;
9326
9821
  static getBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<number>;
9327
9822
  static getTokenAccountBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
9328
- static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey): Promise<SolanaBase58PublicKey>;
9823
+ /**
9824
+ * Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
9825
+ * the legacy SPL Token program when the mint account can't be read.
9826
+ */
9827
+ static getMintTokenProgramId(connection: Connection$1, mint: PublicKey): Promise<PublicKey>;
9828
+ static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey, tokenProgramId?: PublicKey): Promise<SolanaBase58PublicKey>;
9329
9829
  static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
9330
9830
  }
9331
9831
 
9332
- type IconSpokeDepositParams = {
9333
- from: IconAddress;
9334
- srcChainKey: IconChainKey;
9335
- to?: HubAddress;
9336
- token: string;
9337
- amount: bigint;
9338
- data: Hex;
9339
- };
9340
- type IconTransferToHubParams = {
9341
- token: string;
9342
- recipient: Address;
9343
- amount: bigint;
9344
- data: Hex;
9345
- };
9346
- type IconCallParams<Raw extends boolean> = {
9347
- srcChainKey: IconChainKey;
9348
- srcAddress: GetAddressType<IconChainKey>;
9349
- dstChainKey: HubChainKey;
9350
- dstAddress: HubAddress;
9351
- payload: Hex;
9352
- } & WalletProviderSlot<IconChainKey, Raw>;
9353
9832
  declare class IconSpokeService {
9354
9833
  private readonly config;
9355
9834
  readonly iconService: IconService;
@@ -9360,7 +9839,7 @@ declare class IconSpokeService {
9360
9839
  estimateGas({ tx }: EstimateGasParams<IconChainKey>): Promise<IconGasEstimate>;
9361
9840
  /**
9362
9841
  * Deposit tokens to the spoke chain.
9363
- * @param {IconSpokeDepositParams} params - The parameters for the deposit
9842
+ * @param {DepositParams<IconChainKey, R>} params - The parameters for the deposit
9364
9843
  * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
9365
9844
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
9366
9845
  * @param {boolean} raw - The return type raw or just transaction hash
@@ -9433,14 +9912,6 @@ interface State {
9433
9912
  hub_chain_id: string;
9434
9913
  owner: string;
9435
9914
  }
9436
- /**
9437
- * InjectiveSpokeService provides methods for interacting with the Injective spoke chain,
9438
- * specifically for managing token deposits and transfers between the spoke chain and hub chain.
9439
- * It handles the cross-chain communication and token bridging functionality, allowing users to:
9440
- * - Deposit tokens from Injective to the hub chain
9441
- * - Check token balances on the spoke chain
9442
- * - Transfer tokens with custom data payloads
9443
- */
9444
9915
  declare class InjectiveSpokeService {
9445
9916
  private readonly config;
9446
9917
  readonly chainGrpcWasmApi: ChainGrpcWasmApi;
@@ -9448,7 +9919,10 @@ declare class InjectiveSpokeService {
9448
9919
  readonly endpoints: NetworkEndpoints;
9449
9920
  private readonly pollingIntervalMs;
9450
9921
  private readonly maxTimeoutMs;
9922
+ private readonly gasPrice;
9451
9923
  constructor(config: ConfigService);
9924
+ /** Parse a chain-config gas price like `"500000000inj"` into its numeric price and denom. */
9925
+ private parseGasPrice;
9452
9926
  /**
9453
9927
  * Estimate the gas for a transaction.
9454
9928
  * @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
@@ -9472,7 +9946,7 @@ declare class InjectiveSpokeService {
9472
9946
  * @returns {Promise<bigint>} The balance of the token.
9473
9947
  */
9474
9948
  getDeposit(params: GetDepositParams<InjectiveChainKey>): Promise<bigint>;
9475
- getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string): Promise<InjectiveRawTransaction>;
9949
+ getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string, funds?: InjectiveCoin[]): Promise<InjectiveRawTransaction>;
9476
9950
  getState(chainId: InjectiveChainKey): Promise<State>;
9477
9951
  /**
9478
9952
  * Sends a message to the hub chain.
@@ -9613,7 +10087,6 @@ declare class SpokeService {
9613
10087
  waitForTxReceipt<C extends SpokeChainKey = SpokeChainKey>(params: WaitForTxReceiptParams<C>): Promise<Result<WaitForTxReceiptReturnType<C>>>;
9614
10088
  }
9615
10089
 
9616
- type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
9617
10090
  /**
9618
10091
  * Stable error message strings emitted by relay-layer helpers ({@link submitTransaction},
9619
10092
  * {@link relayTxAndWaitPacket}) on failure.
@@ -9668,18 +10141,6 @@ type SubmitTxResponse = {
9668
10141
  success: boolean;
9669
10142
  message: string;
9670
10143
  };
9671
- type PacketData = {
9672
- src_chain_id: number;
9673
- src_tx_hash: string;
9674
- src_address: string;
9675
- status: RelayTxStatus;
9676
- dst_chain_id: number;
9677
- conn_sn: number;
9678
- dst_address: string;
9679
- dst_tx_hash: string;
9680
- signatures: string[];
9681
- payload: string;
9682
- };
9683
10144
  type GetTransactionPacketsResponse = {
9684
10145
  success: boolean;
9685
10146
  data: PacketData[];
@@ -9696,10 +10157,11 @@ type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResp
9696
10157
  type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
9697
10158
  type RelayAndWaitParams = {
9698
10159
  srcTxHash: string;
9699
- data: RelayExtraData;
10160
+ data: RelayExtraData | OnDemandRelayData;
9700
10161
  chainKey: SpokeChainKey;
9701
10162
  relayerApiEndpoint: HttpUrl;
9702
10163
  timeout: number | undefined;
10164
+ pollTxHash?: string;
9703
10165
  };
9704
10166
  /**
9705
10167
  * Submits a transaction to the intent relay service.
@@ -9715,6 +10177,8 @@ type RelayAndWaitParams = {
9715
10177
  * requires coordinated updates across all callers — prefer adding a new code to
9716
10178
  * {@link RELAY_ERROR_CODES} over renaming.
9717
10179
  *
10180
+ * NOTE: if transaction was already relayed, post request will return { success: true, message: 'Transaction registered' }
10181
+ *
9718
10182
  * @param payload - The request payload containing the 'submit' action type and parameters.
9719
10183
  * @param apiUrl - The URL of the intent relay service.
9720
10184
  * @returns The response from the intent relay service.
@@ -11545,11 +12009,11 @@ type Connection = {
11545
12009
  ];
11546
12010
  };
11547
12011
 
11548
- declare function getProvider(base58PublicKey: string, rpcUrl: string): Promise<anchor.AnchorProvider>;
11549
- declare function getAssetManagerIdl(assetManager: string, provider: anchor.AnchorProvider): Promise<anchor.Idl>;
11550
- declare function getConnectionIdl(connection: string, provider: anchor.AnchorProvider): Promise<anchor.Idl>;
11551
- declare function getAssetManagerProgram(base58PublicKey: string, rpcUrl: string, assetManager: string): Promise<anchor.Program<AssetManager>>;
11552
- declare function getConnectionProgram(base58PublicKey: string, rpcUrl: string, connection: string): Promise<anchor.Program<Connection>>;
12012
+ declare function getProvider(base58PublicKey: string, rpcUrl: string): Promise<AnchorProvider>;
12013
+ declare function getAssetManagerIdl(assetManager: string, provider: AnchorProvider): Promise<_coral_xyz_anchor.Idl>;
12014
+ declare function getConnectionIdl(connection: string, provider: AnchorProvider): Promise<_coral_xyz_anchor.Idl>;
12015
+ declare function getAssetManagerProgram(base58PublicKey: string, rpcUrl: string, assetManager: string): Promise<Program<AssetManager>>;
12016
+ declare function getConnectionProgram(base58PublicKey: string, rpcUrl: string, connection: string): Promise<Program<Connection>>;
11553
12017
  declare function getSolanaAddressBytes(address: PublicKey): Hex$1;
11554
12018
  declare function hexToSolanaAddress(hex: Hex$1): PublicKey;
11555
12019
  declare function isSolanaNativeToken(address: PublicKey): boolean;
@@ -11590,8 +12054,6 @@ declare function isSpokeApproveParamsStellar<K extends SpokeChainKey, Raw extend
11590
12054
  srcChainKey: StellarChainKey;
11591
12055
  }>;
11592
12056
  declare function isRawDestinationParams(value: unknown): value is RawDestinationParams;
11593
- declare function isSubmitSwapTxResponse(value: unknown): value is SubmitSwapTxResponse;
11594
- declare function isSubmitSwapTxStatusResponse(value: unknown): value is SubmitSwapTxStatusResponse;
11595
12057
  declare function isBitcoinWalletProviderType(wp: IWalletProvider): wp is IBitcoinWalletProvider;
11596
12058
  declare function isEvmWalletProviderType(walletProvider: IWalletProvider): walletProvider is IEvmWalletProvider;
11597
12059
  declare function isStellarWalletProviderType(walletProvider: IWalletProvider): walletProvider is IStellarWalletProvider;
@@ -11601,6 +12063,20 @@ declare function isOptionalStellarWalletProviderType(walletProvider: IWalletProv
11601
12063
  declare function isUndefinedOrValidWalletProviderForChainKey<K extends SpokeChainKey>(chainKey: K, walletProvider: IWalletProvider | undefined): walletProvider is GetWalletProviderType<K> | undefined;
11602
12064
  declare function isOptionalBitcoinWalletProviderType(walletProvider: IWalletProvider | undefined): walletProvider is IBitcoinWalletProvider | undefined;
11603
12065
 
12066
+ /**
12067
+ * Default logger. Mirrors the SDK's historical `console.*` behavior so existing consumers
12068
+ * see no change when they don't pass a `logger`. `data` is appended only when present to keep
12069
+ * single-arg log lines unchanged.
12070
+ */
12071
+ declare const consoleLogger: SodaxLogger;
12072
+ /** No-op logger. Drops every SDK log line. Selected via `new Sodax({ logger: 'silent' })`. */
12073
+ declare const silentLogger: SodaxLogger;
12074
+ /**
12075
+ * Resolve a {@link SodaxLoggerOption} (a preset name, a custom logger, or `undefined`) into a
12076
+ * concrete {@link SodaxLogger}. Defaults to {@link consoleLogger} so logging is on unless opted out.
12077
+ */
12078
+ declare function resolveLogger(option: SodaxLoggerOption | undefined): SodaxLogger;
12079
+
11604
12080
  /** Swap-module narrow error types. */
11605
12081
 
11606
12082
  declare const swapInvariant: FeatureInvariant;
@@ -11614,7 +12090,7 @@ type SwapCreateIntentErrorCode = CreateIntentErrorCode;
11614
12090
  * that handles both `postExecution` and `swap` errors expecting the same union.
11615
12091
  */
11616
12092
  type PostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
11617
- type SwapErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
12093
+ type SwapErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
11618
12094
  type SwapCreateIntentError = SodaxError<SwapCreateIntentErrorCode>;
11619
12095
  type PostExecutionError = SodaxError<PostExecutionErrorCode>;
11620
12096
  type SwapError = SodaxError<SwapErrorCode>;
@@ -11637,8 +12113,8 @@ type CreateIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
11637
12113
  intent: Intent & FeeAmount;
11638
12114
  relayData: RelayExtraData;
11639
12115
  };
11640
- type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>>;
11641
- type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>>;
12116
+ type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>, SwapExtras<K>>;
12117
+ type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>, SwapExtras<K>>;
11642
12118
  /**
11643
12119
  * Params for `cancelIntent`.
11644
12120
  * Because `Intent.srcChain` is an `IntentRelayChainId` (bigint) whose literal type cannot
@@ -11652,10 +12128,17 @@ type CancelIntentParams<K extends SpokeChainKey> = {
11652
12128
  timeout?: number;
11653
12129
  };
11654
12130
  type CancelIntentActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CancelIntentParams<K>>;
12131
+ type GetQuoteParams = SolverIntentQuoteRequest & {
12132
+ /** Optional per-call override of the configured swap partner fee. Falls back to config when omitted. */
12133
+ partnerFee?: PartnerFee;
12134
+ };
11655
12135
  type SwapServiceConstructorParams = {
11656
12136
  config: ConfigService;
11657
12137
  spoke: SpokeService;
11658
12138
  hubProvider: HubProvider;
12139
+ backendApi: BackendApiService;
12140
+ /** Opt-in backend submit-tx 2-step flow (from `SodaxOptions.swapsOptions.useBackendSubmitTx`). Default off. */
12141
+ useBackendSubmitTx?: boolean;
11659
12142
  };
11660
12143
  /**
11661
12144
  * Main entry point for the SODAX swap feature.
@@ -11680,7 +12163,9 @@ declare class SwapService {
11680
12163
  readonly solver: SolverConfig;
11681
12164
  readonly partnerFee: PartnerFee | undefined;
11682
12165
  readonly relayerApiEndpoint: HttpUrl;
11683
- constructor({ config, hubProvider, spoke }: SwapServiceConstructorParams);
12166
+ readonly backendApi: BackendApiService;
12167
+ readonly useBackendSubmitTx: boolean;
12168
+ constructor({ config, hubProvider, spoke, backendApi, useBackendSubmitTx }: SwapServiceConstructorParams);
11684
12169
  /**
11685
12170
  * Estimates the gas cost for a raw (unsigned) transaction on a spoke chain.
11686
12171
  *
@@ -11691,10 +12176,13 @@ declare class SwapService {
11691
12176
  /**
11692
12177
  * Requests a price quote from the solver API for a given token pair and amount.
11693
12178
  *
11694
- * Adjusts `payload.amount` by the configured partner fee before forwarding to the solver,
11695
- * so the returned `quoted_amount` reflects the net output the user actually receives.
12179
+ * Adjusts `payload.amount` by the partner fee before forwarding to the solver, so the returned
12180
+ * `quoted_amount` reflects the net output the user actually receives. Pass `partnerFee` to match
12181
+ * a per-action override supplied to `createIntent` (`extras.partnerFee`); omit it to use the
12182
+ * configured swap fee.
11696
12183
  *
11697
- * @param payload - Source/destination tokens, chain IDs, input amount, and quote type.
12184
+ * @param payload - The solver quote request, optionally carrying a per-call `partnerFee` override
12185
+ * (defaults to the configured swap partner fee). `partnerFee` is stripped before forwarding.
11698
12186
  * @returns A `Result` containing `{ quoted_amount: bigint }` on success, or a
11699
12187
  * `SolverErrorResponse` (with a `SolverIntentErrorCode`) on failure.
11700
12188
  *
@@ -11709,7 +12197,7 @@ declare class SwapService {
11709
12197
  * });
11710
12198
  * if (response.ok) console.log('Quoted amount:', response.value.quoted_amount);
11711
12199
  */
11712
- getQuote(payload: SolverIntentQuoteRequest): Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>;
12200
+ getQuote(payload: GetQuoteParams): Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>;
11713
12201
  /**
11714
12202
  * Calculates the partner fee that will be deducted from the given input amount.
11715
12203
  *
@@ -11771,14 +12259,22 @@ declare class SwapService {
11771
12259
  /**
11772
12260
  * Executes a full end-to-end cross-chain swap.
11773
12261
  *
11774
- * Orchestrates the complete swap lifecycle:
11775
- * 1. Calls `createIntent` to submit the intent transaction on the source spoke chain.
11776
- * 2. Verifies the spoke transaction landed on-chain.
11777
- * 3. For non-hub source chains: submits the spoke tx to the relayer and waits for the
11778
- * relay packet to land on the hub (Sonic). Skipped when `srcChainKey` is the hub.
11779
- * 4. Calls `postExecution` to notify the solver, triggering it to fill the intent.
11780
- *
11781
- * @param _params - Swap action params including intent parameters, wallet provider, and optional timeout.
12262
+ * Orchestrates the complete swap lifecycle. `createIntent` first submits the intent transaction on
12263
+ * the source spoke chain; completion then runs via one of two paths, both bounded by a single
12264
+ * shared `timeout` budget:
12265
+ *
12266
+ * - **Client-side (default), {@link fallbackSwapSteps}:** verifies the spoke tx landed on-chain,
12267
+ * relays it to the hub (Sonic) and waits for the packet skipped when `srcChainKey` is the hub,
12268
+ * where the spoke tx already is the hub tx — then calls `postExecution` to notify the solver,
12269
+ * triggering it to fill the intent.
12270
+ * - **Backend 2-step (opt-in via `swapsOptions.useBackendSubmitTx`), {@link submitTx}:** hands the
12271
+ * broadcast tx to the swaps API, which verifies, relays and post-executes server-side, then polls
12272
+ * for completion. On ANY non-success it transparently falls back to the client-side path above —
12273
+ * safe because re-relaying / re-posting an already-processed swap is idempotent (no double-fill).
12274
+ *
12275
+ * @param _params - Swap action params including intent parameters, wallet provider, and an optional
12276
+ * `timeout` — the single shared budget for the whole completion flow (relay/poll plus any
12277
+ * fallback), so total wall-clock never exceeds it.
11782
12278
  * @returns A `Result<SwapResponse, SwapError>`. On success:
11783
12279
  * - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
11784
12280
  * - `intent` — the on-chain intent object that was created.
@@ -11799,6 +12295,29 @@ declare class SwapService {
11799
12295
  * - `UNKNOWN` — uncategorized fallback.
11800
12296
  */
11801
12297
  swap<K extends SpokeChainKey>(_params: SwapActionParams<K, false>): Promise<Result<SwapResponse, SwapError>>;
12298
+ /**
12299
+ * Client-side swap completion (the default path): relay the broadcast intent tx to the hub — or
12300
+ * use it directly when the source IS the hub — then notify the solver via post-execution and
12301
+ * build the {@link SwapResponse}. Extracted verbatim from `swap()` so the opt-in backend 2-step
12302
+ * path ({@link submitTx}) can fall back to it on any non-success.
12303
+ */
12304
+ private fallbackSwapSteps;
12305
+ /**
12306
+ * Backend 2-step swap path (opt-in via `swapsOptions.useBackendSubmitTx`): hand the broadcast
12307
+ * intent tx to the swaps API (`POST /swaps/submit-tx`); the backend relays + post-executes
12308
+ * server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs the same
12309
+ * {@link SwapResponse} the client-side path returns (`result.dstIntentTxHash` → delivery info,
12310
+ * `result.intent_hash` → solver response).
12311
+ *
12312
+ * Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, terminal `failed` /
12313
+ * abandoned, or poll timeout) so `swap()` falls back to {@link fallbackSwapSteps}.
12314
+ *
12315
+ * Falling back is safe: re-relaying / re-posting an already-processed swap is idempotent — the
12316
+ * relay dedups and returns the existing `executed` packet, and the solver re-affirms the intent
12317
+ * (no double-fill). Verified live by `e2e-tests/e2e-relay.test.ts`. Polling stops at
12318
+ * `deadline - reserve` so the fallback keeps a guaranteed slice of the shared `swap` budget.
12319
+ */
12320
+ private submitTx;
11802
12321
  /**
11803
12322
  * Checks whether the relevant spender contract is already approved to spend the input token amount.
11804
12323
  *
@@ -11842,7 +12361,7 @@ declare class SwapService {
11842
12361
  * - `raw: false` — broadcasts the transaction; `walletProvider` is required and must match `K`.
11843
12362
  *
11844
12363
  * Validates tokens and chain keys against the active `ConfigService` before constructing the
11845
- * intent. Bitcoin source chains require an additional RadFi access token step.
12364
+ * intent. Bitcoin source chains require an additional Bound Exchange access token step.
11846
12365
  *
11847
12366
  * @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
11848
12367
  * and optional `skipSimulation` flag.
@@ -11945,6 +12464,24 @@ declare class SwapService {
11945
12464
  * @returns A `Result` containing `RelayExtraData`: `{ address: Hex; payload: Hex }`.
11946
12465
  */
11947
12466
  getIntentSubmitTxExtraData(params: GetIntentSubmitTxExtraDataParams): Promise<Result<RelayExtraData>>;
12467
+ /**
12468
+ * Re-derives the byte-identical relay extra data (`{ address, payload }`) for a swap intent from a
12469
+ * fully-populated `Intent` alone — no on-chain call, no original `createIntent` return value needed.
12470
+ *
12471
+ * The `payload` matches exactly what `createIntent` relayed when the intent was first created:
12472
+ * - Sonic-hub source — raw `createIntent(intent)` calldata.
12473
+ * - Any spoke source — the `[approve, createIntent]` multicall (uniform across all spokes).
12474
+ *
12475
+ * Byte-identity is possible because the only originally-random field, `intentId`, is already
12476
+ * carried on the `Intent`; everything else in the payload is a pure function of the intent and
12477
+ * the configured intents contract. Use this to rebuild relay submission data for a manual relay
12478
+ * step when the runtime `relayData` from `createIntent` is no longer available.
12479
+ *
12480
+ * @param intent - A fully-populated intent (e.g. from `getIntent(txHash)` or the `intent` field
12481
+ * returned by `createIntent`).
12482
+ * @returns A `Result` containing `RelayExtraData`: `{ address: Hex; payload: Hex }`.
12483
+ */
12484
+ reconstructRelayData(intent: Intent): Result<RelayExtraData>;
11948
12485
  /**
11949
12486
  * Fetches a previously created `Intent` from the hub chain by its transaction hash.
11950
12487
  *
@@ -11971,6 +12508,11 @@ declare class SwapService {
11971
12508
  * Use this after `getStatus` returns `SolverIntentStatusCode.SOLVED (3)` to obtain the
11972
12509
  * destination-chain transaction hash from `packet.dst_tx_hash`.
11973
12510
  *
12511
+ * A single solver fill tx emits multiple relay packets sharing the same `src_tx_hash`. The
12512
+ * user-facing `IntentFilled` delivery is the packet whose payload targets the hub intents
12513
+ * contract; `selectSolvedIntentPacket` disambiguates so the returned `dst_tx_hash` is the
12514
+ * destination delivery tx rather than an internal hop.
12515
+ *
11974
12516
  * @param chainId - The destination spoke chain key (where output tokens are delivered).
11975
12517
  * @param fillTxHash - The solver's fill transaction hash, obtained from `getStatus.fill_tx_hash`.
11976
12518
  * @param timeout - Poll timeout in milliseconds. Defaults to `DEFAULT_RELAY_TX_TIMEOUT` (120 s).
@@ -12028,13 +12570,13 @@ declare class SwapService {
12028
12570
  declare const migrationInvariant: FeatureInvariant;
12029
12571
  type MigrationOp = 'migratebnUSD' | 'migrateIcxToSoda' | 'revertMigrateSodaToIcx' | 'migrateBaln';
12030
12572
  type MigrationDirection = 'forward' | 'reverse';
12031
- type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
12573
+ type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
12032
12574
  type RevertMigrationOrchestrationErrorCode = Exclude<MigrateOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
12033
12575
  type MigrationCreateIntentErrorCode = CreateIntentErrorCode;
12034
12576
  type MigrationApproveErrorCode = ApproveErrorCode;
12035
12577
  type MigrationAllowanceCheckErrorCode = AllowanceCheckErrorCode;
12036
12578
  type MigrationLookupErrorCode = LookupErrorCode;
12037
- type MigrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
12579
+ type MigrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
12038
12580
  type MigrateOrchestrationError = SodaxError<MigrateOrchestrationErrorCode>;
12039
12581
  type RevertMigrationOrchestrationError = SodaxError<RevertMigrationOrchestrationErrorCode>;
12040
12582
  type MigrationCreateIntentError = SodaxError<MigrationCreateIntentErrorCode>;
@@ -12435,7 +12977,7 @@ declare class BalnSwapService {
12435
12977
  * @param user - The EVM address of the user to query locks for.
12436
12978
  * @returns An immutable array of `DetailedLock` objects, one per active lock.
12437
12979
  */
12438
- getDetailedUserLocks(publicClient: PublicClient<HttpTransport>, user: Address$1): Promise<readonly DetailedLock[]>;
12980
+ getDetailedUserLocks(publicClient: PublicClient, user: Address$1): Promise<readonly DetailedLock[]>;
12439
12981
  /**
12440
12982
  * Encodes a single `swap` call on the BALN swap contract.
12441
12983
  *
@@ -12720,12 +13262,12 @@ declare class MigrationService {
12720
13262
 
12721
13263
  declare const bridgeInvariant: FeatureInvariant;
12722
13264
  type BridgeAction = 'bridge';
12723
- type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
13265
+ type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
12724
13266
  type BridgeCreateIntentErrorCode = CreateIntentErrorCode;
12725
13267
  type BridgeApproveErrorCode = ApproveErrorCode;
12726
13268
  type BridgeAllowanceCheckErrorCode = AllowanceCheckErrorCode;
12727
13269
  type BridgeLookupErrorCode = LookupErrorCode;
12728
- type BridgeErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
13270
+ type BridgeErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
12729
13271
  type BridgeOrchestrationError = SodaxError<BridgeOrchestrationErrorCode>;
12730
13272
  type BridgeCreateIntentError = SodaxError<BridgeCreateIntentErrorCode>;
12731
13273
  type BridgeApproveError = SodaxError<BridgeApproveErrorCode>;
@@ -12862,7 +13404,7 @@ declare class BridgeService {
12862
13404
  * transaction simulation or batching). When `raw` is `false`, signs and submits the deposit
12863
13405
  * transaction via the provided wallet provider.
12864
13406
  *
12865
- * Bitcoin is only supported with `raw: false` because it requires the RadFi trading wallet
13407
+ * Bitcoin is only supported with `raw: false` because it requires the Bound Exchange trading wallet
12866
13408
  * derivation flow.
12867
13409
  *
12868
13410
  * @param _params - Bridge parameters including source/destination chain keys, token addresses,
@@ -12872,6 +13414,16 @@ declare class BridgeService {
12872
13414
  * contains the hub wallet address and encoded hub execution payload needed for relay.
12873
13415
  */
12874
13416
  createBridgeIntent<K extends SpokeChainKey, Raw extends boolean>(_params: BridgeParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, BridgeCreateIntentError>>;
13417
+ /**
13418
+ * Resolves a bridge endpoint's {@link XToken} descriptor from a chain key + token address.
13419
+ *
13420
+ * Spoke endpoints (and hub-native tokens such as USDC/WETH/S whose on-chain address equals their
13421
+ * hub asset) resolve by original asset address. On the hub a caller may instead hold a hub asset
13422
+ * that has no spoke-token entry under the hub chain — e.g. a partner BTC fee held as the BTC hub
13423
+ * asset, whose only spoke-token entry lives on Bitcoin. Resolve those by hub-asset address so the
13424
+ * Sonic-sourced "withdraw directly" bridge can find the matching vault/decimals.
13425
+ */
13426
+ private resolveBridgeEndpointToken;
12875
13427
  /**
12876
13428
  * Encodes the hub-side execution payload for a bridge operation.
12877
13429
  *
@@ -12930,7 +13482,7 @@ declare class BridgeService {
12930
13482
  * checking theoretical bridgeability without requiring both chains to be in the active config.
12931
13483
  * @returns `true` if the tokens share the same hub vault; `false` otherwise.
12932
13484
  */
12933
- isBridgeable({ from, to, unchecked, }: {
13485
+ isBridgeable({ from, to, unchecked }: {
12934
13486
  from: XToken;
12935
13487
  to: XToken;
12936
13488
  unchecked?: boolean;
@@ -12988,7 +13540,7 @@ declare const stakingInvariant: FeatureInvariant;
12988
13540
  /** The 5 user-facing staking operations. Carried on `context.action`. */
12989
13541
  type StakingActionType = 'stake' | 'unstake' | 'instantUnstake' | 'claim' | 'cancelUnstake';
12990
13542
  /** Codes the `stake` orchestrator can return — only one that calls `verifyTxHash`. */
12991
- type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
13543
+ type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
12992
13544
  /** Codes the 4 non-stake orchestrators (`unstake`/`instantUnstake`/`claim`/`cancelUnstake`) share. */
12993
13545
  type StakingOrchestrationErrorCode = Exclude<StakeOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
12994
13546
  type StakingCreateIntentErrorCode = CreateIntentErrorCode;
@@ -13988,7 +14540,7 @@ declare class ClService {
13988
14540
  * @returns `Result<PoolRewardConfig>` — on success, contains the reward token address,
13989
14541
  * reward rate per second, and the timestamp of the last position-affecting action.
13990
14542
  */
13991
- getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient<HttpTransport>): Promise<Result<PoolRewardConfig>>;
14543
+ getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient): Promise<Result<PoolRewardConfig>>;
13992
14544
  /**
13993
14545
  * Build and submit the spoke-side transaction that harvests hook rewards for a position.
13994
14546
  *
@@ -14057,7 +14609,7 @@ declare class ClService {
14057
14609
  * fee tiers, token metadata with optional StatAToken enrichment, and optional
14058
14610
  * reward configuration. `isActive` is `true` when `sqrtPriceX96 > 0`.
14059
14611
  */
14060
- getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient<HttpTransport>): Promise<Result<PoolData>>;
14612
+ getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient): Promise<Result<PoolData>>;
14061
14613
  /**
14062
14614
  * Fetch full details for a concentrated-liquidity position NFT.
14063
14615
  *
@@ -14074,7 +14626,7 @@ declare class ClService {
14074
14626
  * current token amounts, tick-boundary prices, unclaimed fees, and optional
14075
14627
  * underlying amounts for StatAToken pools.
14076
14628
  */
14077
- getPositionInfo(tokenId: bigint, publicClient: PublicClient<HttpTransport>): Promise<Result<ClPositionInfo>>;
14629
+ getPositionInfo(tokenId: bigint, publicClient: PublicClient): Promise<Result<ClPositionInfo>>;
14078
14630
  /**
14079
14631
  * Compute the maximum liquidity achievable given both token input amounts.
14080
14632
  *
@@ -14205,7 +14757,7 @@ declare const mmInvariant: FeatureInvariant;
14205
14757
  type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
14206
14758
  type MoneyMarketCreateIntentErrorCode = CreateIntentErrorCode;
14207
14759
  /** Codes any of the 4 orchestrators (`supply`/`borrow`/`withdraw`/`repay`) can return. */
14208
- type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
14760
+ type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
14209
14761
  type MoneyMarketApproveErrorCode = ApproveErrorCode;
14210
14762
  type MoneyMarketAllowanceCheckErrorCode = AllowanceCheckErrorCode;
14211
14763
  type MoneyMarketGasEstimationErrorCode = GasEstimationErrorCode;
@@ -15353,6 +15905,15 @@ declare class MoneyMarketService {
15353
15905
  * trigger the hub-side execution via {@link relayTxAndWaitPacket}.
15354
15906
  */
15355
15907
  createSupplyIntent<K extends SpokeChainKey, Raw extends boolean>(_params: MoneyMarketSupplyActionParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, MoneyMarketCreateIntentError>>;
15908
+ /**
15909
+ * Build the relay submit/poll identity for a money-market borrow/withdraw.
15910
+ *
15911
+ * Bitcoin borrow/withdraw are on-demand: the spoke result is a signed payload JSON that the relay
15912
+ * submits under the literal "withdraw" tx_hash and tracks under a derived `od:<hash>` poll id
15913
+ * (see {@link BitcoinSpokeService.getOnDemandRelayIdentity}). Every other chain relays and polls by
15914
+ * its real spoke tx hash, so `pollTxHash` is undefined and `srcChainTxHash` stays the spoke tx.
15915
+ */
15916
+ private buildRelayIdentity;
15356
15917
  /**
15357
15918
  * Borrow tokens from the money market lending pool and wait for the cross-chain relay to
15358
15919
  * deliver the funds to the destination address.
@@ -15642,6 +16203,18 @@ type PartnerFeeClaimSwapParams = {
15642
16203
  timeout?: number;
15643
16204
  };
15644
16205
  type PartnerFeeClaimSwapAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimSwapParams>;
16206
+ type PartnerFeeClaimCancelParams = {
16207
+ srcChainKey: HubChainKey;
16208
+ srcAddress: Address$1;
16209
+ fromToken: Address$1;
16210
+ toToken: Address$1;
16211
+ };
16212
+ type PartnerFeeClaimCancelAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimCancelParams>;
16213
+ type GetUserIntentParams = {
16214
+ user: Address$1;
16215
+ fromToken: Address$1;
16216
+ toToken: Address$1;
16217
+ };
15645
16218
  type PartnerFeeClaimServiceConstructorParams = {
15646
16219
  config: ConfigService;
15647
16220
  hubProvider: HubProvider;
@@ -15776,6 +16349,11 @@ declare class PartnerFeeClaimService {
15776
16349
  * This is the low-level building block. Use `swap` for the full flow that also waits for
15777
16350
  * the solver to execute the intent.
15778
16351
  *
16352
+ * Guards against same-token intents: if the configured output token equals `fromToken` the solver
16353
+ * cannot fill the swap, so the call is rejected with `VALIDATION_FAILED` before any transaction is
16354
+ * built. The guard fails closed — if the preference lookup fails the call returns that error rather
16355
+ * than submitting an intent that may become unfillable.
16356
+ *
15779
16357
  * @param _params - Action descriptor containing:
15780
16358
  * - `params.srcChainKey` — must be the hub chain key (Sonic).
15781
16359
  * - `params.srcAddress` — partner's EVM address; also used as the intent creator.
@@ -15806,10 +16384,59 @@ declare class PartnerFeeClaimService {
15806
16384
  *
15807
16385
  * On failure the `error` is tagged:
15808
16386
  * - `WAIT_INTENT_AUTO_SWAP_FAILED` — transaction was submitted but receipt polling failed.
15809
- * - Error from `createIntentAutoSwap` — if the initial submission failed.
16387
+ * - Error from `createIntentAutoSwap` — if the initial submission failed, including
16388
+ * `VALIDATION_FAILED` when the output token equals the fee token (same-token guard) or the
16389
+ * preference lookup that backs the guard fails.
15810
16390
  * - Error from `SolverApiService.postExecution` — if the solver notification failed.
15811
16391
  */
15812
16392
  swap(_params: PartnerFeeClaimSwapAction<HubChainKey, false>): Promise<Result<IntentAutoSwapResult>>;
16393
+ /**
16394
+ * Cancels a partner fee-claim auto-swap intent and refunds the input token to the partner.
16395
+ *
16396
+ * This targets the ProtocolIntents contract's own `cancelIntent(fromToken, toToken)`, which is
16397
+ * the only authorized cancel path for partner auto-swap intents: the intent's `creator` is the
16398
+ * ProtocolIntents contract (not the partner), so the generic `SwapService.cancelIntent` reverts
16399
+ * with `Unauthorized()`. ProtocolIntents looks up the caller's intent for the token pair, cancels
16400
+ * it in the main intents contract (as the creator), and transfers the locked `inputAmount` back
16401
+ * to the partner (`msg.sender`).
16402
+ *
16403
+ * Use this to recover funds stuck in an unfillable intent — most commonly a same-token claim
16404
+ * (`fromToken === toToken`) the solver refused to fill (see the guard in {@link swap}).
16405
+ *
16406
+ * @param _params - Action descriptor containing:
16407
+ * - `params.srcChainKey` — must be the hub chain key (Sonic).
16408
+ * - `params.srcAddress` — the partner's EVM address; must match the intent's owner.
16409
+ * - `params.fromToken` — the stuck intent's input (fee) token, hub-chain address.
16410
+ * - `params.toToken` — the stuck intent's output token, hub-chain address.
16411
+ * - `raw` — when `true`, returns the unsigned transaction object instead of submitting it.
16412
+ * - `walletProvider` — required when `raw` is `false`; must be an EVM wallet provider.
16413
+ * @returns A `Result` containing the submitted transaction hash (`raw: false`) or the unsigned
16414
+ * raw transaction (`raw: true`).
16415
+ */
16416
+ cancelIntent<Raw extends boolean>(_params: PartnerFeeClaimCancelAction<HubChainKey, Raw>): Promise<Result<TxReturnType<HubChainKey, Raw>>>;
16417
+ /**
16418
+ * Returns the stored intent hash for a partner's `(user, fromToken, toToken)` token pair.
16419
+ *
16420
+ * A non-zero hash means an auto-swap intent currently exists for that pair (e.g. an unfilled
16421
+ * same-token claim) and can be cancelled via {@link cancelIntent}. A zero hash
16422
+ * (`0x000…0`) means there is no open intent for the pair.
16423
+ *
16424
+ * @param params.user - The partner's EVM address on Sonic.
16425
+ * @param params.fromToken - Input (fee) token, hub-chain address.
16426
+ * @param params.toToken - Output token, hub-chain address.
16427
+ * @returns A `Result` containing the intent hash, or an `Error` tagged `LOOKUP_FAILED`.
16428
+ */
16429
+ getUserIntent({ user, fromToken, toToken }: GetUserIntentParams): Promise<Result<Hex, Error>>;
16430
+ /**
16431
+ * Reads the full {@link Intent} details for a stored intent hash from the ProtocolIntents contract.
16432
+ *
16433
+ * Useful for displaying a stuck intent before cancelling it — e.g. the locked `inputAmount` and
16434
+ * `inputToken`. Pair with {@link getUserIntent} to resolve the hash from a token pair.
16435
+ *
16436
+ * @param intentHash - The intent hash (from {@link getUserIntent}).
16437
+ * @returns A `Result` containing the `Intent`, or an `Error` tagged `LOOKUP_FAILED`.
16438
+ */
16439
+ getIntentDetails(intentHash: Hex): Promise<Result<Intent, Error>>;
15813
16440
  }
15814
16441
 
15815
16442
  type PartnerServiceConfig = {
@@ -15933,6 +16560,481 @@ declare class RecoveryService {
15933
16560
  withdrawHubAsset<K extends SpokeChainKey, Raw extends boolean>(_params: WithdrawHubAssetAction<K, Raw>): Promise<Result<TxReturnType<K, Raw>>>;
15934
16561
  }
15935
16562
 
16563
+ /**
16564
+ * leverageYield module narrow error types.
16565
+ *
16566
+ * The service owns the full vault-swap lifecycle: `deposit` / `withdraw` build
16567
+ * `CreateIntentParams`, `createVaultIntent` submits the intent on the source spoke chain,
16568
+ * and `vaultSwap` orchestrates the end-to-end flow (create → verify → relay → notify
16569
+ * solver). `approve` / `isAllowanceValid` manage the underlying-asset allowance on Sonic,
16570
+ * and the read methods query on-chain state.
16571
+ *
16572
+ * User-facing actions discriminated by `context.action`: `'deposit' | 'withdraw' |
16573
+ * 'approve' | 'vaultSwap'`. Read-only methods emit `LOOKUP_FAILED` partitioned by
16574
+ * `context.method`. Relay/verify codes appear only on `vaultSwap` — `createVaultIntent`
16575
+ * alone emits the create-intent subset.
16576
+ */
16577
+
16578
+ declare const leverageYieldInvariant: FeatureInvariant;
16579
+ type LeverageYieldAction = 'deposit' | 'withdraw' | 'approve' | 'allowanceCheck' | 'vaultSwap';
16580
+ type LeverageYieldCreateIntentErrorCode = CreateIntentErrorCode;
16581
+ type LeverageYieldApproveErrorCode = ApproveErrorCode;
16582
+ type LeverageYieldAllowanceCheckErrorCode = AllowanceCheckErrorCode;
16583
+ type LeverageYieldLookupErrorCode = LookupErrorCode;
16584
+ /**
16585
+ * Codes returnable by the solver-notify step inside `vaultSwap`. Mirrors the swap
16586
+ * domain's `PostExecutionErrorCode` — duplicated deliberately so the leverage-yield
16587
+ * error surface stands alone (see `vaultSwap`).
16588
+ */
16589
+ type LeverageYieldPostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
16590
+ /**
16591
+ * Codes returnable by the end-to-end `vaultSwap` orchestrator: the create-intent subset
16592
+ * plus verify, relay and solver-notify codes. Mirrors the swap domain's `SwapErrorCode`.
16593
+ */
16594
+ type LeverageYieldSwapErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
16595
+ type LeverageYieldErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'APPROVE_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'LOOKUP_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
16596
+ type LeverageYieldCreateIntentError = SodaxError<LeverageYieldCreateIntentErrorCode>;
16597
+ type LeverageYieldApproveError = SodaxError<LeverageYieldApproveErrorCode>;
16598
+ type LeverageYieldAllowanceCheckError = SodaxError<LeverageYieldAllowanceCheckErrorCode>;
16599
+ type LeverageYieldLookupError = SodaxError<LeverageYieldLookupErrorCode>;
16600
+ type LeverageYieldPostExecutionError = SodaxError<LeverageYieldPostExecutionErrorCode>;
16601
+ type LeverageYieldSwapError = SodaxError<LeverageYieldSwapErrorCode>;
16602
+ type LeverageYieldError = SodaxError<LeverageYieldErrorCode>;
16603
+ declare const isLeverageYieldCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
16604
+ declare const isLeverageYieldApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
16605
+ declare const isLeverageYieldAllowanceCheckError: (e: unknown) => e is SodaxError<AllowanceCheckErrorCode>;
16606
+ declare const isLeverageYieldLookupError: (e: unknown) => e is SodaxError<LookupErrorCode>;
16607
+ declare const isLeverageYieldPostExecutionError: (e: unknown) => e is SodaxError<LeverageYieldPostExecutionErrorCode>;
16608
+ declare const isLeverageYieldSwapError: (e: unknown) => e is SodaxError<LeverageYieldSwapErrorCode>;
16609
+ declare const isLeverageYieldError: (e: unknown) => e is SodaxError<LeverageYieldErrorCode>;
16610
+
16611
+ /**
16612
+ * Leveraged-position snapshot from the vault's non-standard `getPositionDetails()`.
16613
+ * Field scales (mirroring the AAVE conventions the vault inherits):
16614
+ */
16615
+ type LeverageYieldPosition = {
16616
+ /** Collateral supplied to the AAVE pool, in vault-asset units (18 decimals). */
16617
+ collateral: bigint;
16618
+ /** Variable debt borrowed against the collateral, in vault-asset units (18 decimals). */
16619
+ debt: bigint;
16620
+ /** Current loan-to-value in basis points (out of `10_000`; e.g. `8_500` = 85%). */
16621
+ ltv: bigint;
16622
+ /** AAVE health factor in WAD (1e18); below `1e18` implies liquidation risk, `type(uint256).max` = no debt. */
16623
+ healthFactor: bigint;
16624
+ /** Asset held by the vault but not yet supplied to the pool, in vault-asset units (18 decimals). */
16625
+ idleAsset: bigint;
16626
+ };
16627
+ /**
16628
+ * Output of {@link LeverageYieldService.getApr}. All rate fields are in RAY (1e27 = 100%)
16629
+ * matching the AAVE convention — divide by `RAY = 10n ** 27n` for the decimal form.
16630
+ *
16631
+ * `netAprRay` is the headline number a UI shows: net APR earned by a depositor at the
16632
+ * vault's `targetLTV`. It's a STEADY-STATE APR, not realised APY — assumes the AAVE rates
16633
+ * stay constant and the vault holds at `targetLTV` continuously. Realised APY in practice
16634
+ * depends on tick cadence, rate volatility, and the spread between supplyApr and borrowApr.
16635
+ *
16636
+ * The math:
16637
+ * ```
16638
+ * leverageMultiplier = targetLTV / (1 - targetLTV) // e.g. 0.85 / 0.15 = 5.667x
16639
+ * netAprRay = supplyAprRay + leverageMultiplier × (supplyAprRay - borrowAprRay)
16640
+ * ```
16641
+ * Equivalent to the geometric-series limit of recursive borrow → swap → supply at the
16642
+ * vault's target LTV. When `supplyApr > borrowApr` the leverage adds yield; when the
16643
+ * spread inverts the loop is a net cost and `netAprRay` goes negative.
16644
+ */
16645
+ type LeverageYieldApr = {
16646
+ /** AAVE supply rate of the vault's `asset` (sodaWEETH-style), in RAY. */
16647
+ supplyAprRay: bigint;
16648
+ /** AAVE variable borrow rate of the vault's `borrowToken` (sodaETH-style), in RAY. */
16649
+ borrowAprRay: bigint;
16650
+ /** Target LTV in basis points, as read from `vault.targetLTV()`. */
16651
+ targetLtvBps: bigint;
16652
+ /**
16653
+ * Leverage multiplier ×1e18 (e.g. 5.667x is `5_666_666_666_666_666_667n`). Caller can
16654
+ * divide by `10n ** 18n` for the decimal form.
16655
+ */
16656
+ leverageMultiplierWad: bigint;
16657
+ /** Net APR earned by a depositor at `targetLtvBps`, in RAY. Can be negative. */
16658
+ netAprRay: bigint;
16659
+ };
16660
+ /**
16661
+ * Off-chain LSD staking-APR snapshot for a leverage-yield vault's underlying asset.
16662
+ * Returned by {@link LeverageYieldService.getLsdApr} and embedded in
16663
+ * {@link LeverageYieldEffectiveApr}.
16664
+ */
16665
+ type LeverageYieldLsdApr = {
16666
+ /** LSD staking APR in RAY (1e27 = 100%). Zero when the vault has no configured LSD source. */
16667
+ aprRay: bigint;
16668
+ /** Human-readable provider label, e.g. `'Lido (stETH)'` (suffixed with `(fallback)` on error). */
16669
+ label: string;
16670
+ /**
16671
+ * `true` when this value came from the hardcoded `fallbackAprPct` rather than a live
16672
+ * fetch — either because the provider has no live endpoint (`manual`), the network
16673
+ * call failed, or the vault has no LSD source configured. UIs should label the value
16674
+ * as an estimate in this state.
16675
+ */
16676
+ stale: boolean;
16677
+ };
16678
+ /**
16679
+ * Combined AAVE + LSD APR view — extends {@link LeverageYieldApr} with the LSD staking
16680
+ * yield folded into the supply side. Returned by {@link LeverageYieldService.getEffectiveApr}.
16681
+ *
16682
+ * The `netAprRay` inherited from {@link LeverageYieldApr} is the **AAVE-only** number —
16683
+ * the negative-spread case the SDK historically reported. `effectiveNetAprRay` is the
16684
+ * honest one for LSD-backed strategies because it includes the LSD's native staking yield,
16685
+ * which is the dominant component for these vaults.
16686
+ */
16687
+ type LeverageYieldEffectiveApr = LeverageYieldApr & {
16688
+ /** LSD staking APR snapshot used to compute the effective rates. */
16689
+ lsdApr: LeverageYieldLsdApr;
16690
+ /** `supplyAprRay + lsdApr.aprRay`, in RAY — the yield the supply side actually earns. */
16691
+ effectiveSupplyAprRay: bigint;
16692
+ /**
16693
+ * `effectiveSupplyAprRay + leverage × (effectiveSupplyAprRay − borrowAprRay)`, in RAY.
16694
+ * The headline number a UI should display.
16695
+ */
16696
+ effectiveNetAprRay: bigint;
16697
+ };
16698
+ /**
16699
+ * Builds the swap payload for a swap-style leverage-yield deposit — swapping any
16700
+ * solver-supported `inputToken` on `srcChainKey` into the vault's lsoda* share token,
16701
+ * delivered to the user's hub wallet on Sonic. Spread the result into `swaps.swap()`.
16702
+ */
16703
+ type LeverageYieldSwapDepositParams = {
16704
+ /** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
16705
+ vault: Address;
16706
+ /** Spoke chain the user holds `inputToken` on and signs from. */
16707
+ srcChainKey: SpokeChainKey;
16708
+ /** User's EOA on `srcChainKey`. */
16709
+ srcAddress: string;
16710
+ /** Spoke-side token the user pays in. */
16711
+ inputToken: string;
16712
+ /** Amount of `inputToken` to swap (input-token decimals). */
16713
+ inputAmount: bigint;
16714
+ /** Minimum acceptable lsoda* output (18 decimals). Slippage already applied. */
16715
+ minOutputAmount: bigint;
16716
+ /** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
16717
+ deadline?: bigint;
16718
+ /** Optional specific solver. `0x0` = any solver. */
16719
+ solver?: Address;
16720
+ /**
16721
+ * Partner fee for this deposit, carried on the payload as the swap layer's per-intent
16722
+ * fee override. Defaults to the effective swap fee (`config.swapPartnerFee` = the `swaps`
16723
+ * override if set, else the global `fee`).
16724
+ */
16725
+ partnerFee?: PartnerFee;
16726
+ };
16727
+ /**
16728
+ * Builds the swap payload for a swap-style leverage-yield withdraw — swapping the vault's
16729
+ * lsoda* shares (held in the user's hub wallet) back into any solver-supported token on
16730
+ * any chain. The payload carries `hubWalletSwap: true`; spread it into `swaps.swap()`,
16731
+ * which authorises the hub wallet via `Connection.sendMessage`.
16732
+ */
16733
+ type LeverageYieldSwapWithdrawParams = {
16734
+ /** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
16735
+ vault: Address;
16736
+ /** Spoke chain the user signs the `sendMessage` from (drives hub-wallet derivation). */
16737
+ srcChainKey: SpokeChainKey;
16738
+ /** User's EOA on `srcChainKey`. */
16739
+ srcAddress: string;
16740
+ /** Output chain — where the solver delivers the swapped-back token. */
16741
+ dstChainKey: SpokeChainKey;
16742
+ /** Output spoke-side token address. */
16743
+ outputToken: string;
16744
+ /** Amount of lsoda* shares to swap (18 decimals). */
16745
+ inputAmount: bigint;
16746
+ /** Minimum acceptable output (output-token decimals). Slippage already applied. */
16747
+ minOutputAmount: bigint;
16748
+ /** Recipient on `dstChainKey`. Defaults to `srcAddress`. */
16749
+ recipient?: string;
16750
+ /** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
16751
+ deadline?: bigint;
16752
+ /** Optional specific solver. `0x0` = any solver. */
16753
+ solver?: Address;
16754
+ };
16755
+ /**
16756
+ * Action-shaped swap payload built by {@link LeverageYieldService.deposit} /
16757
+ * {@link LeverageYieldService.withdraw}. Spread it into
16758
+ * {@link LeverageYieldService.vaultSwap} (or {@link LeverageYieldService.createVaultIntent})
16759
+ * alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
16760
+ * `withdraw` sets `hubWalletSwap: true` so the swap spends the lsoda* held in the
16761
+ * user's hub wallet.
16762
+ */
16763
+ type LeverageYieldSwapPayload = {
16764
+ params: CreateIntentParams;
16765
+ hubWalletSwap?: true;
16766
+ /** Per-intent partner-fee override (deposit only). */
16767
+ partnerFee?: PartnerFee;
16768
+ };
16769
+ /**
16770
+ * Exec-mode params for {@link LeverageYieldService.createVaultIntent} /
16771
+ * {@link LeverageYieldService.vaultSwap}: `walletProvider` is required and K-narrowed
16772
+ * (`raw: true` returns unsigned tx data instead). The two vault-specific execution
16773
+ * modifiers live HERE — on the leverage-yield action wrapper, never on the generic swap
16774
+ * surface:
16775
+ * - `hubWalletSwap` marks `params.inputToken` as a hub-chain token already sitting in the
16776
+ * user's hub wallet — `srcChainKey` is then the chain the user *signs* on, and the
16777
+ * intent is created by authorising the hub wallet via a `Connection.sendMessage`
16778
+ * instead of a spoke-side AssetManager deposit.
16779
+ * - `partnerFee` overrides the effective swap fee (`config.swapPartnerFee`) for this
16780
+ * intent only.
16781
+ */
16782
+ type VaultSwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>> & {
16783
+ hubWalletSwap?: boolean;
16784
+ partnerFee?: PartnerFee;
16785
+ };
16786
+ /**
16787
+ * Success value of {@link LeverageYieldService.createVaultIntent}. Mirrors the swap
16788
+ * domain's `CreateIntentResult` — duplicated deliberately so the leverage-yield surface
16789
+ * stands alone.
16790
+ */
16791
+ type CreateVaultIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
16792
+ tx: TxReturnType<K, Raw>;
16793
+ intent: Intent & FeeAmount;
16794
+ relayData: RelayExtraData;
16795
+ };
16796
+ /**
16797
+ * Success value of {@link LeverageYieldService.vaultSwap}. Mirrors the swap domain's
16798
+ * `SwapResponse` — duplicated deliberately so the leverage-yield surface stands alone.
16799
+ */
16800
+ type VaultSwapResponse = {
16801
+ solverExecutionResponse: SolverExecutionResponse;
16802
+ intent: Intent;
16803
+ intentDeliveryInfo: IntentDeliveryInfo;
16804
+ };
16805
+ type LeverageYieldApproveParams<R extends boolean> = {
16806
+ vault: Address;
16807
+ /** Amount of the vault's underlying asset to approve. */
16808
+ amount: bigint;
16809
+ walletProvider: IEvmWalletProvider;
16810
+ raw?: R;
16811
+ };
16812
+ type LeverageYieldAllowanceParams = {
16813
+ vault: Address;
16814
+ amount: bigint;
16815
+ owner: Address;
16816
+ };
16817
+ type LeverageYieldServiceConstructorParams = {
16818
+ hubProvider: HubProvider;
16819
+ config: ConfigService;
16820
+ spoke: SpokeService;
16821
+ };
16822
+ /**
16823
+ * Treats leverage-yield ERC-4626 vault shares (lsoda* tokens) as solver-tradeable tokens:
16824
+ * deposits and withdrawals are intent-based swaps the service executes itself via
16825
+ * `vaultSwap()` — the generic swap surface stays untouched by vault concerns.
16826
+ *
16827
+ * Methods:
16828
+ * - `deposit` / `withdraw` — build a {@link LeverageYieldSwapPayload} for a swap-style deposit
16829
+ * (any token → lsoda*) and withdraw (lsoda* → any token); spread the result into
16830
+ * `vaultSwap()`. `withdraw` sets `hubWalletSwap: true` so the vault swap spends the lsoda*
16831
+ * held in the user's hub wallet via a `Connection.sendMessage`.
16832
+ * - `createVaultIntent` / `vaultSwap` / `notifySolver` — leverage-yield copies of the swap
16833
+ * domain's `createIntent` / `swap()` / `postExecution` (duplicated deliberately — the vault
16834
+ * execution modifiers `hubWalletSwap` and per-intent `partnerFee` live here, not on the swap
16835
+ * domain). `createVaultIntent` submits the intent tx on the source spoke chain; `vaultSwap`
16836
+ * orchestrates the full create → verify → relay → notify-solver lifecycle; `notifySolver` is
16837
+ * the standalone notify step, public so callers driving the relay themselves (after a
16838
+ * `createVaultIntent`) can complete the flow.
16839
+ * - `approve` / `isAllowanceValid` — Sonic-direct allowance management for the vault's
16840
+ * underlying asset (sodaWEETH-style).
16841
+ * - `getPosition` / `getApr` / `getEffectiveApr` / `getLsdApr` / `getMaxWithdraw` /
16842
+ * `getMaxWithdrawForUser` / `getShareBalance` / `getShareBalanceForUser` /
16843
+ * `getTotalAssets` / `previewDeposit` / `previewWithdraw` / `previewRedeem` — reads.
16844
+ * Use `getEffectiveApr` for the honest LSD-aware APR; `getApr` reports the AAVE-only
16845
+ * spread and goes negative when the LSD's native staking yield is the alpha source.
16846
+ * - `listVaults` / `getVault` / `getVaultByAddress` — registry lookups.
16847
+ */
16848
+ declare class LeverageYieldService {
16849
+ private readonly hubProvider;
16850
+ private readonly config;
16851
+ private readonly spoke;
16852
+ constructor({ hubProvider, config, spoke }: LeverageYieldServiceConstructorParams);
16853
+ /** Returns the static registry of known leverage-yield vaults. */
16854
+ listVaults(): readonly LeverageYieldVault[];
16855
+ /** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
16856
+ getVault(name: string): LeverageYieldVault | undefined;
16857
+ /**
16858
+ * Looks up a registered vault by its on-chain proxy address (case-insensitive).
16859
+ * Returns `undefined` when the address isn't in the registry.
16860
+ */
16861
+ getVaultByAddress(address: Address): LeverageYieldVault | undefined;
16862
+ /**
16863
+ * Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
16864
+ * derives a default from the hub-chain (Sonic) block timestamp plus
16865
+ * {@link INTENT_DEADLINE_BUFFER_SECONDS}. The deadline is enforced on-chain against the hub
16866
+ * block time, so the default is anchored to that block — never the client clock, which can
16867
+ * drift and produce an already-expired or over-extended deadline.
16868
+ *
16869
+ * Returns a {@link Result}: a `getBlock` RPC outage is a read failure, surfaced as
16870
+ * `LOOKUP_FAILED` (`method: 'resolveDeadline'`) rather than masquerading as an intent-build
16871
+ * failure. The `deposit` / `withdraw` callers forward it verbatim.
16872
+ */
16873
+ private resolveDeadline;
16874
+ /**
16875
+ * Builds the {@link LeverageYieldSwapPayload} for a leverage-yield deposit (any token → lsoda*).
16876
+ * The lsoda* output is delivered to the user's hub wallet on Sonic so a later
16877
+ * {@link LeverageYieldService.withdraw} can swap it back. Spread the result into
16878
+ * {@link LeverageYieldService.vaultSwap}: `vaultSwap({ ...payload, walletProvider })`.
16879
+ * An optional `partnerFee` is forwarded on the payload as the per-intent fee override.
16880
+ *
16881
+ * For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
16882
+ * destination token (`token_dst`) — vault shares are solver-tradeable, so the generic swap
16883
+ * quote applies; then subtract your slippage tolerance.
16884
+ */
16885
+ deposit(params: LeverageYieldSwapDepositParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
16886
+ /**
16887
+ * Builds the {@link LeverageYieldSwapPayload} for a leverage-yield withdraw (lsoda* → any
16888
+ * token). The payload carries `hubWalletSwap: true` — {@link LeverageYieldService.vaultSwap}
16889
+ * then spends the lsoda* held in the user's hub wallet by authorising it via a
16890
+ * `Connection.sendMessage` the user signs on `srcChainKey`. Wrapped in a {@link Result} for
16891
+ * a call shape uniform with {@link LeverageYieldService.deposit}; async because the default
16892
+ * `deadline` is read from the hub block timestamp.
16893
+ *
16894
+ * For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
16895
+ * source token (`token_src`) — vault shares are solver-tradeable, so the generic swap quote
16896
+ * applies; then subtract your slippage tolerance.
16897
+ */
16898
+ withdraw(params: LeverageYieldSwapWithdrawParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
16899
+ /**
16900
+ * Creates a vault swap intent on the user's source spoke chain without submitting it to
16901
+ * the solver. Leverage-yield copy of the swap domain's `createIntent`, specialised for
16902
+ * vault flows — duplicated deliberately so the vault-specific execution modifiers
16903
+ * (`hubWalletSwap`, per-intent `partnerFee`) stay off the generic swap surface.
16904
+ *
16905
+ * Use {@link LeverageYieldService.vaultSwap} for the full end-to-end flow
16906
+ * (create → relay → notify solver); use this directly when you need the raw transaction
16907
+ * or drive the relay yourself (e.g. the backend submit-tx path). To complete a manual flow,
16908
+ * relay the returned `relayData` (the shared `relayTxAndWaitPacket` helper) and then call
16909
+ * {@link LeverageYieldService.notifySolver} with the hub-side intent tx hash.
16910
+ *
16911
+ * @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
16912
+ * and optional `skipSimulation` / `hubWalletSwap` / `partnerFee`.
16913
+ * @returns A `Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>`.
16914
+ * On success contains:
16915
+ * - `tx` — chain-specific tx hash (executed) or raw tx data (raw mode).
16916
+ * - `intent` — the fully constructed `Intent` object augmented with `feeAmount`.
16917
+ * - `relayData` — `{ address, payload }` needed to submit the intent to the relayer.
16918
+ *
16919
+ * On failure `result.error` is a SodaxError with `VALIDATION_FAILED` (invariant
16920
+ * precondition), `INTENT_CREATION_FAILED` (spoke-side creation/deposit failed) or
16921
+ * `UNKNOWN` (defensive fallback).
16922
+ */
16923
+ createVaultIntent<K extends SpokeChainKey, Raw extends boolean>(_params: VaultSwapActionParams<K, Raw>): Promise<Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>>;
16924
+ /**
16925
+ * Executes a full end-to-end leverage-yield vault swap (deposit or withdraw).
16926
+ * Leverage-yield copy of the swap domain's `swap()` orchestrator:
16927
+ * 1. Calls {@link LeverageYieldService.createVaultIntent} to submit the intent
16928
+ * transaction on the source spoke chain.
16929
+ * 2. Verifies the spoke transaction landed on-chain.
16930
+ * 3. For non-hub source chains: submits the spoke tx to the relayer and waits for the
16931
+ * relay packet to land on the hub (Sonic). Skipped when `srcChainKey` is the hub.
16932
+ * 4. Notifies the solver, triggering it to fill the intent.
16933
+ *
16934
+ * Spread a {@link LeverageYieldSwapPayload} from `deposit` / `withdraw` into this method
16935
+ * alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
16936
+ *
16937
+ * @returns A `Result<VaultSwapResponse, LeverageYieldSwapError>`. On success:
16938
+ * - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
16939
+ * - `intent` — the on-chain intent object that was created.
16940
+ * - `intentDeliveryInfo` — source/destination chain keys, tx hashes, and user addresses.
16941
+ *
16942
+ * On failure `result.error` carries one of the create-intent codes plus
16943
+ * `TX_VERIFICATION_FAILED`, `TX_SUBMIT_FAILED`, `RELAY_TIMEOUT`, `RELAY_FAILED`,
16944
+ * `EXECUTION_FAILED`, `EXTERNAL_API_ERROR` or `UNKNOWN`.
16945
+ */
16946
+ vaultSwap<K extends SpokeChainKey>(_params: VaultSwapActionParams<K, false>): Promise<Result<VaultSwapResponse, LeverageYieldSwapError>>;
16947
+ /**
16948
+ * Notifies the solver that the vault intent landed on the hub, triggering it to fill.
16949
+ * Leverage-yield copy of the swap domain's `postExecution` — emits only
16950
+ * `EXECUTION_FAILED` / `EXTERNAL_API_ERROR` / `UNKNOWN` (relay/verify codes appear only
16951
+ * on {@link LeverageYieldService.vaultSwap}, which owns the verify + relay steps).
16952
+ *
16953
+ * Called automatically by {@link LeverageYieldService.vaultSwap} after the relay packet
16954
+ * lands on the hub. Public so callers who created the intent via
16955
+ * {@link LeverageYieldService.createVaultIntent} and relayed it themselves can finish the
16956
+ * flow manually.
16957
+ *
16958
+ * @param request - `{ intent_tx_hash }` — the hub-chain (Sonic) tx hash where the intent
16959
+ * was registered (the relay packet's `dst_tx_hash`, or the spoke tx hash for hub-sourced
16960
+ * intents).
16961
+ */
16962
+ notifySolver(request: SolverExecutionRequest): Promise<Result<SolverExecutionResponse, LeverageYieldPostExecutionError>>;
16963
+ /**
16964
+ * Approves the vault's underlying asset to the leverage vault on Sonic. For callers
16965
+ * interacting with the vault directly on the hub — the swap-style {@link
16966
+ * LeverageYieldService.deposit} flow handles its own approvals.
16967
+ */
16968
+ approve<R extends boolean = false>(params: LeverageYieldApproveParams<R>): Promise<Result<TxReturnType<HubChainKey, R>, LeverageYieldApproveError>>;
16969
+ /**
16970
+ * Reads on-chain allowance of the vault's underlying asset for `owner → vault`. Returns
16971
+ * `true` when the allowance covers `amount`. Use before a direct
16972
+ * {@link LeverageYieldService.deposit}.
16973
+ */
16974
+ isAllowanceValid(params: LeverageYieldAllowanceParams): Promise<Result<boolean, LeverageYieldAllowanceCheckError>>;
16975
+ /** ERC-4626 `asset()` of the vault — the sodaWEETH-style underlying. */
16976
+ getAsset(vault: Address): Promise<Result<Address, LeverageYieldLookupError>>;
16977
+ /** Reads the vault's leveraged position snapshot via the non-standard `getPositionDetails`. */
16978
+ getPosition(vault: Address): Promise<Result<LeverageYieldPosition, LeverageYieldLookupError>>;
16979
+ /**
16980
+ * Computes the steady-state APR of a leverage-yield vault from the AAVE supply/borrow
16981
+ * rates of its asset and borrowToken, scaled by the vault's target leverage. Matches the
16982
+ * convention used by leveraged-LSD vaults (Origami, Gearbox, etc.) — assumes constant
16983
+ * LTV at `targetLTV` and constant AAVE rates.
16984
+ *
16985
+ * Returns raw fields in RAY (1e27, AAVE's native rate scale) plus the leverage multiplier
16986
+ * in WAD (1e18). See {@link LeverageYieldApr} for the formula and caveats.
16987
+ */
16988
+ getApr(vault: Address): Promise<Result<LeverageYieldApr, LeverageYieldLookupError>>;
16989
+ /**
16990
+ * Off-chain LSD staking-APR for the vault's underlying asset. Looks the vault up in the
16991
+ * registry, hits DefiLlama's per-pool chart endpoint for the configured `poolId`, and on
16992
+ * any fetch failure returns the registry's hardcoded `fallbackAprPct` with `stale: true`.
16993
+ *
16994
+ * Always resolves to `{ ok: true, ... }` for a known vault — the fallback path replaces
16995
+ * the error, since a missing LSD APR shouldn't break the parent call. Returns
16996
+ * `{ aprRay: 0n, stale: true, label: 'no LSD source' }` for vaults without an
16997
+ * `lsdSource` configured (non-LSD strategies); callers can treat that as "skip LSD".
16998
+ */
16999
+ getLsdApr(vault: Address): Promise<Result<LeverageYieldLsdApr, LeverageYieldLookupError>>;
17000
+ /**
17001
+ * Combined view of {@link getApr} + {@link getLsdApr}: re-applies the vault's leverage
17002
+ * formula with the LSD's native staking yield folded into the supply side, exposing the
17003
+ * **effective** net APR that LSD-backed strategies actually earn. The AAVE-only
17004
+ * `netAprRay` is preserved on the return value for callers who want to display both.
17005
+ *
17006
+ * effectiveSupply = supplyAprRay + lsdApr.aprRay
17007
+ * effectiveNet = effectiveSupply + leverage × (effectiveSupply − borrowAprRay)
17008
+ *
17009
+ * Fetches AAVE rates and the LSD APR in parallel for one round-trip's worth of latency.
17010
+ */
17011
+ getEffectiveApr(vault: Address): Promise<Result<LeverageYieldEffectiveApr, LeverageYieldLookupError>>;
17012
+ /** Synchronously withdrawable assets for `owner` (clamped against leverage HF floor). */
17013
+ getMaxWithdraw(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
17014
+ /** Total underlying assets currently held by the vault (vault-asset units, 18 decimals) — TVL. */
17015
+ getTotalAssets(vault: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
17016
+ /** Shares minted for a given asset deposit. */
17017
+ previewDeposit(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
17018
+ /** Shares burned for a given asset withdrawal. */
17019
+ previewWithdraw(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
17020
+ /** Assets received for a given share redemption. */
17021
+ previewRedeem(vault: Address, shares: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
17022
+ /** Vault shares held by `owner`. */
17023
+ getShareBalance(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
17024
+ /**
17025
+ * Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
17026
+ * returns its on-chain `maxWithdraw`, less {@link MAX_WITHDRAW_DUST_BUFFER}. The trim
17027
+ * keeps the value safe for an asset-denominated ERC-4626 `withdraw` — the raw
17028
+ * `maxWithdraw` can trip the round-up that asks for one more share than the user holds.
17029
+ */
17030
+ getMaxWithdrawForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
17031
+ /**
17032
+ * Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
17033
+ * returns its on-chain share balance.
17034
+ */
17035
+ getShareBalanceForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
17036
+ }
17037
+
15936
17038
  /**
15937
17039
  * Sodax class is used to interact with the Sodax.
15938
17040
  *
@@ -15944,15 +17046,17 @@ declare class Sodax {
15944
17046
  readonly moneyMarket: MoneyMarketService;
15945
17047
  readonly migration: MigrationService;
15946
17048
  readonly backendApi: BackendApiService;
17049
+ readonly api: BackendApiService;
15947
17050
  readonly bridge: BridgeService;
15948
17051
  readonly staking: StakingService;
15949
17052
  readonly partners: PartnerService;
15950
17053
  readonly recovery: RecoveryService;
15951
17054
  readonly dex: DexService;
17055
+ readonly leverageYield: LeverageYieldService;
15952
17056
  readonly config: ConfigService;
15953
17057
  readonly hubProvider: HubProvider;
15954
17058
  readonly spoke: SpokeService;
15955
- constructor(config?: DeepPartial<SodaxConfig>);
17059
+ constructor(options?: SodaxOptions);
15956
17060
  /**
15957
17061
  * Initializes the Sodax instance with dynamic configuration.
15958
17062
  * You should use this option if you do not want to update package versions when new chains and tokens are added.
@@ -16137,6 +17241,40 @@ declare class EvmSolverService {
16137
17241
  * @throws Invariant error if `inputAmount` is `0n` or if the fee percentage is out of range.
16138
17242
  */
16139
17243
  static createIntentFeeData(fee: PartnerFee | undefined, inputAmount: bigint): [Hex, bigint];
17244
+ /**
17245
+ * Recovers the partner fee amount embedded in an intent's `data` field.
17246
+ *
17247
+ * Inverse of {@link createIntentFeeData}: returns the encoded fee, regardless of whether the `data`
17248
+ * is a bare fee envelope or a multi-entry envelope that also carries delivery data. The envelope
17249
+ * parsing lives in {@link IntentDataService.extractFeePayload}; this method just decodes the fee struct.
17250
+ *
17251
+ * @param data - The intent's `data` field (`'0x'` when no fee was configured).
17252
+ * @returns The fee amount in the input token's smallest unit (`0n` when no fee is present).
17253
+ */
17254
+ static decodeIntentFeeAmount(data: Hex): bigint;
17255
+ /** Decodes a raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) to its fee amount. */
17256
+ private static decodeFeePayload;
17257
+ /**
17258
+ * Re-derives the byte-identical relay payload that `createIntent` originally produced, from a
17259
+ * fully-populated `Intent` alone.
17260
+ *
17261
+ * Mirrors the two payload shapes built at intent-creation time:
17262
+ * - Hub (Sonic) source — raw `createIntent(intent)` calldata (no approval, no multicall), matching
17263
+ * {@link SonicSpokeService.createSwapIntent}.
17264
+ * - Spoke source — the `[approve(intentsContract, gross), createIntent(intent)]` multicall, matching
17265
+ * {@link constructCreateIntentData}. The gross approval amount is recovered as
17266
+ * `intent.inputAmount + feeAmount`, where `feeAmount` comes from {@link decodeIntentFeeAmount}.
17267
+ *
17268
+ * Byte-identity holds because this reuses the exact encode primitives (`encodeCreateIntent`,
17269
+ * `Erc20Service.encodeApprove`, `encodeContractCalls`) that produced the original — the only
17270
+ * originally-random input, `intentId`, is already carried on the `Intent`.
17271
+ *
17272
+ * @param intent - The fully-populated intent (e.g. from `createIntent` or `getIntent`).
17273
+ * @param intentsContract - The hub-chain intents contract address (`config.solver.intentsContract`).
17274
+ * @param isHubSource - `true` when the intent's source chain is the hub (Sonic).
17275
+ * @returns The byte-identical relay payload `Hex`.
17276
+ */
17277
+ static reconstructCreateIntentData(intent: Intent, intentsContract: Address$1, isHubSource: boolean): Hex;
16140
17278
  /**
16141
17279
  * Reads an `Intent` struct from a hub-chain transaction receipt.
16142
17280
  *
@@ -16151,7 +17289,7 @@ declare class EvmSolverService {
16151
17289
  * @throws If the transaction contains no matching `IntentCreated` event, or if the
16152
17290
  * intent's chain IDs are not recognized.
16153
17291
  */
16154
- static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient<HttpTransport>): Promise<Intent>;
17292
+ static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient): Promise<Intent>;
16155
17293
  /**
16156
17294
  * Reads an `IntentState` struct from a hub-chain fill transaction receipt.
16157
17295
  *
@@ -16164,7 +17302,7 @@ declare class EvmSolverService {
16164
17302
  * @returns `IntentState`: `{ exists, remainingInput, receivedOutput, pendingPayment }`.
16165
17303
  * @throws If the transaction contains no matching `IntentFilled` event.
16166
17304
  */
16167
- static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient<HttpTransport>): Promise<IntentState>;
17305
+ static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient): Promise<IntentState>;
16168
17306
  /**
16169
17307
  * Computes the keccak256 hash of an intent struct, which serves as its unique ID on the hub chain.
16170
17308
  *
@@ -16193,6 +17331,89 @@ declare class EvmSolverService {
16193
17331
  static encodeCancelIntent(intent: Intent, intentsContract: Address$1): EvmContractCall;
16194
17332
  }
16195
17333
 
17334
+ /**
17335
+ * Stateless utility for the SODAX solver's delivery hooks.
17336
+ *
17337
+ * A delivery hook lets an intent's output be handed to `ISpokeReceiver(dstAddress).hook(...)` on the
17338
+ * destination spoke instead of transferred straight to the recipient. Each hook is two coupled things:
17339
+ * its **deployed address** (the registry in `@sodax/types`) and its **`deliveryData` codec** (here).
17340
+ * This class fuses them so the address and payload can never drift, and exposes a single
17341
+ * type-differentiated {@link encodeDeliveryData} rather than one encoder per hook.
17342
+ */
17343
+ declare class HookService {
17344
+ private constructor();
17345
+ /**
17346
+ * Encodes a hook's `deliveryData` payload. One common entry point for all hooks — the encoding is
17347
+ * selected by {@link HookRequest.kind} and uses that hook's schema from {@link HOOK_DELIVERY_ABI}.
17348
+ *
17349
+ * @param request - The hook selection (and any hook-specific params).
17350
+ * @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
17351
+ */
17352
+ static encodeDeliveryData(request: HookRequest, recipient: string): Hex;
17353
+ /**
17354
+ * Resolves a high-level {@link HookRequest} to the on-chain delivery pair: the deployed hook address
17355
+ * (becomes the intent's `dstAddress`) and the encoded payload the hook expects (`deliveryData`).
17356
+ * Bundling lookup + codec here guarantees the address and its payload schema can never drift.
17357
+ *
17358
+ * @param chainKey - Destination spoke chain (must have the requested hook deployed).
17359
+ * @param request - The hook selection (and any hook-specific params).
17360
+ * @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
17361
+ */
17362
+ static resolveDeliveryHook(chainKey: SpokeChainKey, request: HookRequest, recipient: string): {
17363
+ dstAddress: Address$1;
17364
+ deliveryData: Hex;
17365
+ };
17366
+ /**
17367
+ * Resolves the effective delivery target for an intent. When {@link CreateIntentParams.hook} is set,
17368
+ * routes the output through that registered hook (overriding `dstAddress` and deriving `deliveryData`);
17369
+ * otherwise returns the caller's `dstAddress` and low-level `deliveryData` unchanged. Centralised so
17370
+ * both the hub and Sonic intent constructors apply hooks identically.
17371
+ *
17372
+ * @returns `{ dstAddress, deliveryData }` — the address to deliver to and the payload to forward.
17373
+ */
17374
+ static resolveDelivery(params: CreateIntentParams): {
17375
+ dstAddress: string;
17376
+ deliveryData: Hex | undefined;
17377
+ };
17378
+ }
17379
+
17380
+ /**
17381
+ * Stateless utility for the `Intent.data` envelope layer.
17382
+ *
17383
+ * `Intent.data` carries zero or more typed entries (a partner-fee payload, a delivery payload, …).
17384
+ * This class owns how those entries are packed into bytes the on-chain `IntentDataLib` decodes and
17385
+ * how they are recovered back out, keeping the `ArrayData` codec ({@link ARRAY_DATA_ABI}) in one
17386
+ * place. The delivery payloads themselves are produced by `HookService`; this layer is agnostic to
17387
+ * their contents and simply folds them in alongside the fee.
17388
+ */
17389
+ declare class IntentDataService {
17390
+ private constructor();
17391
+ /**
17392
+ * Folds a partner-fee envelope and an optional delivery payload into the final `Intent.data`:
17393
+ * - Neither → `'0x'`.
17394
+ * - Exactly one → that single packed `[uint8 type, bytes payload]` envelope (byte-identical to a
17395
+ * bare fee envelope, so a fee-only intent's `data` is unchanged and stays decode-stable).
17396
+ * - Both → a `TYPE_ARRAY` envelope wrapping `[FEE, DELIVERY]` entries.
17397
+ *
17398
+ * @param feeEnvelope - The packed fee envelope from `EvmSolverService.createIntentFeeData` (`'0x'` if no fee).
17399
+ * @param deliveryData - Opaque delivery payload (e.g. from `HookService.encodeDeliveryData`), or `undefined`.
17400
+ */
17401
+ static composeIntentData(feeEnvelope: Hex, deliveryData?: Hex): Hex;
17402
+ /**
17403
+ * Encodes a list of typed `IntentData` entries into the `Intent.data` bytes the contract decodes.
17404
+ * Empty → `'0x'`; single → a packed `[uint8 type, bytes payload]` envelope; multiple → a `TYPE_ARRAY`
17405
+ * envelope wrapping the entries as `ArrayData { DataEntry[] }`.
17406
+ */
17407
+ static encodeIntentData(entries: IntentData[]): Hex;
17408
+ /**
17409
+ * Extracts the raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) from an intent's
17410
+ * `data`, unwrapping whichever envelope shape it uses. Returns `undefined` when there is no fee:
17411
+ * empty `data`, a delivery-only envelope, or an unknown type byte (logged). Used by
17412
+ * `EvmSolverService.decodeIntentFeeAmount` to recover fees regardless of delivery data.
17413
+ */
17414
+ static extractFeePayload(data: Hex): Hex | undefined;
17415
+ }
17416
+
16196
17417
  /**
16197
17418
  * Stateless HTTP client for the SODAX solver API.
16198
17419
  *
@@ -16233,7 +17454,7 @@ declare class SolverApiService {
16233
17454
  * @param config - Solver endpoint configuration.
16234
17455
  * @returns A `Result` containing `{ answer: 'OK', intent_hash: Hex }` on success.
16235
17456
  */
16236
- static postExecution(request: SolverExecutionRequest, config: SolverConfig): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
17457
+ static postExecution(request: SolverExecutionRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
16237
17458
  /**
16238
17459
  * Polls the solver API for the current execution status of an intent (`POST /status`).
16239
17460
  *
@@ -16243,7 +17464,7 @@ declare class SolverApiService {
16243
17464
  * `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
16244
17465
  * @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
16245
17466
  */
16246
- static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
17467
+ static getStatus(request: SolverIntentStatusRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
16247
17468
  }
16248
17469
 
16249
17470
  /**
@@ -16266,7 +17487,7 @@ declare class StakingLogic {
16266
17487
  * @param publicClient - Viem public client connected to the hub chain.
16267
17488
  * @returns Array of `UserUnstakeInfo` records for all active unstake requests.
16268
17489
  */
16269
- static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
17490
+ static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient): Promise<readonly UserUnstakeInfo[]>;
16270
17491
  /**
16271
17492
  * Encodes the depositFor transaction data.
16272
17493
  * @param stakedSoda - The address of the StakedSoda contract.
@@ -16318,7 +17539,7 @@ declare class StakingLogic {
16318
17539
  * @param publicClient - Viem public client connected to the hub chain.
16319
17540
  * @returns Total SODA deposited across all stakers.
16320
17541
  */
16321
- static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17542
+ static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient): Promise<bigint>;
16322
17543
  /**
16323
17544
  * Calculates the number of xSoda shares equivalent to a given amount of SODA assets (`convertToShares`).
16324
17545
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16326,7 +17547,7 @@ declare class StakingLogic {
16326
17547
  * @param publicClient - Viem public client connected to the hub chain.
16327
17548
  * @returns The xSoda share count equivalent to `assets` at the current exchange rate.
16328
17549
  */
16329
- static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17550
+ static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
16330
17551
  /**
16331
17552
  * Calculates the SODA asset amount corresponding to a given number of xSoda shares (`convertToAssets`).
16332
17553
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16334,7 +17555,7 @@ declare class StakingLogic {
16334
17555
  * @param publicClient - Viem public client connected to the hub chain.
16335
17556
  * @returns The SODA asset amount equivalent to `shares` at the current exchange rate.
16336
17557
  */
16337
- static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17558
+ static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
16338
17559
  /**
16339
17560
  * Simulates a SODA deposit into the xSoda vault (`previewDeposit`) without executing it.
16340
17561
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16342,7 +17563,7 @@ declare class StakingLogic {
16342
17563
  * @param publicClient - Viem public client connected to the hub chain.
16343
17564
  * @returns The xSoda shares that would be minted for `assets`.
16344
17565
  */
16345
- static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17566
+ static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
16346
17567
  /**
16347
17568
  * Simulates minting a specific number of xSoda shares (`previewMint`) without executing it.
16348
17569
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16350,7 +17571,7 @@ declare class StakingLogic {
16350
17571
  * @param publicClient - Viem public client connected to the hub chain.
16351
17572
  * @returns The SODA assets that would need to be deposited to mint `shares`.
16352
17573
  */
16353
- static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17574
+ static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
16354
17575
  /**
16355
17576
  * Simulates withdrawing a specific SODA amount from the xSoda vault (`previewWithdraw`) without executing it.
16356
17577
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16358,7 +17579,7 @@ declare class StakingLogic {
16358
17579
  * @param publicClient - Viem public client connected to the hub chain.
16359
17580
  * @returns The xSoda shares that would be burned to withdraw `assets`.
16360
17581
  */
16361
- static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17582
+ static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
16362
17583
  /**
16363
17584
  * Simulates redeeming a specific number of xSoda shares (`previewRedeem`) without executing it.
16364
17585
  * @param xSoda - The address of the xSoda ERC-4626 vault contract.
@@ -16366,7 +17587,7 @@ declare class StakingLogic {
16366
17587
  * @param publicClient - Viem public client connected to the hub chain.
16367
17588
  * @returns The SODA assets that would be withdrawn for `shares`.
16368
17589
  */
16369
- static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17590
+ static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
16370
17591
  /**
16371
17592
  * Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
16372
17593
  * @param xSoda - The address of the xSoda token contract.
@@ -16432,7 +17653,7 @@ declare class StakingLogic {
16432
17653
  * @param publicClient - Viem public client connected to the hub chain.
16433
17654
  * @returns Tuple `[xSodaAmount, previewDepositAmount]` — estimated shares and vault preview figure.
16434
17655
  */
16435
- static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
17656
+ static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<readonly [bigint, bigint]>;
16436
17657
  /**
16437
17658
  * Estimates the SODA output for instantly unstaking a given xSoda amount.
16438
17659
  *
@@ -16445,7 +17666,7 @@ declare class StakingLogic {
16445
17666
  * @param publicClient - Viem public client connected to the hub chain.
16446
17667
  * @returns The estimated SODA output for the instant unstake.
16447
17668
  */
16448
- static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
17669
+ static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<bigint>;
16449
17670
  }
16450
17671
 
16451
17672
  declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
@@ -16457,7 +17678,7 @@ declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxC
16457
17678
 
16458
17679
  declare const partnerInvariant: FeatureInvariant;
16459
17680
  type PartnerAction = 'waitAutoSwap';
16460
- type PartnerErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
17681
+ type PartnerErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
16461
17682
  type PartnerError = SodaxError<PartnerErrorCode>;
16462
17683
  declare const isPartnerError: (e: unknown) => e is SodaxError<PartnerErrorCode>;
16463
17684
 
@@ -16475,5 +17696,13 @@ declare const dexInvariant: FeatureInvariant;
16475
17696
  type DexErrorCode = LookupErrorCode;
16476
17697
  type DexError = SodaxError<DexErrorCode>;
16477
17698
  declare const isDexError: (e: unknown) => e is SodaxError<LookupErrorCode>;
17699
+ /** Codes any DEX `executeXxx` / intent-creation method can return. */
17700
+ type DexCreateIntentErrorCode = CreateIntentErrorCode;
17701
+ type DexCreateIntentError = SodaxError<DexCreateIntentErrorCode>;
17702
+ declare const isDexCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
17703
+ /** Codes the DEX `approve` method can return. */
17704
+ type DexApproveErrorCode = ApproveErrorCode;
17705
+ type DexApproveError = SodaxError<DexApproveErrorCode>;
17706
+ declare const isDexApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
16478
17707
 
16479
- export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, type AggregatedReserveData, type AllowanceCheckErrorCode, type AllowanceInfo, type AllowanceResponse, type AllowanceTransferDetails, type ApiResponse, type ApproveErrorCode, type ApproveSonicWithdrawParams, type ApyRange, type AssetDepositAction, type AssetEntry, AssetService, type AssetServiceConstructorParams, type AssetWithdrawAction, type AutoSwapPreferences, BackendApiService, type BalnLockParams, type BalnMigrateAction, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, type BitcoinSpokeDepositParams, BitcoinSpokeService, type BitcoinTransactionResult, type BitcoinTransferToHubParams, type BitcoinUTXO, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeAction, type BridgeAllowanceCheckError, type BridgeAllowanceCheckErrorCode, type BridgeApproveError, type BridgeApproveErrorCode, type BridgeCreateIntentError, type BridgeCreateIntentErrorCode, type BridgeError, type BridgeErrorCode, type BridgeLookupError, type BridgeLookupErrorCode, type BridgeOrchestrationError, type BridgeOrchestrationErrorCode, type BridgeParams, BridgeService, type BridgeServiceConstructorParams, type BtcPayload, CREATE_INTENT_CODES, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CallResponse, type CancelIntentActionParams, type CancelIntentParams, type CancelUnstakeAction, type CancelUnstakeParams, type ClClaimRewardsParams, type ClDecreaseLiquidityParams, type ClGetPoolDataParams, type ClIncreaseLiquidityParams, type ClLiquidityClaimRewardsAction, type ClLiquidityDecreaseLiquidityAction, type ClLiquidityIncreaseLiquidityAction, type ClLiquidityWithdrawAction, type ClMintPositionEventLog, type ClPositionInfo, ClService, type ClServiceConstructorParams, type ClSupplyAction, type ClSupplyParams, type ClWithdrawParams, type ClaimAction, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, type ConcentratedLiquidityParams, type ConcentratedLiquidityTokenInfo, ConfigService, type ConfigServiceConstructorParams, type ConnMsg, type CreateAssetDepositParams, type CreateAssetWithdrawParams, type CreateBridgeIntentParams, type CreateIntentErrorCode, type CreateIntentParams, type CreateIntentResult, type CreateLimitOrderParams, type CreateSonicSwapIntentParams, type CreateViemPublicClientParams, CustomSorobanServer, CustomStellarAccount, type DepositParams, type DepositSimulationParams, type DestinationParamsType, type DetailedLock, type DexError, type DexErrorCode, DexService, type DexServiceConstructorParams, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, type EnrichedToken, type Erc20ApproveParams, type Erc20IsAllowanceParams, Erc20Service, type Erc20Token, Erc4626Service, type EstimateGasParams, EvmAssetManagerService, type EvmDepositToDataParams, EvmHubProvider, type EvmHubProviderConstructorParams, EvmSolverService, EvmSpokeService, EvmVaultTokenService, type EvmWithdrawAssetDataParams, type ExecuteMsg, type FeatureInvariant, type FeeData, type FeeTokenApproveAction, type FeeTokenApproveParams, type FetchHubAssetBalancesParams, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, GAS_ESTIMATION_CODES, type GasEstimationErrorCode, type GetDepositParams, type GetIntentSubmitTxExtraDataParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeServiceType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, type GetTxReceiptType, type GetUserRouterParams, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, HttpRelayError, type HubAssetBalance, type HubProvider, type IconCallParams, type IconJsonRpcVersion, type IconSpokeDepositParams, IconSpokeService, type IconTransferToHubParams, type IcxCreateRevertMigrationParams, type IcxMigrateAction, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRevertMigrationAction, type IcxRevertMigrationParams, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, type InjectiveBalance, InjectiveSpokeService, type InstantUnstakeAction, type InstantUnstakeParams, type InstantiateMsg, type Intent, type IntentAutoSwapResult, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentData, IntentDataType, type IntentDeliveryInfo, IntentFilledEventAbi, type IntentFilledEventLog, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentTxResult, IntentsAbi, type JsonRpcPayloadResponse, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, type LendingPoolServiceConstructorParams, type LimitOrderActionParams, LockupMultiplier, LockupPeriod, type LookupErrorCode, type MapRelayFailureCtx, type MigrateOrchestrationError, type MigrateOrchestrationErrorCode, type MigrationAction, type MigrationAllowanceCheckError, type MigrationAllowanceCheckErrorCode, type MigrationApproveError, type MigrationApproveErrorCode, type MigrationCreateIntentError, type MigrationCreateIntentErrorCode, type MigrationDirection, type MigrationError, type MigrationErrorCode, type MigrationLookupError, type MigrationLookupErrorCode, type MigrationOp, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConstructorParams, type MigrationTokens, MintPositionEventAbi, type MintPositionEventLog, type MoneyMarketAction, type MoneyMarketAllowanceCheckError, type MoneyMarketAllowanceCheckErrorCode, type MoneyMarketAllowanceParams, type MoneyMarketApproveActionParams, type MoneyMarketApproveError, type MoneyMarketApproveErrorCode, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowActionParams, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketCreateIntentError, type MoneyMarketCreateIntentErrorCode, MoneyMarketDataService, type MoneyMarketDataServiceConstructorParams, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketGasEstimationError, type MoneyMarketGasEstimationErrorCode, type MoneyMarketOrchestrationError, type MoneyMarketOrchestrationErrorCode, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayActionParams, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConstructorParams, type MoneyMarketSupplyActionParams, type MoneyMarketSupplyParams, type MoneyMarketWithdrawActionParams, type MoneyMarketWithdrawParams, NEAR_DEFAULT_GAS, NearSpokeService, type OnDemandBtcPayload, type OptionalRaw, type OptionalSkipSimulation, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerAction, type PartnerError, type PartnerErrorCode, type PartnerFeeClaimAssetBalance, PartnerFeeClaimService, type PartnerFeeClaimServiceConstructorParams, type PartnerFeeClaimSwapAction, type PartnerFeeClaimSwapParams, PartnerService, type PartnerServiceConfig, type PartnerServiceConstructorParams, Permit2Service, type PermitBatch, type PermitDetails, type PermitSingle, type PoolBaseCurrencyHumanized, type PoolData, type PoolRewardConfig, type PoolSpokeAssets, type PostExecutionError, type PostExecutionErrorCode, ProtocolIntentsAbi, type QueryMsg, type QueryResponse, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RadfiApiError, type RadfiAuthResult, type RadfiBuildTxResponse, type RadfiErrorBody, type RadfiMaxSpentResponse, RadfiProvider, type RadfiTradingWallet, type RadfiUtxo, type RadfiUtxoListResponse, type RadfiWalletBalance, type RateLimitConfig, type RawDestinationParams, type RecoveryAction, type RecoveryError, type RecoveryErrorCode, RecoveryService, type RecoveryServiceConstructorParams, type RelayAction, type RelayAndWaitParams, type RelayCode, type RelayErrorCode, type RelayExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayWrappedErrorCode, type RequestConfig, type RequestOverrideConfig, type RequestTrustlineParams, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResponseAddressType, type ResponseSigningType, type RevertMigrationOrchestrationError, type RevertMigrationOrchestrationErrorCode, type RewardInfoHumanized, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, type SendMessageParams, type SetSwapPreferenceAction, type SetSwapPreferenceParams, Sodax, SodaxError, type SodaxErrorCode, type SodaxErrorContext, type SodaxErrorJSON, type SodaxFeature, type SodaxPhase, type SolanaSpokeDepositParams, SolanaSpokeService, type SolanaTransferToHubParams, SolverApiService, type SonicDepositParams, type SonicSpokeDepositParams, SonicSpokeService, type SpokeApproveParams, type SpokeApproveParamsEvmSpoke, type SpokeApproveParamsHub, type SpokeApproveParamsStellar, type SpokeIsAllowanceValidParams, type SpokeIsAllowanceValidParamsEvmSpoke, type SpokeIsAllowanceValidParamsHub, type SpokeIsAllowanceValidParamsOther, type SpokeIsAllowanceValidParamsStellar, SpokeService, type SpokeServiceConstructorParams, type SpokeServiceType, StacksSpokeService, type StakeAction, type StakeOrchestrationError, type StakeOrchestrationErrorCode, type StakeParams, type StakingActionType, type StakingActionUnion, type StakingAllowanceCheckError, type StakingAllowanceCheckErrorCode, type StakingApproveError, type StakingApproveErrorCode, type StakingConfig, type StakingCreateIntentError, type StakingCreateIntentErrorCode, type StakingError, type StakingErrorCode, type StakingInfo, type StakingInfoFetchError, type StakingInfoFetchErrorCode, StakingLogic, type StakingOrchestrationError, type StakingOrchestrationErrorCode, type StakingParamsUnion, StakingService, type StakingServiceConstructorParams, type State, type StellarSpokeDepositParams, StellarSpokeService, type StellarTransferToHubParams, type SubmitTxParams, type SubmitTxResponse, type SuiNativeCoinResult, SuiSpokeService, type SuiTxObject, SupportedMigrationTokens, type SwapAction, type SwapActionParams, type SwapCreateIntentError, type SwapCreateIntentErrorCode, type SwapError, type SwapErrorCode, type SwapResponse, SwapService, type SwapServiceConstructorParams, type TokenSpenderPair, type TokenWithConversion, type TxHashPair, type TxStatus, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UiPoolDataProviderServiceConstructorParams, type UnifiedBnUSDMigrateAction, type UnifiedBnUSDMigrateParams, type UnstakeAction, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserIntentsResponse, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type VerifySimulationParams, type VerifyTxHashParams, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitForTxReceiptParams, type WaitForTxReceiptReturnType, type WaitUntilIntentExecutedPayload, type WalletMode, type WalletSimulationParams, type WithdrawHubAssetAction, type WithdrawHubAssetParams, type WithdrawInfo, adjustAmountByFee, allowanceCheckFailed, approveFailed, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bridgeInvariant, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, connectionAbi, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, dexInvariant, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getCompoundedBalance, getConnectionIdl, getConnectionProgram, getEvmViemChain, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hyper, intentCreationFailed, isBalnMigrateParams, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexError, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isHubChainKeyType, isIconAddress, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNearChainKeyType, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKeyType, isStellarWalletProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiChainKeyType, isSwapCreateIntentError, isSwapError, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, lookupFailed, mapRelayFailure, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, nativeToUSD, normalize, normalizeBN, normalizePsbtToBase64, normalizedToUsd, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, reverseEncodeAddress, serializeAddressData, sleep, sodaxInvariant, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, swapExactInSingleParamsAbi, swapInvariant, uiPoolDataAbi, universalRouterAbi, unknownFailed, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
17708
+ export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, type AggregatedReserveData, type AllowanceCheckErrorCode, type AllowanceInfo, type AllowanceResponse, type AllowanceTransferDetails, type AnalyticsActionData, type ApiResponse, type ApproveErrorCode, type ApyRange, type AssetDepositAction, type AssetEntry, AssetService, type AssetServiceConstructorParams, type AssetWithdrawAction, type AutoSwapPreferences, BackendApiService, type BalnLockParams, type BalnMigrateAction, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, type BitcoinBoundExtras, BitcoinSpokeService, type BitcoinTransactionResult, type BitcoinUTXO, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeAction, type BridgeAllowanceCheckError, type BridgeAllowanceCheckErrorCode, type BridgeApproveError, type BridgeApproveErrorCode, type BridgeCreateIntentError, type BridgeCreateIntentErrorCode, type BridgeError, type BridgeErrorCode, type BridgeLookupError, type BridgeLookupErrorCode, type BridgeOrchestrationError, type BridgeOrchestrationErrorCode, type BridgeParams, BridgeService, type BridgeServiceConstructorParams, type BtcPayload, CREATE_INTENT_CODES, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CallResponse, type CancelIntentActionParams, type CancelIntentParams, type CancelUnstakeAction, type CancelUnstakeParams, type ClClaimRewardsParams, type ClDecreaseLiquidityParams, type ClGetPoolDataParams, type ClIncreaseLiquidityParams, type ClLiquidityClaimRewardsAction, type ClLiquidityDecreaseLiquidityAction, type ClLiquidityIncreaseLiquidityAction, type ClLiquidityWithdrawAction, type ClMintPositionEventLog, type ClPositionInfo, ClService, type ClServiceConstructorParams, type ClSupplyAction, type ClSupplyParams, type ClWithdrawParams, type ClaimAction, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, type ConcentratedLiquidityParams, type ConcentratedLiquidityTokenInfo, ConfigService, type ConfigServiceConstructorParams, type ConnMsg, type CreateAssetDepositParams, type CreateAssetWithdrawParams, type CreateBridgeIntentParams, type CreateIntentErrorCode, type CreateIntentParams, type CreateIntentResult, type CreateLimitOrderParams, type CreateSonicSwapIntentParams, type CreateVaultIntentResult, type CreateViemPublicClientParams, CustomSorobanServer, CustomStellarAccount, type DepositParams, type DepositSimulationParams, type DestinationParamsType, type DetailedLock, type DexApproveError, type DexApproveErrorCode, type DexCreateIntentError, type DexCreateIntentErrorCode, type DexError, type DexErrorCode, DexService, type DexServiceConstructorParams, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, type EnrichedToken, type Erc20ApproveParams, type Erc20IsAllowanceParams, Erc20Service, type Erc20Token, Erc4626Service, type EstimateGasParams, EvmAssetManagerService, type EvmDepositToDataParams, EvmHubProvider, type EvmHubProviderConstructorParams, EvmSolverService, EvmSpokeService, EvmVaultTokenService, type EvmWithdrawAssetDataParams, type ExecuteMsg, type FeatureInvariant, type FeeData, type FeeTokenApproveAction, type FeeTokenApproveParams, type FetchHubAssetBalancesParams, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, GAS_ESTIMATION_CODES, type GasEstimationErrorCode, type GetDepositParams, type GetIntentSubmitTxExtraDataParams, type GetPacketParams, type GetPacketResponse, type GetQuoteParams, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeServiceType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, type GetTxReceiptType, type GetUserIntentParams, type GetUserRouterParams, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HookRequest, HookService, HttpRelayError, type HubAssetBalance, type HubProvider, type IconJsonRpcVersion, IconSpokeService, type IcxCreateRevertMigrationParams, type IcxMigrateAction, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRevertMigrationAction, type IcxRevertMigrationParams, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, type InjectiveBalance, InjectiveSpokeService, type InstantUnstakeAction, type InstantUnstakeParams, type InstantiateMsg, type Intent, type IntentAutoSwapResult, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentData, IntentDataService, IntentDataType, type IntentDeliveryInfo, IntentFilledEventAbi, type IntentFilledEventLog, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentTxResult, IntentsAbi, type JsonRpcPayloadResponse, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, type LendingPoolServiceConstructorParams, type LeverageYieldAction, type LeverageYieldAllowanceCheckError, type LeverageYieldAllowanceCheckErrorCode, type LeverageYieldAllowanceParams, type LeverageYieldApproveError, type LeverageYieldApproveErrorCode, type LeverageYieldApproveParams, type LeverageYieldApr, type LeverageYieldCreateIntentError, type LeverageYieldCreateIntentErrorCode, type LeverageYieldEffectiveApr, type LeverageYieldError, type LeverageYieldErrorCode, type LeverageYieldLookupError, type LeverageYieldLookupErrorCode, type LeverageYieldLsdApr, type LeverageYieldPosition, type LeverageYieldPostExecutionError, type LeverageYieldPostExecutionErrorCode, LeverageYieldService, type LeverageYieldServiceConstructorParams, type LeverageYieldSwapDepositParams, type LeverageYieldSwapError, type LeverageYieldSwapErrorCode, type LeverageYieldSwapPayload, type LeverageYieldSwapWithdrawParams, type LimitOrderActionParams, LockupMultiplier, LockupPeriod, type LookupErrorCode, type MapRelayFailureCtx, type MigrateOrchestrationError, type MigrateOrchestrationErrorCode, type MigrationAction, type MigrationAllowanceCheckError, type MigrationAllowanceCheckErrorCode, type MigrationApproveError, type MigrationApproveErrorCode, type MigrationCreateIntentError, type MigrationCreateIntentErrorCode, type MigrationDirection, type MigrationError, type MigrationErrorCode, type MigrationLookupError, type MigrationLookupErrorCode, type MigrationOp, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConstructorParams, type MigrationTokens, MintPositionEventAbi, type MintPositionEventLog, type MoneyMarketAction, type MoneyMarketAllowanceCheckError, type MoneyMarketAllowanceCheckErrorCode, type MoneyMarketAllowanceParams, type MoneyMarketApproveActionParams, type MoneyMarketApproveError, type MoneyMarketApproveErrorCode, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowActionParams, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketCreateIntentError, type MoneyMarketCreateIntentErrorCode, MoneyMarketDataService, type MoneyMarketDataServiceConstructorParams, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketGasEstimationError, type MoneyMarketGasEstimationErrorCode, type MoneyMarketOrchestrationError, type MoneyMarketOrchestrationErrorCode, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayActionParams, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConstructorParams, type MoneyMarketSupplyActionParams, type MoneyMarketSupplyParams, type MoneyMarketWithdrawActionParams, type MoneyMarketWithdrawParams, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, type OnDemandBtcPayload, type OnDemandRelayData, type OptionalRaw, type OptionalSkipSimulation, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerAction, type PartnerError, type PartnerErrorCode, type PartnerFeeClaimAssetBalance, type PartnerFeeClaimCancelAction, type PartnerFeeClaimCancelParams, PartnerFeeClaimService, type PartnerFeeClaimServiceConstructorParams, type PartnerFeeClaimSwapAction, type PartnerFeeClaimSwapParams, PartnerService, type PartnerServiceConfig, type PartnerServiceConstructorParams, Permit2Service, type PermitBatch, type PermitDetails, type PermitSingle, type PoolBaseCurrencyHumanized, type PoolData, type PoolRewardConfig, type PoolSpokeAssets, type PostExecutionError, type PostExecutionErrorCode, ProtocolIntentsAbi, type QueryMsg, type QueryResponse, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RadfiApiError, type RadfiAuthResult, type RadfiBuildTxResponse, type RadfiErrorBody, type RadfiMaxSpentResponse, RadfiProvider, type RadfiResponseEnvelope, type RadfiTradingWallet, type RadfiUtxo, type RadfiUtxoListResponse, type RadfiWalletBalance, type RateLimitConfig, type RawDestinationParams, type RecoveryAction, type RecoveryError, type RecoveryErrorCode, RecoveryService, type RecoveryServiceConstructorParams, type RelayAction, type RelayAndWaitParams, type RelayCode, type RelayErrorCode, type RelayExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayWrappedErrorCode, type RequestConfig, type RequestOverrideConfig, type RequestTrustlineParams, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResolvedAnalytics, type ResponseAddressType, type ResponseSigningType, type RevertMigrationOrchestrationError, type RevertMigrationOrchestrationErrorCode, type RewardInfoHumanized, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, type SendMessageParams, type SetSwapPreferenceAction, type SetSwapPreferenceParams, Sodax, SodaxError, type SodaxErrorCode, type SodaxErrorContext, type SodaxErrorJSON, type SodaxPhase, SolanaSpokeService, SolverApiService, SonicSpokeService, type SpokeApproveParams, type SpokeApproveParamsEvmSpoke, type SpokeApproveParamsHub, type SpokeApproveParamsStellar, type SpokeIsAllowanceValidParams, type SpokeIsAllowanceValidParamsEvmSpoke, type SpokeIsAllowanceValidParamsHub, type SpokeIsAllowanceValidParamsOther, type SpokeIsAllowanceValidParamsStellar, SpokeService, type SpokeServiceConstructorParams, type SpokeServiceType, StacksSpokeService, type StakeAction, type StakeOrchestrationError, type StakeOrchestrationErrorCode, type StakeParams, type StakingActionType, type StakingActionUnion, type StakingAllowanceCheckError, type StakingAllowanceCheckErrorCode, type StakingApproveError, type StakingApproveErrorCode, type StakingConfig, type StakingCreateIntentError, type StakingCreateIntentErrorCode, type StakingError, type StakingErrorCode, type StakingInfo, type StakingInfoFetchError, type StakingInfoFetchErrorCode, StakingLogic, type StakingOrchestrationError, type StakingOrchestrationErrorCode, type StakingParamsUnion, StakingService, type StakingServiceConstructorParams, type State, StellarSpokeService, type SubmitTxParams, type SubmitTxResponse, SuiSpokeService, SupportedMigrationTokens, type SwapAction, type SwapActionParams, type SwapCreateIntentError, type SwapCreateIntentErrorCode, type SwapError, type SwapErrorCode, type SwapExtras, type SwapResponse, SwapService, type SwapServiceConstructorParams, SwapsApiService, type TokenSpenderPair, type TokenWithConversion, type TxHashPair, type TxStatus, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UiPoolDataProviderServiceConstructorParams, type UnifiedBnUSDMigrateAction, type UnifiedBnUSDMigrateParams, type UnstakeAction, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserIntentsResponse, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type VaultSwapActionParams, type VaultSwapResponse, type VerifySimulationParams, type VerifyTxHashParams, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitForTxReceiptParams, type WaitForTxReceiptReturnType, type WaitUntilIntentExecutedPayload, type WalletMode, type WalletSimulationParams, type WithdrawHubAssetAction, type WithdrawHubAssetParams, type WithdrawInfo, adjustAmountByFee, allowanceCheckFailed, approveFailed, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bridgeInvariant, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, dexInvariant, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getCompoundedBalance, getConnectionIdl, getConnectionProgram, getEvmViemChain, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hyper, intentCreationFailed, isBalnMigrateParams, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isHubChainKeyType, isIconAddress, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNearChainKeyType, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKeyType, isSwapCreateIntentError, isSwapError, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, leverageYieldInvariant, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, nativeToUSD, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, serializeAddressData, silentLogger, sleep, sodaxInvariant, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, swapExactInSingleParamsAbi, swapInvariant, uiPoolDataAbi, universalRouterAbi, unknownFailed, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };