@sodax/sdk 2.0.0-rc.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.cjs +5059 -1491
- package/dist/index.d.cts +1598 -280
- package/dist/index.d.ts +1598 -280
- package/dist/index.mjs +5021 -1495
- package/package.json +10 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
5
|
+
import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, Hash, HttpTransport, GetLogsReturnType } from 'viem';
|
|
5
6
|
import { StacksNetwork, ClarityValue } from '@sodax/libs/stacks/core';
|
|
6
7
|
import { networks, Psbt } from 'bitcoinjs-lib';
|
|
7
8
|
import { JsonRpcProvider } from 'near-api-js';
|
|
8
9
|
import { Transaction, TransactionResult } from '@mysten/sui/transactions';
|
|
9
10
|
import { SuiClient } from '@mysten/sui/client';
|
|
10
11
|
import { rpc, Transaction as Transaction$1, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr } from '@stellar/stellar-sdk';
|
|
11
|
-
import { Connection as Connection$1,
|
|
12
|
+
import { Connection as Connection$1, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
12
13
|
import { IconService } from 'icon-sdk-js';
|
|
13
14
|
import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
|
|
14
15
|
import { NetworkEndpoints } from '@injectivelabs/networks';
|
|
@@ -16,6 +17,7 @@ import * as _coral_xyz_anchor from '@coral-xyz/anchor';
|
|
|
16
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
|
-
/**
|
|
314
|
-
|
|
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
|
-
/**
|
|
318
|
-
|
|
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:
|
|
7398
|
-
outputToken:
|
|
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:
|
|
7406
|
-
dstAddress:
|
|
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
|
-
*
|
|
7521
|
-
* has `ok: false` with a
|
|
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
|
|
7763
|
+
declare class BackendApiService implements IConfigApiV1 {
|
|
7764
|
+
readonly swaps: SwapsApiService;
|
|
7527
7765
|
private readonly config;
|
|
7528
7766
|
private readonly headers;
|
|
7529
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8618
|
+
ARRAY = 0,
|
|
8619
|
+
FEE = 1,
|
|
8620
|
+
HOOK = 2,
|
|
8621
|
+
DELIVERY = 3
|
|
8214
8622
|
}
|
|
8215
8623
|
type FeeData = {
|
|
8216
8624
|
fee: bigint;
|
|
@@ -8253,7 +8661,7 @@ type CreateSonicSwapIntentParams<Raw extends boolean> = {
|
|
|
8253
8661
|
} & WalletProviderSlot<SonicChainKey, Raw>;
|
|
8254
8662
|
declare class SonicSpokeService {
|
|
8255
8663
|
private readonly config;
|
|
8256
|
-
readonly publicClient: PublicClient
|
|
8664
|
+
readonly publicClient: PublicClient;
|
|
8257
8665
|
private readonly pollingIntervalMs;
|
|
8258
8666
|
private readonly maxTimeoutMs;
|
|
8259
8667
|
constructor(config: ConfigService);
|
|
@@ -8318,11 +8726,11 @@ type EvmHubProviderConstructorParams = {
|
|
|
8318
8726
|
config: ConfigService;
|
|
8319
8727
|
};
|
|
8320
8728
|
declare class EvmHubProvider {
|
|
8321
|
-
readonly publicClient: PublicClient
|
|
8729
|
+
readonly publicClient: PublicClient;
|
|
8322
8730
|
readonly chainConfig: HubConfig;
|
|
8323
8731
|
readonly config: ConfigService;
|
|
8324
8732
|
readonly service: SonicSpokeService;
|
|
8325
|
-
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}`>;
|
|
8326
8734
|
constructor({ config }: EvmHubProviderConstructorParams);
|
|
8327
8735
|
/**
|
|
8328
8736
|
* Gets the cached user's hub wallet address for a spoke chain address.
|
|
@@ -8412,10 +8820,10 @@ declare class EvmVaultTokenService {
|
|
|
8412
8820
|
* Fetches token information for a specific token in the vault.
|
|
8413
8821
|
* @param vault - The address of the vault.
|
|
8414
8822
|
* @param token - The address of the token.
|
|
8415
|
-
* @param publicClient - PublicClient
|
|
8823
|
+
* @param publicClient - PublicClient
|
|
8416
8824
|
* @returns Token information as a TokenInfo object.
|
|
8417
8825
|
*/
|
|
8418
|
-
static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient
|
|
8826
|
+
static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient): Promise<TokenInfo>;
|
|
8419
8827
|
/**
|
|
8420
8828
|
* Fetches token information for a list of tokens in a vault using a multicall.
|
|
8421
8829
|
* @param vault - The address of the vault contract.
|
|
@@ -8423,21 +8831,21 @@ declare class EvmVaultTokenService {
|
|
|
8423
8831
|
* @param publicClient - The Viem PublicClient instance used to interact with the blockchain.
|
|
8424
8832
|
* @returns A promise that resolves to an array of TokenInfo objects, one for each provided token.
|
|
8425
8833
|
*/
|
|
8426
|
-
static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient
|
|
8834
|
+
static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient): Promise<TokenInfo[]>;
|
|
8427
8835
|
/**
|
|
8428
8836
|
* Retrieves the reserves of the vault.
|
|
8429
8837
|
* @param vault - The address of the vault.
|
|
8430
|
-
* @param publicClient - PublicClient
|
|
8838
|
+
* @param publicClient - PublicClient
|
|
8431
8839
|
* @returns An object containing tokens and their balances.
|
|
8432
8840
|
*/
|
|
8433
|
-
static getVaultReserves(vault: Address$1, publicClient: PublicClient
|
|
8841
|
+
static getVaultReserves(vault: Address$1, publicClient: PublicClient): Promise<VaultReserves>;
|
|
8434
8842
|
/**
|
|
8435
8843
|
* Retrieves all token information for the vault.
|
|
8436
8844
|
* @param vault - The address of the vault.
|
|
8437
|
-
* @param publicClient - PublicClient
|
|
8845
|
+
* @param publicClient - PublicClient
|
|
8438
8846
|
* @returns A promise that resolves to an object containing tokens, their infos, and reserves.
|
|
8439
8847
|
*/
|
|
8440
|
-
static getAllTokenInfo(vault: Address$1, publicClient: PublicClient
|
|
8848
|
+
static getAllTokenInfo(vault: Address$1, publicClient: PublicClient): Promise<{
|
|
8441
8849
|
tokens: readonly Address$1[];
|
|
8442
8850
|
infos: readonly TokenInfo[];
|
|
8443
8851
|
reserves: readonly bigint[];
|
|
@@ -8599,55 +9007,163 @@ declare class StacksSpokeService {
|
|
|
8599
9007
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<StacksChainKey>): Promise<Result<WaitForTxReceiptReturnType<StacksChainKey>>>;
|
|
8600
9008
|
}
|
|
8601
9009
|
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
* `code` carrying a Radfi-specific identifier (e.g. "2002" insufficientBTCBalance,
|
|
8606
|
-
* "4008" duplicatedPubKey) and `message` an i18n key.
|
|
8607
|
-
*/
|
|
8608
|
-
type RadfiErrorBody = {
|
|
8609
|
-
code?: string;
|
|
8610
|
-
message?: string;
|
|
8611
|
-
details?: string;
|
|
8612
|
-
error?: {
|
|
8613
|
-
details?: string;
|
|
8614
|
-
message?: string;
|
|
8615
|
-
};
|
|
9010
|
+
type RelayExtraData = {
|
|
9011
|
+
address: Hex;
|
|
9012
|
+
payload: Hex;
|
|
8616
9013
|
};
|
|
8617
9014
|
/**
|
|
8618
|
-
*
|
|
8619
|
-
*
|
|
8620
|
-
*
|
|
8621
|
-
*
|
|
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).
|
|
8622
9019
|
*/
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
readonly cause?: unknown;
|
|
8628
|
-
constructor(status: number, body: RadfiErrorBody, fallback: string);
|
|
8629
|
-
}
|
|
8630
|
-
type RadfiTradingWallet = {
|
|
8631
|
-
tradingAddress: string;
|
|
8632
|
-
userAddress: string;
|
|
8633
|
-
userPublicKey: string;
|
|
8634
|
-
};
|
|
8635
|
-
type RadfiAuthResult = {
|
|
8636
|
-
accessToken: string;
|
|
8637
|
-
refreshToken: string;
|
|
8638
|
-
tradingAddress: string;
|
|
9020
|
+
type OnDemandRelayData = {
|
|
9021
|
+
payload_hex: string;
|
|
9022
|
+
signature?: string;
|
|
9023
|
+
public_key?: string;
|
|
8639
9024
|
};
|
|
8640
|
-
type
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
9025
|
+
type IntentDeliveryInfo = {
|
|
9026
|
+
srcChainKey: SpokeChainKey;
|
|
9027
|
+
srcTxHash: string;
|
|
9028
|
+
srcAddress: string;
|
|
9029
|
+
dstChainKey: SpokeChainKey;
|
|
9030
|
+
dstTxHash: string;
|
|
9031
|
+
dstAddress: string;
|
|
8645
9032
|
};
|
|
8646
|
-
type
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
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 `src_chain_id` (so only packets for the awaited
|
|
9054
|
+
* transaction and source chain reach it) and returns the desired one (or undefined to keep
|
|
9055
|
+
* polling). Defaults to "first candidate" — the legacy behavior for single-packet flows.
|
|
9056
|
+
*/
|
|
9057
|
+
selectPacket?: (packets: PacketData[]) => PacketData | undefined;
|
|
9058
|
+
};
|
|
9059
|
+
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
9060
|
+
type IntentRelayRequest<T extends RelayAction> = {
|
|
9061
|
+
action: T;
|
|
9062
|
+
params: T extends 'submit' ? {
|
|
9063
|
+
chain_id: string;
|
|
9064
|
+
tx_hash: string;
|
|
9065
|
+
data?: RelayExtraData | OnDemandRelayData;
|
|
9066
|
+
} : T extends 'get_transaction_packets' ? {
|
|
9067
|
+
chain_id: string;
|
|
9068
|
+
tx_hash: string;
|
|
9069
|
+
} : T extends 'get_packet' ? {
|
|
9070
|
+
chain_id: string;
|
|
9071
|
+
tx_hash: string;
|
|
9072
|
+
conn_sn: string;
|
|
9073
|
+
} : never;
|
|
9074
|
+
};
|
|
9075
|
+
|
|
9076
|
+
/**
|
|
9077
|
+
* Types derived from Core SDK specific types
|
|
9078
|
+
* NOTE: common (non Core SDK specific) types should be put in @sodax/types package
|
|
9079
|
+
*/
|
|
9080
|
+
type HubProvider = EvmHubProvider;
|
|
9081
|
+
type RateLimitConfig = {
|
|
9082
|
+
maxAvailable: number;
|
|
9083
|
+
ratePerSecond: number;
|
|
9084
|
+
available: number;
|
|
9085
|
+
};
|
|
9086
|
+
/**
|
|
9087
|
+
* Structural types
|
|
9088
|
+
*/
|
|
9089
|
+
type OptionalRaw<R extends boolean> = {
|
|
9090
|
+
raw?: R;
|
|
9091
|
+
};
|
|
9092
|
+
type OptionalSkipSimulation = {
|
|
9093
|
+
skipSimulation?: boolean;
|
|
9094
|
+
};
|
|
9095
|
+
type OptionalTimeout = {
|
|
9096
|
+
timeout?: number;
|
|
9097
|
+
};
|
|
9098
|
+
type TxHashPair = {
|
|
9099
|
+
srcChainTxHash: string;
|
|
9100
|
+
dstChainTxHash: string;
|
|
9101
|
+
};
|
|
9102
|
+
type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
9103
|
+
tx: TxReturnType<K, Raw>;
|
|
9104
|
+
relayData: RelayExtraData;
|
|
9105
|
+
};
|
|
9106
|
+
|
|
9107
|
+
type DestinationParamsType = RawDestinationParams;
|
|
9108
|
+
|
|
9109
|
+
/**
|
|
9110
|
+
* Raw error body shape returned by the Bound Exchange HTTP API on non-2xx responses.
|
|
9111
|
+
* The human-readable detail typically lives at `error.details` (nested), with
|
|
9112
|
+
* `code` carrying a Bound Exchange-specific identifier (e.g. "2002" insufficientBTCBalance,
|
|
9113
|
+
* "4008" duplicatedPubKey) and `message` an i18n key.
|
|
9114
|
+
*/
|
|
9115
|
+
type RadfiErrorBody = {
|
|
9116
|
+
code?: string;
|
|
9117
|
+
message?: string;
|
|
9118
|
+
details?: string;
|
|
9119
|
+
error?: {
|
|
9120
|
+
details?: string;
|
|
9121
|
+
message?: string;
|
|
9122
|
+
};
|
|
9123
|
+
};
|
|
9124
|
+
/**
|
|
9125
|
+
* Shape of a parsed Bound Exchange JSON response: the {@link RadfiErrorBody} envelope fields plus an
|
|
9126
|
+
* optional, per-call typed `data` payload. Modeled as a superset of `RadfiErrorBody` so a parsed body
|
|
9127
|
+
* can be handed straight to {@link RadfiApiError} on the error path. `data` is optional because Bound
|
|
9128
|
+
* can answer 2xx with a logical-error envelope (no `data`); callers guard before dereferencing it.
|
|
9129
|
+
*/
|
|
9130
|
+
type RadfiResponseEnvelope<T = unknown> = RadfiErrorBody & {
|
|
9131
|
+
data?: T;
|
|
9132
|
+
};
|
|
9133
|
+
/**
|
|
9134
|
+
* Structured error from a Bound Exchange HTTP request. Exposes `status` (HTTP), `code`
|
|
9135
|
+
* (Bound Exchange-specific identifier), and `details` (human-readable) so callers can
|
|
9136
|
+
* discriminate without fragile string-matching on `message`. The raw response
|
|
9137
|
+
* body is preserved on `cause` for structured logging.
|
|
9138
|
+
*/
|
|
9139
|
+
declare class RadfiApiError extends Error {
|
|
9140
|
+
readonly status: number;
|
|
9141
|
+
readonly code?: string;
|
|
9142
|
+
readonly details?: string;
|
|
9143
|
+
readonly cause?: unknown;
|
|
9144
|
+
constructor(status: number, body: RadfiErrorBody, fallback: string);
|
|
9145
|
+
}
|
|
9146
|
+
type RadfiTradingWallet = {
|
|
9147
|
+
tradingAddress: string;
|
|
9148
|
+
userAddress: string;
|
|
9149
|
+
userPublicKey: string;
|
|
9150
|
+
};
|
|
9151
|
+
type RadfiAuthResult = {
|
|
9152
|
+
accessToken: string;
|
|
9153
|
+
refreshToken: string;
|
|
9154
|
+
tradingAddress: string;
|
|
9155
|
+
};
|
|
9156
|
+
type RadfiWalletBalance = {
|
|
9157
|
+
btcSatoshi: bigint;
|
|
9158
|
+
pendingSatoshi: bigint;
|
|
9159
|
+
externalPendingSatoshi: bigint;
|
|
9160
|
+
totalUtxos: number;
|
|
9161
|
+
};
|
|
9162
|
+
type RadfiUtxo = {
|
|
9163
|
+
_id: string;
|
|
9164
|
+
txid: string;
|
|
9165
|
+
vout: number;
|
|
9166
|
+
txidVout: string;
|
|
8651
9167
|
satoshi: number;
|
|
8652
9168
|
amount: string;
|
|
8653
9169
|
address: string;
|
|
@@ -8691,7 +9207,7 @@ declare class RadfiProvider {
|
|
|
8691
9207
|
refreshToken: string;
|
|
8692
9208
|
constructor(config: RadfiConfig);
|
|
8693
9209
|
/**
|
|
8694
|
-
* Authenticate with
|
|
9210
|
+
* Authenticate with Bound Exchange: BIP322-sign a login message, then call the Bound Exchange API.
|
|
8695
9211
|
* Returns accessToken, refreshToken, and tradingAddress.
|
|
8696
9212
|
*/
|
|
8697
9213
|
authenticateWithWallet(walletProvider: IBitcoinWalletProvider, cachedPublicKey?: string): Promise<{
|
|
@@ -8701,8 +9217,8 @@ declare class RadfiProvider {
|
|
|
8701
9217
|
publicKey: string;
|
|
8702
9218
|
}>;
|
|
8703
9219
|
/**
|
|
8704
|
-
* Ensure a valid
|
|
8705
|
-
* If a token exists, validates it via the
|
|
9220
|
+
* Ensure a valid Bound Exchange access token is set on this provider.
|
|
9221
|
+
* If a token exists, validates it via the Bound Exchange API.
|
|
8706
9222
|
* If invalid, tries refreshing with the refresh token first.
|
|
8707
9223
|
* If refresh also fails, falls back to full re-authentication (BIP322 sign).
|
|
8708
9224
|
*/
|
|
@@ -8722,7 +9238,7 @@ declare class RadfiProvider {
|
|
|
8722
9238
|
walletAddress: string;
|
|
8723
9239
|
publicKey: string;
|
|
8724
9240
|
}, accessToken: string): Promise<RadfiTradingWallet>;
|
|
8725
|
-
getTradingWallet(userAddress: string
|
|
9241
|
+
getTradingWallet(userAddress: string): Promise<RadfiTradingWallet>;
|
|
8726
9242
|
getBalance(address: string): Promise<RadfiWalletBalance>;
|
|
8727
9243
|
checkIfTradingWalletExists(userAddress: string): Promise<boolean>;
|
|
8728
9244
|
createWithdrawTransaction(params: {
|
|
@@ -8732,9 +9248,18 @@ declare class RadfiProvider {
|
|
|
8732
9248
|
userAddress: string;
|
|
8733
9249
|
data: string;
|
|
8734
9250
|
}, accessToken: string): Promise<RadfiDepositTxResponse>;
|
|
9251
|
+
/**
|
|
9252
|
+
* Co-sign and broadcast a `sodax-withdraw` deposit via the Bound Exchange API.
|
|
9253
|
+
*
|
|
9254
|
+
* `relayData` ({ address, payload }) is the same `RelayExtraData` the SDK returns from
|
|
9255
|
+
* `createIntent()` / money-market supply etc. It is optional and non-breaking: when supplied,
|
|
9256
|
+
* the Bound Exchange backend persists it so it can auto-resubmit the intent relay if the relay
|
|
9257
|
+
* gets stuck (otherwise a stuck relay eventually refunds instead of completing the swap).
|
|
9258
|
+
*/
|
|
8735
9259
|
requestRadfiSignature(params: {
|
|
8736
9260
|
userAddress: string;
|
|
8737
9261
|
signedBase64Tx: string;
|
|
9262
|
+
relayData?: RelayExtraData;
|
|
8738
9263
|
}, accessToken: string): Promise<string>;
|
|
8739
9264
|
/**
|
|
8740
9265
|
* Fetch expired (or near-expiry) UTXOs for a trading wallet address from UMS API.
|
|
@@ -8744,7 +9269,7 @@ declare class RadfiProvider {
|
|
|
8744
9269
|
pageSize?: number;
|
|
8745
9270
|
}): Promise<RadfiUtxoListResponse>;
|
|
8746
9271
|
/**
|
|
8747
|
-
* Build a renew-utxo transaction via the
|
|
9272
|
+
* Build a renew-utxo transaction via the Bound Exchange API.
|
|
8748
9273
|
* Returns a PSBT that needs to be signed by the user.
|
|
8749
9274
|
*/
|
|
8750
9275
|
buildRenewUtxoTransaction(params: {
|
|
@@ -8752,8 +9277,8 @@ declare class RadfiProvider {
|
|
|
8752
9277
|
txIdVouts: string[];
|
|
8753
9278
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8754
9279
|
/**
|
|
8755
|
-
* Sign and broadcast a renew-utxo transaction via the
|
|
8756
|
-
* The user signs the PSBT first, then
|
|
9280
|
+
* Sign and broadcast a renew-utxo transaction via the Bound Exchange API.
|
|
9281
|
+
* The user signs the PSBT first, then Bound Exchange co-signs and broadcasts.
|
|
8757
9282
|
*/
|
|
8758
9283
|
signAndBroadcastRenewUtxo(params: {
|
|
8759
9284
|
userAddress: string;
|
|
@@ -8770,7 +9295,7 @@ declare class RadfiProvider {
|
|
|
8770
9295
|
withdrawTo: string;
|
|
8771
9296
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8772
9297
|
/**
|
|
8773
|
-
* Sign and broadcast a withdraw transaction via
|
|
9298
|
+
* Sign and broadcast a withdraw transaction via Bound Exchange.
|
|
8774
9299
|
*/
|
|
8775
9300
|
signAndBroadcastWithdraw(params: {
|
|
8776
9301
|
userAddress: string;
|
|
@@ -8785,6 +9310,27 @@ declare class RadfiProvider {
|
|
|
8785
9310
|
tokenId: string;
|
|
8786
9311
|
withdrawTo: string;
|
|
8787
9312
|
}, accessToken: string): Promise<RadfiMaxSpentResponse>;
|
|
9313
|
+
/**
|
|
9314
|
+
* Resolve the bearer credential for an authenticated Bound Exchange call, failing fast when none
|
|
9315
|
+
* is available. A server-side raw-build caller that never ran the interactive sign-in would
|
|
9316
|
+
* otherwise send `Authorization: Bearer ` (empty) and get an opaque 403 from Bound's gateway;
|
|
9317
|
+
* throwing here turns that into an actionable client-side error naming the fix. We deliberately do
|
|
9318
|
+
* NOT validate the token's contents (expiry / scope / signature) — only Bound can, and an invalid
|
|
9319
|
+
* token still surfaces as a legible 401/403 via `parseJsonBody`.
|
|
9320
|
+
*/
|
|
9321
|
+
private resolveAuth;
|
|
9322
|
+
/**
|
|
9323
|
+
* Parse a Bound Exchange response body as JSON defensively.
|
|
9324
|
+
*
|
|
9325
|
+
* Bound (or an upstream gateway / WAF / CDN) can answer a request with an HTML error page
|
|
9326
|
+
* instead of JSON — e.g. an unauthenticated call, a blocked origin, a 404, or a 5xx. Calling
|
|
9327
|
+
* `res.json()` on that throws a cryptic `SyntaxError: Unexpected token '<'` that masks the real
|
|
9328
|
+
* HTTP status and bubbles up as an opaque failure (it surfaced as a `createIntent` /
|
|
9329
|
+
* `INTENT_CREATION_FAILED` "is not valid JSON" error on the Bitcoin raw-tx path). Reading the
|
|
9330
|
+
* body as text first and parsing it ourselves lets us raise a `RadfiApiError` carrying the
|
|
9331
|
+
* actual status code and a body snippet instead.
|
|
9332
|
+
*/
|
|
9333
|
+
private parseJsonBody;
|
|
8788
9334
|
private request;
|
|
8789
9335
|
}
|
|
8790
9336
|
|
|
@@ -8798,20 +9344,33 @@ interface BtcPayload {
|
|
|
8798
9344
|
timestamp: number;
|
|
8799
9345
|
address_type: BtcAddressType;
|
|
8800
9346
|
}
|
|
9347
|
+
/**
|
|
9348
|
+
* Calculate the actual vbytes of an OP_RETURN output given the payload byte length.
|
|
9349
|
+
* Accounts for variable-length pushdata opcodes and script-length varints.
|
|
9350
|
+
*/
|
|
9351
|
+
declare function calcOpReturnOutputVbytes(payloadByteLength: number): number;
|
|
8801
9352
|
/**
|
|
8802
9353
|
* Estimate transaction size in vbytes.
|
|
8803
9354
|
* @param addressType — caller's address type for accurate per-input weight.
|
|
8804
9355
|
* P2PKH ≈ 148 vB, P2SH-P2WPKH ≈ 91 vB, P2WPKH ≈ 68 vB, P2TR ≈ 58 vB.
|
|
8805
9356
|
* Defaults to P2WPKH (68 vB) when omitted.
|
|
9357
|
+
* @param opReturnOutputVbytes — actual OP_RETURN output size in vbytes.
|
|
9358
|
+
* Use calcOpReturnOutputVbytes() when the payload size is known. Defaults to 44 vB (~33-byte payload).
|
|
8806
9359
|
*/
|
|
8807
|
-
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType): number;
|
|
9360
|
+
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType, opReturnOutputVbytes?: number): number;
|
|
8808
9361
|
declare function encodeBtcPayloadToBytes(payload: BtcPayload): string;
|
|
8809
9362
|
/**
|
|
8810
9363
|
* Normalize a signed PSBT to base64 format.
|
|
8811
9364
|
* Unisat/OKX wallets return hex, Xverse returns base64.
|
|
8812
|
-
*
|
|
9365
|
+
* Bound Exchange API expects base64.
|
|
8813
9366
|
*/
|
|
8814
9367
|
declare function normalizePsbtToBase64(signedPsbt: string): string;
|
|
9368
|
+
/**
|
|
9369
|
+
* Normalize a wallet message signature to base64. The intent relay requires the on-demand
|
|
9370
|
+
* withdrawal signature as base64. Browser wallets (UniSat/Xverse/OKX) already return base64; a hex
|
|
9371
|
+
* signature (e.g. a private-key wallet) is encoded. Mirrors `normalizePsbtToBase64`.
|
|
9372
|
+
*/
|
|
9373
|
+
declare function normalizeSignatureToBase64(signature: string): string;
|
|
8815
9374
|
|
|
8816
9375
|
type BitcoinUTXO = {
|
|
8817
9376
|
txid: string;
|
|
@@ -8833,6 +9392,7 @@ interface BitcoinTransactionResult {
|
|
|
8833
9392
|
interface OnDemandBtcPayload {
|
|
8834
9393
|
payload_hex: string;
|
|
8835
9394
|
signature?: string;
|
|
9395
|
+
public_key?: string;
|
|
8836
9396
|
}
|
|
8837
9397
|
declare class BitcoinSpokeService {
|
|
8838
9398
|
private readonly config;
|
|
@@ -8878,7 +9438,7 @@ declare class BitcoinSpokeService {
|
|
|
8878
9438
|
*/
|
|
8879
9439
|
getDeposit(params: GetDepositParams<BitcoinChainKey>): Promise<bigint>;
|
|
8880
9440
|
/**
|
|
8881
|
-
* Fund the
|
|
9441
|
+
* Fund the Bound Exchange trading wallet by sending BTC from the user's personal wallet
|
|
8882
9442
|
*
|
|
8883
9443
|
* @param {bigint} amount - Amount in satoshis to send
|
|
8884
9444
|
* @param {BitcoinSpokeProvider} spokeProvider - The Bitcoin spoke provider (must have signing capability)
|
|
@@ -8899,19 +9459,54 @@ declare class BitcoinSpokeService {
|
|
|
8899
9459
|
sendMessage<Raw extends boolean>(params: SendMessageParams<BitcoinChainKey, Raw> & {
|
|
8900
9460
|
walletMode?: WalletMode;
|
|
8901
9461
|
}): Promise<TxReturnType<BitcoinChainKey, Raw>>;
|
|
9462
|
+
/**
|
|
9463
|
+
* Build the relay submit/poll identity for an on-demand action (borrow/withdraw).
|
|
9464
|
+
*
|
|
9465
|
+
* Bitcoin borrow/withdraw are on-demand: there is no broadcast transaction — the spoke result is
|
|
9466
|
+
* the signed payload JSON produced by {@link encodeWithdrawalData}/{@link sendMessage}. The relay
|
|
9467
|
+
* accepts the submit under the literal `withdraw` tx_hash with the signed payload (as a JSON object)
|
|
9468
|
+
* in `data`, then tracks the resulting packet under a derived id: `od:` + keccak256 of the ASCII
|
|
9469
|
+
* `payload_hex` string (hash the hex characters, not the decoded bytes). Polling must use that
|
|
9470
|
+
* derived id (`pollTxHash`), not `withdraw`.
|
|
9471
|
+
*
|
|
9472
|
+
* @param tx - The JSON-stringified signed payload returned by `sendMessage` / `encodeWithdrawalData`.
|
|
9473
|
+
*/
|
|
9474
|
+
getOnDemandRelayIdentity(tx: string): {
|
|
9475
|
+
srcTxHash: string;
|
|
9476
|
+
data: OnDemandRelayData;
|
|
9477
|
+
pollTxHash: string;
|
|
9478
|
+
};
|
|
8902
9479
|
/**
|
|
8903
9480
|
* Build a priority Bitcoin transaction with proper fee calculation
|
|
8904
9481
|
*/
|
|
8905
9482
|
buildBitcoinTransaction(utxos: BitcoinUTXO[], outputs: Array<{
|
|
8906
9483
|
address: string;
|
|
8907
9484
|
value: number;
|
|
8908
|
-
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number): Promise<Psbt>;
|
|
9485
|
+
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number, opReturnOutputVbytes?: number): Promise<Psbt>;
|
|
8909
9486
|
/**
|
|
8910
9487
|
* Deposit operation - transfer BTC to the asset manager
|
|
8911
9488
|
*/
|
|
8912
|
-
deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw>
|
|
9489
|
+
deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw>): Promise<TxReturnType<BitcoinChainKey, Raw>>;
|
|
9490
|
+
/**
|
|
9491
|
+
* Sign and submit a TRADING-wallet raw transaction — the Bound-built *unsigned* PSBT returned by
|
|
9492
|
+
* `deposit({ raw: true })` / the Swaps API (`createIntent().tx.data`). Signs it with the wallet
|
|
9493
|
+
* provider's key, then sends it to Bound Exchange to co-sign with the second 2-of-2 key and
|
|
9494
|
+
* broadcast. Returns the broadcast tx id.
|
|
9495
|
+
*
|
|
9496
|
+
* This is the client-side completion of the TRADING deposit flow: the backend builds the PSBT
|
|
9497
|
+
* (it can't broadcast — the user's signature is missing), the client signs here, and Bound
|
|
9498
|
+
* co-signs + broadcasts. `relayData` ({ address, payload }) is the relay identity returned by
|
|
9499
|
+
* `createIntent()`; forwarding it lets Bound auto-resubmit a stuck relay. It is **not** recoverable
|
|
9500
|
+
* from `rawTx` (whose `to` is the asset manager, not the hub wallet), so callers must supply it.
|
|
9501
|
+
*
|
|
9502
|
+
* @throws if the chain is not in `TRADING` wallet mode (raw txs only exist in TRADING mode).
|
|
9503
|
+
*/
|
|
9504
|
+
signAndSubmitRawTransaction(params: {
|
|
9505
|
+
rawTx: BitcoinRawTransaction;
|
|
9506
|
+
walletProvider: IBitcoinWalletProvider;
|
|
9507
|
+
relayData?: RelayExtraData;
|
|
8913
9508
|
accessToken?: string;
|
|
8914
|
-
}): Promise<
|
|
9509
|
+
}): Promise<string>;
|
|
8915
9510
|
/**
|
|
8916
9511
|
* Build deposit PSBT with embedded cross-chain data
|
|
8917
9512
|
*/
|
|
@@ -8920,6 +9515,12 @@ declare class BitcoinSpokeService {
|
|
|
8920
9515
|
* Fetch UTXOs for an address
|
|
8921
9516
|
*/
|
|
8922
9517
|
fetchUTXOs(address: string): Promise<BitcoinUTXO[]>;
|
|
9518
|
+
/**
|
|
9519
|
+
* Returns the set of "txid:vout" outpoints currently being spent by
|
|
9520
|
+
* unconfirmed transactions in the mempool for the given address.
|
|
9521
|
+
* Used to prevent double-spend when building a new PSBT.
|
|
9522
|
+
*/
|
|
9523
|
+
private fetchMempoolSpentOutpoints;
|
|
8923
9524
|
/**
|
|
8924
9525
|
* Fetch raw transaction hex
|
|
8925
9526
|
*/
|
|
@@ -8938,77 +9539,11 @@ declare class BitcoinSpokeService {
|
|
|
8938
9539
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<BitcoinChainKey>): Promise<Result<WaitForTxReceiptReturnType<BitcoinChainKey>>>;
|
|
8939
9540
|
}
|
|
8940
9541
|
|
|
8941
|
-
type RelayExtraData = {
|
|
8942
|
-
address: Hex;
|
|
8943
|
-
payload: Hex;
|
|
8944
|
-
};
|
|
8945
|
-
type IntentDeliveryInfo = {
|
|
8946
|
-
srcChainKey: SpokeChainKey;
|
|
8947
|
-
srcTxHash: string;
|
|
8948
|
-
srcAddress: string;
|
|
8949
|
-
dstChainKey: SpokeChainKey;
|
|
8950
|
-
dstTxHash: string;
|
|
8951
|
-
dstAddress: string;
|
|
8952
|
-
};
|
|
8953
|
-
type WaitUntilIntentExecutedPayload = {
|
|
8954
|
-
intentRelayChainId: string;
|
|
8955
|
-
srcTxHash: string;
|
|
8956
|
-
timeout?: number;
|
|
8957
|
-
apiUrl: HttpUrl;
|
|
8958
|
-
};
|
|
8959
|
-
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
8960
|
-
type IntentRelayRequest<T extends RelayAction> = {
|
|
8961
|
-
action: T;
|
|
8962
|
-
params: T extends 'submit' ? {
|
|
8963
|
-
chain_id: string;
|
|
8964
|
-
tx_hash: string;
|
|
8965
|
-
data?: RelayExtraData;
|
|
8966
|
-
} : T extends 'get_transaction_packets' ? {
|
|
8967
|
-
chain_id: string;
|
|
8968
|
-
tx_hash: string;
|
|
8969
|
-
} : T extends 'get_packet' ? {
|
|
8970
|
-
chain_id: string;
|
|
8971
|
-
tx_hash: string;
|
|
8972
|
-
conn_sn: string;
|
|
8973
|
-
} : never;
|
|
8974
|
-
};
|
|
8975
|
-
|
|
8976
|
-
/**
|
|
8977
|
-
* Types derived from Core SDK specific types
|
|
8978
|
-
* NOTE: common (non Core SDK specific) types should be put in @sodax/types package
|
|
8979
|
-
*/
|
|
8980
|
-
type HubProvider = EvmHubProvider;
|
|
8981
|
-
type RateLimitConfig = {
|
|
8982
|
-
maxAvailable: number;
|
|
8983
|
-
ratePerSecond: number;
|
|
8984
|
-
available: number;
|
|
8985
|
-
};
|
|
8986
|
-
/**
|
|
8987
|
-
* Structural types
|
|
8988
|
-
*/
|
|
8989
|
-
type OptionalRaw<R extends boolean> = {
|
|
8990
|
-
raw?: R;
|
|
8991
|
-
};
|
|
8992
|
-
type OptionalSkipSimulation = {
|
|
8993
|
-
skipSimulation?: boolean;
|
|
8994
|
-
};
|
|
8995
|
-
type OptionalTimeout = {
|
|
8996
|
-
timeout?: number;
|
|
8997
|
-
};
|
|
8998
|
-
type TxHashPair = {
|
|
8999
|
-
srcChainTxHash: string;
|
|
9000
|
-
dstChainTxHash: string;
|
|
9001
|
-
};
|
|
9002
|
-
type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
9003
|
-
tx: TxReturnType<K, Raw>;
|
|
9004
|
-
relayData: RelayExtraData;
|
|
9005
|
-
};
|
|
9006
|
-
|
|
9007
|
-
type DestinationParamsType = RawDestinationParams;
|
|
9008
|
-
|
|
9009
9542
|
type QueryResponse = string | number | boolean | object | undefined;
|
|
9010
9543
|
type CallResponse = string | number | object | bigint | boolean;
|
|
9011
9544
|
declare const NEAR_DEFAULT_GAS: bigint;
|
|
9545
|
+
/** NEP-141 default storage bond for a one-time `storage_deposit` registration (0.00125 NEAR). */
|
|
9546
|
+
declare const NEAR_STORAGE_DEPOSIT: bigint;
|
|
9012
9547
|
declare class NearSpokeService {
|
|
9013
9548
|
private readonly config;
|
|
9014
9549
|
readonly rpcProvider: JsonRpcProvider;
|
|
@@ -9039,6 +9574,34 @@ declare class NearSpokeService {
|
|
|
9039
9574
|
* @returns {Promise<bigint>} The balance of the token.
|
|
9040
9575
|
*/
|
|
9041
9576
|
getDeposit(params: GetDepositParams<NearChainKey>): Promise<bigint>;
|
|
9577
|
+
/**
|
|
9578
|
+
* Whether `accountId` is storage-registered on a NEP-141 `token` contract. NEP-141 requires an
|
|
9579
|
+
* account to pay a one-time storage bond before it can receive (hold a balance of) the token, so
|
|
9580
|
+
* this gates any leg that delivers a token to a user on NEAR (swap output on NEAR, bridge into
|
|
9581
|
+
* NEAR, money-market borrow/withdraw to NEAR).
|
|
9582
|
+
*
|
|
9583
|
+
* Native NEAR is not a NEP-141 token and has no storage registration, so this returns `true` for
|
|
9584
|
+
* the native token. The view goes through {@link queryContract}, i.e. the configurable RPC from
|
|
9585
|
+
* chain config — a custom `rpcUrl` passed to the SDK is honoured.
|
|
9586
|
+
*/
|
|
9587
|
+
isStorageRegistered(token: string, accountId: string): Promise<boolean>;
|
|
9588
|
+
/**
|
|
9589
|
+
* Build (and, unless `raw`, submit) a NEP-141 `storage_deposit` registration for `accountId` on
|
|
9590
|
+
* the `token` contract. Call this when {@link isStorageRegistered} is `false` before a token is
|
|
9591
|
+
* delivered to the account on NEAR.
|
|
9592
|
+
*
|
|
9593
|
+
* Native NEAR has no storage registration — passing the native token throws.
|
|
9594
|
+
*
|
|
9595
|
+
* @param params.deposit Storage bond to attach; defaults to {@link NEAR_STORAGE_DEPOSIT}
|
|
9596
|
+
* (0.00125 NEAR). Override per token if its `storage_balance_bounds.min` differs.
|
|
9597
|
+
*/
|
|
9598
|
+
registerStorage<Raw extends boolean = false>(params: {
|
|
9599
|
+
token: string;
|
|
9600
|
+
accountId: string;
|
|
9601
|
+
walletProvider: INearWalletProvider;
|
|
9602
|
+
deposit?: bigint;
|
|
9603
|
+
raw?: Raw;
|
|
9604
|
+
}): Promise<TxReturnType<NearChainKey, Raw>>;
|
|
9042
9605
|
/**
|
|
9043
9606
|
* Sends a message to the hub chain.
|
|
9044
9607
|
* @param {SendMessageParams} params - Includes dstChainKey, the chain key of the hub chain.
|
|
@@ -9258,7 +9821,12 @@ declare class SolanaSpokeService {
|
|
|
9258
9821
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<SolanaChainKey>): Promise<Result<WaitForTxReceiptReturnType<SolanaChainKey>>>;
|
|
9259
9822
|
static getBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<number>;
|
|
9260
9823
|
static getTokenAccountBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
9261
|
-
|
|
9824
|
+
/**
|
|
9825
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
9826
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
9827
|
+
*/
|
|
9828
|
+
static getMintTokenProgramId(connection: Connection$1, mint: PublicKey): Promise<PublicKey>;
|
|
9829
|
+
static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey, tokenProgramId?: PublicKey): Promise<SolanaBase58PublicKey>;
|
|
9262
9830
|
static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
|
|
9263
9831
|
}
|
|
9264
9832
|
|
|
@@ -9345,14 +9913,6 @@ interface State {
|
|
|
9345
9913
|
hub_chain_id: string;
|
|
9346
9914
|
owner: string;
|
|
9347
9915
|
}
|
|
9348
|
-
/**
|
|
9349
|
-
* InjectiveSpokeService provides methods for interacting with the Injective spoke chain,
|
|
9350
|
-
* specifically for managing token deposits and transfers between the spoke chain and hub chain.
|
|
9351
|
-
* It handles the cross-chain communication and token bridging functionality, allowing users to:
|
|
9352
|
-
* - Deposit tokens from Injective to the hub chain
|
|
9353
|
-
* - Check token balances on the spoke chain
|
|
9354
|
-
* - Transfer tokens with custom data payloads
|
|
9355
|
-
*/
|
|
9356
9916
|
declare class InjectiveSpokeService {
|
|
9357
9917
|
private readonly config;
|
|
9358
9918
|
readonly chainGrpcWasmApi: ChainGrpcWasmApi;
|
|
@@ -9360,7 +9920,10 @@ declare class InjectiveSpokeService {
|
|
|
9360
9920
|
readonly endpoints: NetworkEndpoints;
|
|
9361
9921
|
private readonly pollingIntervalMs;
|
|
9362
9922
|
private readonly maxTimeoutMs;
|
|
9923
|
+
private readonly gasPrice;
|
|
9363
9924
|
constructor(config: ConfigService);
|
|
9925
|
+
/** Parse a chain-config gas price like `"500000000inj"` into its numeric price and denom. */
|
|
9926
|
+
private parseGasPrice;
|
|
9364
9927
|
/**
|
|
9365
9928
|
* Estimate the gas for a transaction.
|
|
9366
9929
|
* @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
@@ -9384,7 +9947,7 @@ declare class InjectiveSpokeService {
|
|
|
9384
9947
|
* @returns {Promise<bigint>} The balance of the token.
|
|
9385
9948
|
*/
|
|
9386
9949
|
getDeposit(params: GetDepositParams<InjectiveChainKey>): Promise<bigint>;
|
|
9387
|
-
getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string): Promise<InjectiveRawTransaction>;
|
|
9950
|
+
getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string, funds?: InjectiveCoin[]): Promise<InjectiveRawTransaction>;
|
|
9388
9951
|
getState(chainId: InjectiveChainKey): Promise<State>;
|
|
9389
9952
|
/**
|
|
9390
9953
|
* Sends a message to the hub chain.
|
|
@@ -9525,7 +10088,6 @@ declare class SpokeService {
|
|
|
9525
10088
|
waitForTxReceipt<C extends SpokeChainKey = SpokeChainKey>(params: WaitForTxReceiptParams<C>): Promise<Result<WaitForTxReceiptReturnType<C>>>;
|
|
9526
10089
|
}
|
|
9527
10090
|
|
|
9528
|
-
type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
|
|
9529
10091
|
/**
|
|
9530
10092
|
* Stable error message strings emitted by relay-layer helpers ({@link submitTransaction},
|
|
9531
10093
|
* {@link relayTxAndWaitPacket}) on failure.
|
|
@@ -9580,18 +10142,6 @@ type SubmitTxResponse = {
|
|
|
9580
10142
|
success: boolean;
|
|
9581
10143
|
message: string;
|
|
9582
10144
|
};
|
|
9583
|
-
type PacketData = {
|
|
9584
|
-
src_chain_id: number;
|
|
9585
|
-
src_tx_hash: string;
|
|
9586
|
-
src_address: string;
|
|
9587
|
-
status: RelayTxStatus;
|
|
9588
|
-
dst_chain_id: number;
|
|
9589
|
-
conn_sn: number;
|
|
9590
|
-
dst_address: string;
|
|
9591
|
-
dst_tx_hash: string;
|
|
9592
|
-
signatures: string[];
|
|
9593
|
-
payload: string;
|
|
9594
|
-
};
|
|
9595
10145
|
type GetTransactionPacketsResponse = {
|
|
9596
10146
|
success: boolean;
|
|
9597
10147
|
data: PacketData[];
|
|
@@ -9608,10 +10158,11 @@ type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResp
|
|
|
9608
10158
|
type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
|
|
9609
10159
|
type RelayAndWaitParams = {
|
|
9610
10160
|
srcTxHash: string;
|
|
9611
|
-
data: RelayExtraData;
|
|
10161
|
+
data: RelayExtraData | OnDemandRelayData;
|
|
9612
10162
|
chainKey: SpokeChainKey;
|
|
9613
10163
|
relayerApiEndpoint: HttpUrl;
|
|
9614
10164
|
timeout: number | undefined;
|
|
10165
|
+
pollTxHash?: string;
|
|
9615
10166
|
};
|
|
9616
10167
|
/**
|
|
9617
10168
|
* Submits a transaction to the intent relay service.
|
|
@@ -9627,6 +10178,8 @@ type RelayAndWaitParams = {
|
|
|
9627
10178
|
* requires coordinated updates across all callers — prefer adding a new code to
|
|
9628
10179
|
* {@link RELAY_ERROR_CODES} over renaming.
|
|
9629
10180
|
*
|
|
10181
|
+
* NOTE: if transaction was already relayed, post request will return { success: true, message: 'Transaction registered' }
|
|
10182
|
+
*
|
|
9630
10183
|
* @param payload - The request payload containing the 'submit' action type and parameters.
|
|
9631
10184
|
* @param apiUrl - The URL of the intent relay service.
|
|
9632
10185
|
* @returns The response from the intent relay service.
|
|
@@ -11502,8 +12055,6 @@ declare function isSpokeApproveParamsStellar<K extends SpokeChainKey, Raw extend
|
|
|
11502
12055
|
srcChainKey: StellarChainKey;
|
|
11503
12056
|
}>;
|
|
11504
12057
|
declare function isRawDestinationParams(value: unknown): value is RawDestinationParams;
|
|
11505
|
-
declare function isSubmitSwapTxResponse(value: unknown): value is SubmitSwapTxResponse;
|
|
11506
|
-
declare function isSubmitSwapTxStatusResponse(value: unknown): value is SubmitSwapTxStatusResponse;
|
|
11507
12058
|
declare function isBitcoinWalletProviderType(wp: IWalletProvider): wp is IBitcoinWalletProvider;
|
|
11508
12059
|
declare function isEvmWalletProviderType(walletProvider: IWalletProvider): walletProvider is IEvmWalletProvider;
|
|
11509
12060
|
declare function isStellarWalletProviderType(walletProvider: IWalletProvider): walletProvider is IStellarWalletProvider;
|
|
@@ -11513,6 +12064,20 @@ declare function isOptionalStellarWalletProviderType(walletProvider: IWalletProv
|
|
|
11513
12064
|
declare function isUndefinedOrValidWalletProviderForChainKey<K extends SpokeChainKey>(chainKey: K, walletProvider: IWalletProvider | undefined): walletProvider is GetWalletProviderType<K> | undefined;
|
|
11514
12065
|
declare function isOptionalBitcoinWalletProviderType(walletProvider: IWalletProvider | undefined): walletProvider is IBitcoinWalletProvider | undefined;
|
|
11515
12066
|
|
|
12067
|
+
/**
|
|
12068
|
+
* Default logger. Mirrors the SDK's historical `console.*` behavior so existing consumers
|
|
12069
|
+
* see no change when they don't pass a `logger`. `data` is appended only when present to keep
|
|
12070
|
+
* single-arg log lines unchanged.
|
|
12071
|
+
*/
|
|
12072
|
+
declare const consoleLogger: SodaxLogger;
|
|
12073
|
+
/** No-op logger. Drops every SDK log line. Selected via `new Sodax({ logger: 'silent' })`. */
|
|
12074
|
+
declare const silentLogger: SodaxLogger;
|
|
12075
|
+
/**
|
|
12076
|
+
* Resolve a {@link SodaxLoggerOption} (a preset name, a custom logger, or `undefined`) into a
|
|
12077
|
+
* concrete {@link SodaxLogger}. Defaults to {@link consoleLogger} so logging is on unless opted out.
|
|
12078
|
+
*/
|
|
12079
|
+
declare function resolveLogger(option: SodaxLoggerOption | undefined): SodaxLogger;
|
|
12080
|
+
|
|
11516
12081
|
/** Swap-module narrow error types. */
|
|
11517
12082
|
|
|
11518
12083
|
declare const swapInvariant: FeatureInvariant;
|
|
@@ -11526,7 +12091,7 @@ type SwapCreateIntentErrorCode = CreateIntentErrorCode;
|
|
|
11526
12091
|
* that handles both `postExecution` and `swap` errors expecting the same union.
|
|
11527
12092
|
*/
|
|
11528
12093
|
type PostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
11529
|
-
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'>;
|
|
12094
|
+
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'>;
|
|
11530
12095
|
type SwapCreateIntentError = SodaxError<SwapCreateIntentErrorCode>;
|
|
11531
12096
|
type PostExecutionError = SodaxError<PostExecutionErrorCode>;
|
|
11532
12097
|
type SwapError = SodaxError<SwapErrorCode>;
|
|
@@ -11549,8 +12114,8 @@ type CreateIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
|
11549
12114
|
intent: Intent & FeeAmount;
|
|
11550
12115
|
relayData: RelayExtraData;
|
|
11551
12116
|
};
|
|
11552
|
-
type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>>;
|
|
11553
|
-
type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>>;
|
|
12117
|
+
type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>, SwapExtras<K>>;
|
|
12118
|
+
type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>, SwapExtras<K>>;
|
|
11554
12119
|
/**
|
|
11555
12120
|
* Params for `cancelIntent`.
|
|
11556
12121
|
* Because `Intent.srcChain` is an `IntentRelayChainId` (bigint) whose literal type cannot
|
|
@@ -11564,10 +12129,17 @@ type CancelIntentParams<K extends SpokeChainKey> = {
|
|
|
11564
12129
|
timeout?: number;
|
|
11565
12130
|
};
|
|
11566
12131
|
type CancelIntentActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CancelIntentParams<K>>;
|
|
12132
|
+
type GetQuoteParams = SolverIntentQuoteRequest & {
|
|
12133
|
+
/** Optional per-call override of the configured swap partner fee. Falls back to config when omitted. */
|
|
12134
|
+
partnerFee?: PartnerFee;
|
|
12135
|
+
};
|
|
11567
12136
|
type SwapServiceConstructorParams = {
|
|
11568
12137
|
config: ConfigService;
|
|
11569
12138
|
spoke: SpokeService;
|
|
11570
12139
|
hubProvider: HubProvider;
|
|
12140
|
+
backendApi: BackendApiService;
|
|
12141
|
+
/** Opt-in backend submit-tx 2-step flow (from `SodaxOptions.swapsOptions.useBackendSubmitTx`). Default off. */
|
|
12142
|
+
useBackendSubmitTx?: boolean;
|
|
11571
12143
|
};
|
|
11572
12144
|
/**
|
|
11573
12145
|
* Main entry point for the SODAX swap feature.
|
|
@@ -11592,7 +12164,9 @@ declare class SwapService {
|
|
|
11592
12164
|
readonly solver: SolverConfig;
|
|
11593
12165
|
readonly partnerFee: PartnerFee | undefined;
|
|
11594
12166
|
readonly relayerApiEndpoint: HttpUrl;
|
|
11595
|
-
|
|
12167
|
+
readonly backendApi: BackendApiService;
|
|
12168
|
+
readonly useBackendSubmitTx: boolean;
|
|
12169
|
+
constructor({ config, hubProvider, spoke, backendApi, useBackendSubmitTx }: SwapServiceConstructorParams);
|
|
11596
12170
|
/**
|
|
11597
12171
|
* Estimates the gas cost for a raw (unsigned) transaction on a spoke chain.
|
|
11598
12172
|
*
|
|
@@ -11603,10 +12177,13 @@ declare class SwapService {
|
|
|
11603
12177
|
/**
|
|
11604
12178
|
* Requests a price quote from the solver API for a given token pair and amount.
|
|
11605
12179
|
*
|
|
11606
|
-
* Adjusts `payload.amount` by the
|
|
11607
|
-
*
|
|
12180
|
+
* Adjusts `payload.amount` by the partner fee before forwarding to the solver, so the returned
|
|
12181
|
+
* `quoted_amount` reflects the net output the user actually receives. Pass `partnerFee` to match
|
|
12182
|
+
* a per-action override supplied to `createIntent` (`extras.partnerFee`); omit it to use the
|
|
12183
|
+
* configured swap fee.
|
|
11608
12184
|
*
|
|
11609
|
-
* @param payload -
|
|
12185
|
+
* @param payload - The solver quote request, optionally carrying a per-call `partnerFee` override
|
|
12186
|
+
* (defaults to the configured swap partner fee). `partnerFee` is stripped before forwarding.
|
|
11610
12187
|
* @returns A `Result` containing `{ quoted_amount: bigint }` on success, or a
|
|
11611
12188
|
* `SolverErrorResponse` (with a `SolverIntentErrorCode`) on failure.
|
|
11612
12189
|
*
|
|
@@ -11621,7 +12198,7 @@ declare class SwapService {
|
|
|
11621
12198
|
* });
|
|
11622
12199
|
* if (response.ok) console.log('Quoted amount:', response.value.quoted_amount);
|
|
11623
12200
|
*/
|
|
11624
|
-
getQuote(payload:
|
|
12201
|
+
getQuote(payload: GetQuoteParams): Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>;
|
|
11625
12202
|
/**
|
|
11626
12203
|
* Calculates the partner fee that will be deducted from the given input amount.
|
|
11627
12204
|
*
|
|
@@ -11683,14 +12260,22 @@ declare class SwapService {
|
|
|
11683
12260
|
/**
|
|
11684
12261
|
* Executes a full end-to-end cross-chain swap.
|
|
11685
12262
|
*
|
|
11686
|
-
* Orchestrates the complete swap lifecycle
|
|
11687
|
-
*
|
|
11688
|
-
*
|
|
11689
|
-
*
|
|
11690
|
-
*
|
|
11691
|
-
*
|
|
11692
|
-
*
|
|
11693
|
-
*
|
|
12263
|
+
* Orchestrates the complete swap lifecycle. `createIntent` first submits the intent transaction on
|
|
12264
|
+
* the source spoke chain; completion then runs via one of two paths, both bounded by a single
|
|
12265
|
+
* shared `timeout` budget:
|
|
12266
|
+
*
|
|
12267
|
+
* - **Client-side (default), {@link fallbackSwapSteps}:** verifies the spoke tx landed on-chain,
|
|
12268
|
+
* relays it to the hub (Sonic) and waits for the packet — skipped when `srcChainKey` is the hub,
|
|
12269
|
+
* where the spoke tx already is the hub tx — then calls `postExecution` to notify the solver,
|
|
12270
|
+
* triggering it to fill the intent.
|
|
12271
|
+
* - **Backend 2-step (opt-in via `swapsOptions.useBackendSubmitTx`), {@link submitTx}:** hands the
|
|
12272
|
+
* broadcast tx to the swaps API, which verifies, relays and post-executes server-side, then polls
|
|
12273
|
+
* for completion. On ANY non-success it transparently falls back to the client-side path above —
|
|
12274
|
+
* safe because re-relaying / re-posting an already-processed swap is idempotent (no double-fill).
|
|
12275
|
+
*
|
|
12276
|
+
* @param _params - Swap action params including intent parameters, wallet provider, and an optional
|
|
12277
|
+
* `timeout` — the single shared budget for the whole completion flow (relay/poll plus any
|
|
12278
|
+
* fallback), so total wall-clock never exceeds it.
|
|
11694
12279
|
* @returns A `Result<SwapResponse, SwapError>`. On success:
|
|
11695
12280
|
* - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
|
|
11696
12281
|
* - `intent` — the on-chain intent object that was created.
|
|
@@ -11711,6 +12296,29 @@ declare class SwapService {
|
|
|
11711
12296
|
* - `UNKNOWN` — uncategorized fallback.
|
|
11712
12297
|
*/
|
|
11713
12298
|
swap<K extends SpokeChainKey>(_params: SwapActionParams<K, false>): Promise<Result<SwapResponse, SwapError>>;
|
|
12299
|
+
/**
|
|
12300
|
+
* Client-side swap completion (the default path): relay the broadcast intent tx to the hub — or
|
|
12301
|
+
* use it directly when the source IS the hub — then notify the solver via post-execution and
|
|
12302
|
+
* build the {@link SwapResponse}. Extracted verbatim from `swap()` so the opt-in backend 2-step
|
|
12303
|
+
* path ({@link submitTx}) can fall back to it on any non-success.
|
|
12304
|
+
*/
|
|
12305
|
+
private fallbackSwapSteps;
|
|
12306
|
+
/**
|
|
12307
|
+
* Backend 2-step swap path (opt-in via `swapsOptions.useBackendSubmitTx`): hand the broadcast
|
|
12308
|
+
* intent tx to the swaps API (`POST /swaps/submit-tx`); the backend relays + post-executes
|
|
12309
|
+
* server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs the same
|
|
12310
|
+
* {@link SwapResponse} the client-side path returns (`result.dstIntentTxHash` → delivery info,
|
|
12311
|
+
* `result.intent_hash` → solver response).
|
|
12312
|
+
*
|
|
12313
|
+
* Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, terminal `failed` /
|
|
12314
|
+
* abandoned, or poll timeout) so `swap()` falls back to {@link fallbackSwapSteps}.
|
|
12315
|
+
*
|
|
12316
|
+
* Falling back is safe: re-relaying / re-posting an already-processed swap is idempotent — the
|
|
12317
|
+
* relay dedups and returns the existing `executed` packet, and the solver re-affirms the intent
|
|
12318
|
+
* (no double-fill). Verified live by `e2e-tests/e2e-relay.test.ts`. Polling stops at
|
|
12319
|
+
* `deadline - reserve` so the fallback keeps a guaranteed slice of the shared `swap` budget.
|
|
12320
|
+
*/
|
|
12321
|
+
private submitTx;
|
|
11714
12322
|
/**
|
|
11715
12323
|
* Checks whether the relevant spender contract is already approved to spend the input token amount.
|
|
11716
12324
|
*
|
|
@@ -11754,7 +12362,7 @@ declare class SwapService {
|
|
|
11754
12362
|
* - `raw: false` — broadcasts the transaction; `walletProvider` is required and must match `K`.
|
|
11755
12363
|
*
|
|
11756
12364
|
* Validates tokens and chain keys against the active `ConfigService` before constructing the
|
|
11757
|
-
* intent. Bitcoin source chains require an additional
|
|
12365
|
+
* intent. Bitcoin source chains require an additional Bound Exchange access token step.
|
|
11758
12366
|
*
|
|
11759
12367
|
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
11760
12368
|
* and optional `skipSimulation` flag.
|
|
@@ -11857,6 +12465,24 @@ declare class SwapService {
|
|
|
11857
12465
|
* @returns A `Result` containing `RelayExtraData`: `{ address: Hex; payload: Hex }`.
|
|
11858
12466
|
*/
|
|
11859
12467
|
getIntentSubmitTxExtraData(params: GetIntentSubmitTxExtraDataParams): Promise<Result<RelayExtraData>>;
|
|
12468
|
+
/**
|
|
12469
|
+
* Re-derives the byte-identical relay extra data (`{ address, payload }`) for a swap intent from a
|
|
12470
|
+
* fully-populated `Intent` alone — no on-chain call, no original `createIntent` return value needed.
|
|
12471
|
+
*
|
|
12472
|
+
* The `payload` matches exactly what `createIntent` relayed when the intent was first created:
|
|
12473
|
+
* - Sonic-hub source — raw `createIntent(intent)` calldata.
|
|
12474
|
+
* - Any spoke source — the `[approve, createIntent]` multicall (uniform across all spokes).
|
|
12475
|
+
*
|
|
12476
|
+
* Byte-identity is possible because the only originally-random field, `intentId`, is already
|
|
12477
|
+
* carried on the `Intent`; everything else in the payload is a pure function of the intent and
|
|
12478
|
+
* the configured intents contract. Use this to rebuild relay submission data for a manual relay
|
|
12479
|
+
* step when the runtime `relayData` from `createIntent` is no longer available.
|
|
12480
|
+
*
|
|
12481
|
+
* @param intent - A fully-populated intent (e.g. from `getIntent(txHash)` or the `intent` field
|
|
12482
|
+
* returned by `createIntent`).
|
|
12483
|
+
* @returns A `Result` containing `RelayExtraData`: `{ address: Hex; payload: Hex }`.
|
|
12484
|
+
*/
|
|
12485
|
+
reconstructRelayData(intent: Intent): Result<RelayExtraData>;
|
|
11860
12486
|
/**
|
|
11861
12487
|
* Fetches a previously created `Intent` from the hub chain by its transaction hash.
|
|
11862
12488
|
*
|
|
@@ -11883,6 +12509,11 @@ declare class SwapService {
|
|
|
11883
12509
|
* Use this after `getStatus` returns `SolverIntentStatusCode.SOLVED (3)` to obtain the
|
|
11884
12510
|
* destination-chain transaction hash from `packet.dst_tx_hash`.
|
|
11885
12511
|
*
|
|
12512
|
+
* A single solver fill tx emits multiple relay packets sharing the same `src_tx_hash`. The
|
|
12513
|
+
* user-facing `IntentFilled` delivery is the packet whose payload targets the hub intents
|
|
12514
|
+
* contract; `selectSolvedIntentPacket` disambiguates so the returned `dst_tx_hash` is the
|
|
12515
|
+
* destination delivery tx rather than an internal hop.
|
|
12516
|
+
*
|
|
11886
12517
|
* @param chainId - The destination spoke chain key (where output tokens are delivered).
|
|
11887
12518
|
* @param fillTxHash - The solver's fill transaction hash, obtained from `getStatus.fill_tx_hash`.
|
|
11888
12519
|
* @param timeout - Poll timeout in milliseconds. Defaults to `DEFAULT_RELAY_TX_TIMEOUT` (120 s).
|
|
@@ -11940,13 +12571,13 @@ declare class SwapService {
|
|
|
11940
12571
|
declare const migrationInvariant: FeatureInvariant;
|
|
11941
12572
|
type MigrationOp = 'migratebnUSD' | 'migrateIcxToSoda' | 'revertMigrateSodaToIcx' | 'migrateBaln';
|
|
11942
12573
|
type MigrationDirection = 'forward' | 'reverse';
|
|
11943
|
-
type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12574
|
+
type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
11944
12575
|
type RevertMigrationOrchestrationErrorCode = Exclude<MigrateOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
|
|
11945
12576
|
type MigrationCreateIntentErrorCode = CreateIntentErrorCode;
|
|
11946
12577
|
type MigrationApproveErrorCode = ApproveErrorCode;
|
|
11947
12578
|
type MigrationAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
11948
12579
|
type MigrationLookupErrorCode = LookupErrorCode;
|
|
11949
|
-
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'>;
|
|
12580
|
+
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'>;
|
|
11950
12581
|
type MigrateOrchestrationError = SodaxError<MigrateOrchestrationErrorCode>;
|
|
11951
12582
|
type RevertMigrationOrchestrationError = SodaxError<RevertMigrationOrchestrationErrorCode>;
|
|
11952
12583
|
type MigrationCreateIntentError = SodaxError<MigrationCreateIntentErrorCode>;
|
|
@@ -12347,7 +12978,7 @@ declare class BalnSwapService {
|
|
|
12347
12978
|
* @param user - The EVM address of the user to query locks for.
|
|
12348
12979
|
* @returns An immutable array of `DetailedLock` objects, one per active lock.
|
|
12349
12980
|
*/
|
|
12350
|
-
getDetailedUserLocks(publicClient: PublicClient
|
|
12981
|
+
getDetailedUserLocks(publicClient: PublicClient, user: Address$1): Promise<readonly DetailedLock[]>;
|
|
12351
12982
|
/**
|
|
12352
12983
|
* Encodes a single `swap` call on the BALN swap contract.
|
|
12353
12984
|
*
|
|
@@ -12632,12 +13263,12 @@ declare class MigrationService {
|
|
|
12632
13263
|
|
|
12633
13264
|
declare const bridgeInvariant: FeatureInvariant;
|
|
12634
13265
|
type BridgeAction = 'bridge';
|
|
12635
|
-
type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
13266
|
+
type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12636
13267
|
type BridgeCreateIntentErrorCode = CreateIntentErrorCode;
|
|
12637
13268
|
type BridgeApproveErrorCode = ApproveErrorCode;
|
|
12638
13269
|
type BridgeAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
12639
13270
|
type BridgeLookupErrorCode = LookupErrorCode;
|
|
12640
|
-
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'>;
|
|
13271
|
+
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'>;
|
|
12641
13272
|
type BridgeOrchestrationError = SodaxError<BridgeOrchestrationErrorCode>;
|
|
12642
13273
|
type BridgeCreateIntentError = SodaxError<BridgeCreateIntentErrorCode>;
|
|
12643
13274
|
type BridgeApproveError = SodaxError<BridgeApproveErrorCode>;
|
|
@@ -12774,7 +13405,7 @@ declare class BridgeService {
|
|
|
12774
13405
|
* transaction simulation or batching). When `raw` is `false`, signs and submits the deposit
|
|
12775
13406
|
* transaction via the provided wallet provider.
|
|
12776
13407
|
*
|
|
12777
|
-
* Bitcoin is only supported with `raw: false` because it requires the
|
|
13408
|
+
* Bitcoin is only supported with `raw: false` because it requires the Bound Exchange trading wallet
|
|
12778
13409
|
* derivation flow.
|
|
12779
13410
|
*
|
|
12780
13411
|
* @param _params - Bridge parameters including source/destination chain keys, token addresses,
|
|
@@ -12784,6 +13415,16 @@ declare class BridgeService {
|
|
|
12784
13415
|
* contains the hub wallet address and encoded hub execution payload needed for relay.
|
|
12785
13416
|
*/
|
|
12786
13417
|
createBridgeIntent<K extends SpokeChainKey, Raw extends boolean>(_params: BridgeParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, BridgeCreateIntentError>>;
|
|
13418
|
+
/**
|
|
13419
|
+
* Resolves a bridge endpoint's {@link XToken} descriptor from a chain key + token address.
|
|
13420
|
+
*
|
|
13421
|
+
* Spoke endpoints (and hub-native tokens such as USDC/WETH/S whose on-chain address equals their
|
|
13422
|
+
* hub asset) resolve by original asset address. On the hub a caller may instead hold a hub asset
|
|
13423
|
+
* that has no spoke-token entry under the hub chain — e.g. a partner BTC fee held as the BTC hub
|
|
13424
|
+
* asset, whose only spoke-token entry lives on Bitcoin. Resolve those by hub-asset address so the
|
|
13425
|
+
* Sonic-sourced "withdraw directly" bridge can find the matching vault/decimals.
|
|
13426
|
+
*/
|
|
13427
|
+
private resolveBridgeEndpointToken;
|
|
12787
13428
|
/**
|
|
12788
13429
|
* Encodes the hub-side execution payload for a bridge operation.
|
|
12789
13430
|
*
|
|
@@ -12900,7 +13541,7 @@ declare const stakingInvariant: FeatureInvariant;
|
|
|
12900
13541
|
/** The 5 user-facing staking operations. Carried on `context.action`. */
|
|
12901
13542
|
type StakingActionType = 'stake' | 'unstake' | 'instantUnstake' | 'claim' | 'cancelUnstake';
|
|
12902
13543
|
/** Codes the `stake` orchestrator can return — only one that calls `verifyTxHash`. */
|
|
12903
|
-
type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
13544
|
+
type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12904
13545
|
/** Codes the 4 non-stake orchestrators (`unstake`/`instantUnstake`/`claim`/`cancelUnstake`) share. */
|
|
12905
13546
|
type StakingOrchestrationErrorCode = Exclude<StakeOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
|
|
12906
13547
|
type StakingCreateIntentErrorCode = CreateIntentErrorCode;
|
|
@@ -13900,7 +14541,7 @@ declare class ClService {
|
|
|
13900
14541
|
* @returns `Result<PoolRewardConfig>` — on success, contains the reward token address,
|
|
13901
14542
|
* reward rate per second, and the timestamp of the last position-affecting action.
|
|
13902
14543
|
*/
|
|
13903
|
-
getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient
|
|
14544
|
+
getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient): Promise<Result<PoolRewardConfig>>;
|
|
13904
14545
|
/**
|
|
13905
14546
|
* Build and submit the spoke-side transaction that harvests hook rewards for a position.
|
|
13906
14547
|
*
|
|
@@ -13969,7 +14610,7 @@ declare class ClService {
|
|
|
13969
14610
|
* fee tiers, token metadata with optional StatAToken enrichment, and optional
|
|
13970
14611
|
* reward configuration. `isActive` is `true` when `sqrtPriceX96 > 0`.
|
|
13971
14612
|
*/
|
|
13972
|
-
getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient
|
|
14613
|
+
getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient): Promise<Result<PoolData>>;
|
|
13973
14614
|
/**
|
|
13974
14615
|
* Fetch full details for a concentrated-liquidity position NFT.
|
|
13975
14616
|
*
|
|
@@ -13986,7 +14627,7 @@ declare class ClService {
|
|
|
13986
14627
|
* current token amounts, tick-boundary prices, unclaimed fees, and optional
|
|
13987
14628
|
* underlying amounts for StatAToken pools.
|
|
13988
14629
|
*/
|
|
13989
|
-
getPositionInfo(tokenId: bigint, publicClient: PublicClient
|
|
14630
|
+
getPositionInfo(tokenId: bigint, publicClient: PublicClient): Promise<Result<ClPositionInfo>>;
|
|
13990
14631
|
/**
|
|
13991
14632
|
* Compute the maximum liquidity achievable given both token input amounts.
|
|
13992
14633
|
*
|
|
@@ -14117,7 +14758,7 @@ declare const mmInvariant: FeatureInvariant;
|
|
|
14117
14758
|
type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
|
|
14118
14759
|
type MoneyMarketCreateIntentErrorCode = CreateIntentErrorCode;
|
|
14119
14760
|
/** Codes any of the 4 orchestrators (`supply`/`borrow`/`withdraw`/`repay`) can return. */
|
|
14120
|
-
type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
14761
|
+
type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
14121
14762
|
type MoneyMarketApproveErrorCode = ApproveErrorCode;
|
|
14122
14763
|
type MoneyMarketAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
14123
14764
|
type MoneyMarketGasEstimationErrorCode = GasEstimationErrorCode;
|
|
@@ -15265,6 +15906,15 @@ declare class MoneyMarketService {
|
|
|
15265
15906
|
* trigger the hub-side execution via {@link relayTxAndWaitPacket}.
|
|
15266
15907
|
*/
|
|
15267
15908
|
createSupplyIntent<K extends SpokeChainKey, Raw extends boolean>(_params: MoneyMarketSupplyActionParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, MoneyMarketCreateIntentError>>;
|
|
15909
|
+
/**
|
|
15910
|
+
* Build the relay submit/poll identity for a money-market borrow/withdraw.
|
|
15911
|
+
*
|
|
15912
|
+
* Bitcoin borrow/withdraw are on-demand: the spoke result is a signed payload JSON that the relay
|
|
15913
|
+
* submits under the literal "withdraw" tx_hash and tracks under a derived `od:<hash>` poll id
|
|
15914
|
+
* (see {@link BitcoinSpokeService.getOnDemandRelayIdentity}). Every other chain relays and polls by
|
|
15915
|
+
* its real spoke tx hash, so `pollTxHash` is undefined and `srcChainTxHash` stays the spoke tx.
|
|
15916
|
+
*/
|
|
15917
|
+
private buildRelayIdentity;
|
|
15268
15918
|
/**
|
|
15269
15919
|
* Borrow tokens from the money market lending pool and wait for the cross-chain relay to
|
|
15270
15920
|
* deliver the funds to the destination address.
|
|
@@ -15554,6 +16204,18 @@ type PartnerFeeClaimSwapParams = {
|
|
|
15554
16204
|
timeout?: number;
|
|
15555
16205
|
};
|
|
15556
16206
|
type PartnerFeeClaimSwapAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimSwapParams>;
|
|
16207
|
+
type PartnerFeeClaimCancelParams = {
|
|
16208
|
+
srcChainKey: HubChainKey;
|
|
16209
|
+
srcAddress: Address$1;
|
|
16210
|
+
fromToken: Address$1;
|
|
16211
|
+
toToken: Address$1;
|
|
16212
|
+
};
|
|
16213
|
+
type PartnerFeeClaimCancelAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimCancelParams>;
|
|
16214
|
+
type GetUserIntentParams = {
|
|
16215
|
+
user: Address$1;
|
|
16216
|
+
fromToken: Address$1;
|
|
16217
|
+
toToken: Address$1;
|
|
16218
|
+
};
|
|
15557
16219
|
type PartnerFeeClaimServiceConstructorParams = {
|
|
15558
16220
|
config: ConfigService;
|
|
15559
16221
|
hubProvider: HubProvider;
|
|
@@ -15688,6 +16350,11 @@ declare class PartnerFeeClaimService {
|
|
|
15688
16350
|
* This is the low-level building block. Use `swap` for the full flow that also waits for
|
|
15689
16351
|
* the solver to execute the intent.
|
|
15690
16352
|
*
|
|
16353
|
+
* Guards against same-token intents: if the configured output token equals `fromToken` the solver
|
|
16354
|
+
* cannot fill the swap, so the call is rejected with `VALIDATION_FAILED` before any transaction is
|
|
16355
|
+
* built. The guard fails closed — if the preference lookup fails the call returns that error rather
|
|
16356
|
+
* than submitting an intent that may become unfillable.
|
|
16357
|
+
*
|
|
15691
16358
|
* @param _params - Action descriptor containing:
|
|
15692
16359
|
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
15693
16360
|
* - `params.srcAddress` — partner's EVM address; also used as the intent creator.
|
|
@@ -15718,10 +16385,59 @@ declare class PartnerFeeClaimService {
|
|
|
15718
16385
|
*
|
|
15719
16386
|
* On failure the `error` is tagged:
|
|
15720
16387
|
* - `WAIT_INTENT_AUTO_SWAP_FAILED` — transaction was submitted but receipt polling failed.
|
|
15721
|
-
* - Error from `createIntentAutoSwap` — if the initial submission failed
|
|
16388
|
+
* - Error from `createIntentAutoSwap` — if the initial submission failed, including
|
|
16389
|
+
* `VALIDATION_FAILED` when the output token equals the fee token (same-token guard) or the
|
|
16390
|
+
* preference lookup that backs the guard fails.
|
|
15722
16391
|
* - Error from `SolverApiService.postExecution` — if the solver notification failed.
|
|
15723
16392
|
*/
|
|
15724
16393
|
swap(_params: PartnerFeeClaimSwapAction<HubChainKey, false>): Promise<Result<IntentAutoSwapResult>>;
|
|
16394
|
+
/**
|
|
16395
|
+
* Cancels a partner fee-claim auto-swap intent and refunds the input token to the partner.
|
|
16396
|
+
*
|
|
16397
|
+
* This targets the ProtocolIntents contract's own `cancelIntent(fromToken, toToken)`, which is
|
|
16398
|
+
* the only authorized cancel path for partner auto-swap intents: the intent's `creator` is the
|
|
16399
|
+
* ProtocolIntents contract (not the partner), so the generic `SwapService.cancelIntent` reverts
|
|
16400
|
+
* with `Unauthorized()`. ProtocolIntents looks up the caller's intent for the token pair, cancels
|
|
16401
|
+
* it in the main intents contract (as the creator), and transfers the locked `inputAmount` back
|
|
16402
|
+
* to the partner (`msg.sender`).
|
|
16403
|
+
*
|
|
16404
|
+
* Use this to recover funds stuck in an unfillable intent — most commonly a same-token claim
|
|
16405
|
+
* (`fromToken === toToken`) the solver refused to fill (see the guard in {@link swap}).
|
|
16406
|
+
*
|
|
16407
|
+
* @param _params - Action descriptor containing:
|
|
16408
|
+
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
16409
|
+
* - `params.srcAddress` — the partner's EVM address; must match the intent's owner.
|
|
16410
|
+
* - `params.fromToken` — the stuck intent's input (fee) token, hub-chain address.
|
|
16411
|
+
* - `params.toToken` — the stuck intent's output token, hub-chain address.
|
|
16412
|
+
* - `raw` — when `true`, returns the unsigned transaction object instead of submitting it.
|
|
16413
|
+
* - `walletProvider` — required when `raw` is `false`; must be an EVM wallet provider.
|
|
16414
|
+
* @returns A `Result` containing the submitted transaction hash (`raw: false`) or the unsigned
|
|
16415
|
+
* raw transaction (`raw: true`).
|
|
16416
|
+
*/
|
|
16417
|
+
cancelIntent<Raw extends boolean>(_params: PartnerFeeClaimCancelAction<HubChainKey, Raw>): Promise<Result<TxReturnType<HubChainKey, Raw>>>;
|
|
16418
|
+
/**
|
|
16419
|
+
* Returns the stored intent hash for a partner's `(user, fromToken, toToken)` token pair.
|
|
16420
|
+
*
|
|
16421
|
+
* A non-zero hash means an auto-swap intent currently exists for that pair (e.g. an unfilled
|
|
16422
|
+
* same-token claim) and can be cancelled via {@link cancelIntent}. A zero hash
|
|
16423
|
+
* (`0x000…0`) means there is no open intent for the pair.
|
|
16424
|
+
*
|
|
16425
|
+
* @param params.user - The partner's EVM address on Sonic.
|
|
16426
|
+
* @param params.fromToken - Input (fee) token, hub-chain address.
|
|
16427
|
+
* @param params.toToken - Output token, hub-chain address.
|
|
16428
|
+
* @returns A `Result` containing the intent hash, or an `Error` tagged `LOOKUP_FAILED`.
|
|
16429
|
+
*/
|
|
16430
|
+
getUserIntent({ user, fromToken, toToken }: GetUserIntentParams): Promise<Result<Hex, Error>>;
|
|
16431
|
+
/**
|
|
16432
|
+
* Reads the full {@link Intent} details for a stored intent hash from the ProtocolIntents contract.
|
|
16433
|
+
*
|
|
16434
|
+
* Useful for displaying a stuck intent before cancelling it — e.g. the locked `inputAmount` and
|
|
16435
|
+
* `inputToken`. Pair with {@link getUserIntent} to resolve the hash from a token pair.
|
|
16436
|
+
*
|
|
16437
|
+
* @param intentHash - The intent hash (from {@link getUserIntent}).
|
|
16438
|
+
* @returns A `Result` containing the `Intent`, or an `Error` tagged `LOOKUP_FAILED`.
|
|
16439
|
+
*/
|
|
16440
|
+
getIntentDetails(intentHash: Hex): Promise<Result<Intent, Error>>;
|
|
15725
16441
|
}
|
|
15726
16442
|
|
|
15727
16443
|
type PartnerServiceConfig = {
|
|
@@ -15845,6 +16561,481 @@ declare class RecoveryService {
|
|
|
15845
16561
|
withdrawHubAsset<K extends SpokeChainKey, Raw extends boolean>(_params: WithdrawHubAssetAction<K, Raw>): Promise<Result<TxReturnType<K, Raw>>>;
|
|
15846
16562
|
}
|
|
15847
16563
|
|
|
16564
|
+
/**
|
|
16565
|
+
* leverageYield module narrow error types.
|
|
16566
|
+
*
|
|
16567
|
+
* The service owns the full vault-swap lifecycle: `deposit` / `withdraw` build
|
|
16568
|
+
* `CreateIntentParams`, `createVaultIntent` submits the intent on the source spoke chain,
|
|
16569
|
+
* and `vaultSwap` orchestrates the end-to-end flow (create → verify → relay → notify
|
|
16570
|
+
* solver). `approve` / `isAllowanceValid` manage the underlying-asset allowance on Sonic,
|
|
16571
|
+
* and the read methods query on-chain state.
|
|
16572
|
+
*
|
|
16573
|
+
* User-facing actions discriminated by `context.action`: `'deposit' | 'withdraw' |
|
|
16574
|
+
* 'approve' | 'vaultSwap'`. Read-only methods emit `LOOKUP_FAILED` partitioned by
|
|
16575
|
+
* `context.method`. Relay/verify codes appear only on `vaultSwap` — `createVaultIntent`
|
|
16576
|
+
* alone emits the create-intent subset.
|
|
16577
|
+
*/
|
|
16578
|
+
|
|
16579
|
+
declare const leverageYieldInvariant: FeatureInvariant;
|
|
16580
|
+
type LeverageYieldAction = 'deposit' | 'withdraw' | 'approve' | 'allowanceCheck' | 'vaultSwap';
|
|
16581
|
+
type LeverageYieldCreateIntentErrorCode = CreateIntentErrorCode;
|
|
16582
|
+
type LeverageYieldApproveErrorCode = ApproveErrorCode;
|
|
16583
|
+
type LeverageYieldAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
16584
|
+
type LeverageYieldLookupErrorCode = LookupErrorCode;
|
|
16585
|
+
/**
|
|
16586
|
+
* Codes returnable by the solver-notify step inside `vaultSwap`. Mirrors the swap
|
|
16587
|
+
* domain's `PostExecutionErrorCode` — duplicated deliberately so the leverage-yield
|
|
16588
|
+
* error surface stands alone (see `vaultSwap`).
|
|
16589
|
+
*/
|
|
16590
|
+
type LeverageYieldPostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
16591
|
+
/**
|
|
16592
|
+
* Codes returnable by the end-to-end `vaultSwap` orchestrator: the create-intent subset
|
|
16593
|
+
* plus verify, relay and solver-notify codes. Mirrors the swap domain's `SwapErrorCode`.
|
|
16594
|
+
*/
|
|
16595
|
+
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'>;
|
|
16596
|
+
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'>;
|
|
16597
|
+
type LeverageYieldCreateIntentError = SodaxError<LeverageYieldCreateIntentErrorCode>;
|
|
16598
|
+
type LeverageYieldApproveError = SodaxError<LeverageYieldApproveErrorCode>;
|
|
16599
|
+
type LeverageYieldAllowanceCheckError = SodaxError<LeverageYieldAllowanceCheckErrorCode>;
|
|
16600
|
+
type LeverageYieldLookupError = SodaxError<LeverageYieldLookupErrorCode>;
|
|
16601
|
+
type LeverageYieldPostExecutionError = SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16602
|
+
type LeverageYieldSwapError = SodaxError<LeverageYieldSwapErrorCode>;
|
|
16603
|
+
type LeverageYieldError = SodaxError<LeverageYieldErrorCode>;
|
|
16604
|
+
declare const isLeverageYieldCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
|
|
16605
|
+
declare const isLeverageYieldApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
|
|
16606
|
+
declare const isLeverageYieldAllowanceCheckError: (e: unknown) => e is SodaxError<AllowanceCheckErrorCode>;
|
|
16607
|
+
declare const isLeverageYieldLookupError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
16608
|
+
declare const isLeverageYieldPostExecutionError: (e: unknown) => e is SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16609
|
+
declare const isLeverageYieldSwapError: (e: unknown) => e is SodaxError<LeverageYieldSwapErrorCode>;
|
|
16610
|
+
declare const isLeverageYieldError: (e: unknown) => e is SodaxError<LeverageYieldErrorCode>;
|
|
16611
|
+
|
|
16612
|
+
/**
|
|
16613
|
+
* Leveraged-position snapshot from the vault's non-standard `getPositionDetails()`.
|
|
16614
|
+
* Field scales (mirroring the AAVE conventions the vault inherits):
|
|
16615
|
+
*/
|
|
16616
|
+
type LeverageYieldPosition = {
|
|
16617
|
+
/** Collateral supplied to the AAVE pool, in vault-asset units (18 decimals). */
|
|
16618
|
+
collateral: bigint;
|
|
16619
|
+
/** Variable debt borrowed against the collateral, in vault-asset units (18 decimals). */
|
|
16620
|
+
debt: bigint;
|
|
16621
|
+
/** Current loan-to-value in basis points (out of `10_000`; e.g. `8_500` = 85%). */
|
|
16622
|
+
ltv: bigint;
|
|
16623
|
+
/** AAVE health factor in WAD (1e18); below `1e18` implies liquidation risk, `type(uint256).max` = no debt. */
|
|
16624
|
+
healthFactor: bigint;
|
|
16625
|
+
/** Asset held by the vault but not yet supplied to the pool, in vault-asset units (18 decimals). */
|
|
16626
|
+
idleAsset: bigint;
|
|
16627
|
+
};
|
|
16628
|
+
/**
|
|
16629
|
+
* Output of {@link LeverageYieldService.getApr}. All rate fields are in RAY (1e27 = 100%)
|
|
16630
|
+
* matching the AAVE convention — divide by `RAY = 10n ** 27n` for the decimal form.
|
|
16631
|
+
*
|
|
16632
|
+
* `netAprRay` is the headline number a UI shows: net APR earned by a depositor at the
|
|
16633
|
+
* vault's `targetLTV`. It's a STEADY-STATE APR, not realised APY — assumes the AAVE rates
|
|
16634
|
+
* stay constant and the vault holds at `targetLTV` continuously. Realised APY in practice
|
|
16635
|
+
* depends on tick cadence, rate volatility, and the spread between supplyApr and borrowApr.
|
|
16636
|
+
*
|
|
16637
|
+
* The math:
|
|
16638
|
+
* ```
|
|
16639
|
+
* leverageMultiplier = targetLTV / (1 - targetLTV) // e.g. 0.85 / 0.15 = 5.667x
|
|
16640
|
+
* netAprRay = supplyAprRay + leverageMultiplier × (supplyAprRay - borrowAprRay)
|
|
16641
|
+
* ```
|
|
16642
|
+
* Equivalent to the geometric-series limit of recursive borrow → swap → supply at the
|
|
16643
|
+
* vault's target LTV. When `supplyApr > borrowApr` the leverage adds yield; when the
|
|
16644
|
+
* spread inverts the loop is a net cost and `netAprRay` goes negative.
|
|
16645
|
+
*/
|
|
16646
|
+
type LeverageYieldApr = {
|
|
16647
|
+
/** AAVE supply rate of the vault's `asset` (sodaWEETH-style), in RAY. */
|
|
16648
|
+
supplyAprRay: bigint;
|
|
16649
|
+
/** AAVE variable borrow rate of the vault's `borrowToken` (sodaETH-style), in RAY. */
|
|
16650
|
+
borrowAprRay: bigint;
|
|
16651
|
+
/** Target LTV in basis points, as read from `vault.targetLTV()`. */
|
|
16652
|
+
targetLtvBps: bigint;
|
|
16653
|
+
/**
|
|
16654
|
+
* Leverage multiplier ×1e18 (e.g. 5.667x is `5_666_666_666_666_666_667n`). Caller can
|
|
16655
|
+
* divide by `10n ** 18n` for the decimal form.
|
|
16656
|
+
*/
|
|
16657
|
+
leverageMultiplierWad: bigint;
|
|
16658
|
+
/** Net APR earned by a depositor at `targetLtvBps`, in RAY. Can be negative. */
|
|
16659
|
+
netAprRay: bigint;
|
|
16660
|
+
};
|
|
16661
|
+
/**
|
|
16662
|
+
* Off-chain LSD staking-APR snapshot for a leverage-yield vault's underlying asset.
|
|
16663
|
+
* Returned by {@link LeverageYieldService.getLsdApr} and embedded in
|
|
16664
|
+
* {@link LeverageYieldEffectiveApr}.
|
|
16665
|
+
*/
|
|
16666
|
+
type LeverageYieldLsdApr = {
|
|
16667
|
+
/** LSD staking APR in RAY (1e27 = 100%). Zero when the vault has no configured LSD source. */
|
|
16668
|
+
aprRay: bigint;
|
|
16669
|
+
/** Human-readable provider label, e.g. `'Lido (stETH)'` (suffixed with `(fallback)` on error). */
|
|
16670
|
+
label: string;
|
|
16671
|
+
/**
|
|
16672
|
+
* `true` when this value came from the hardcoded `fallbackAprPct` rather than a live
|
|
16673
|
+
* fetch — either because the provider has no live endpoint (`manual`), the network
|
|
16674
|
+
* call failed, or the vault has no LSD source configured. UIs should label the value
|
|
16675
|
+
* as an estimate in this state.
|
|
16676
|
+
*/
|
|
16677
|
+
stale: boolean;
|
|
16678
|
+
};
|
|
16679
|
+
/**
|
|
16680
|
+
* Combined AAVE + LSD APR view — extends {@link LeverageYieldApr} with the LSD staking
|
|
16681
|
+
* yield folded into the supply side. Returned by {@link LeverageYieldService.getEffectiveApr}.
|
|
16682
|
+
*
|
|
16683
|
+
* The `netAprRay` inherited from {@link LeverageYieldApr} is the **AAVE-only** number —
|
|
16684
|
+
* the negative-spread case the SDK historically reported. `effectiveNetAprRay` is the
|
|
16685
|
+
* honest one for LSD-backed strategies because it includes the LSD's native staking yield,
|
|
16686
|
+
* which is the dominant component for these vaults.
|
|
16687
|
+
*/
|
|
16688
|
+
type LeverageYieldEffectiveApr = LeverageYieldApr & {
|
|
16689
|
+
/** LSD staking APR snapshot used to compute the effective rates. */
|
|
16690
|
+
lsdApr: LeverageYieldLsdApr;
|
|
16691
|
+
/** `supplyAprRay + lsdApr.aprRay`, in RAY — the yield the supply side actually earns. */
|
|
16692
|
+
effectiveSupplyAprRay: bigint;
|
|
16693
|
+
/**
|
|
16694
|
+
* `effectiveSupplyAprRay + leverage × (effectiveSupplyAprRay − borrowAprRay)`, in RAY.
|
|
16695
|
+
* The headline number a UI should display.
|
|
16696
|
+
*/
|
|
16697
|
+
effectiveNetAprRay: bigint;
|
|
16698
|
+
};
|
|
16699
|
+
/**
|
|
16700
|
+
* Builds the swap payload for a swap-style leverage-yield deposit — swapping any
|
|
16701
|
+
* solver-supported `inputToken` on `srcChainKey` into the vault's lsoda* share token,
|
|
16702
|
+
* delivered to the user's hub wallet on Sonic. Spread the result into `swaps.swap()`.
|
|
16703
|
+
*/
|
|
16704
|
+
type LeverageYieldSwapDepositParams = {
|
|
16705
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16706
|
+
vault: Address;
|
|
16707
|
+
/** Spoke chain the user holds `inputToken` on and signs from. */
|
|
16708
|
+
srcChainKey: SpokeChainKey;
|
|
16709
|
+
/** User's EOA on `srcChainKey`. */
|
|
16710
|
+
srcAddress: string;
|
|
16711
|
+
/** Spoke-side token the user pays in. */
|
|
16712
|
+
inputToken: string;
|
|
16713
|
+
/** Amount of `inputToken` to swap (input-token decimals). */
|
|
16714
|
+
inputAmount: bigint;
|
|
16715
|
+
/** Minimum acceptable lsoda* output (18 decimals). Slippage already applied. */
|
|
16716
|
+
minOutputAmount: bigint;
|
|
16717
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16718
|
+
deadline?: bigint;
|
|
16719
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16720
|
+
solver?: Address;
|
|
16721
|
+
/**
|
|
16722
|
+
* Partner fee for this deposit, carried on the payload as the swap layer's per-intent
|
|
16723
|
+
* fee override. Defaults to the effective swap fee (`config.swapPartnerFee` = the `swaps`
|
|
16724
|
+
* override if set, else the global `fee`).
|
|
16725
|
+
*/
|
|
16726
|
+
partnerFee?: PartnerFee;
|
|
16727
|
+
};
|
|
16728
|
+
/**
|
|
16729
|
+
* Builds the swap payload for a swap-style leverage-yield withdraw — swapping the vault's
|
|
16730
|
+
* lsoda* shares (held in the user's hub wallet) back into any solver-supported token on
|
|
16731
|
+
* any chain. The payload carries `hubWalletSwap: true`; spread it into `swaps.swap()`,
|
|
16732
|
+
* which authorises the hub wallet via `Connection.sendMessage`.
|
|
16733
|
+
*/
|
|
16734
|
+
type LeverageYieldSwapWithdrawParams = {
|
|
16735
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16736
|
+
vault: Address;
|
|
16737
|
+
/** Spoke chain the user signs the `sendMessage` from (drives hub-wallet derivation). */
|
|
16738
|
+
srcChainKey: SpokeChainKey;
|
|
16739
|
+
/** User's EOA on `srcChainKey`. */
|
|
16740
|
+
srcAddress: string;
|
|
16741
|
+
/** Output chain — where the solver delivers the swapped-back token. */
|
|
16742
|
+
dstChainKey: SpokeChainKey;
|
|
16743
|
+
/** Output spoke-side token address. */
|
|
16744
|
+
outputToken: string;
|
|
16745
|
+
/** Amount of lsoda* shares to swap (18 decimals). */
|
|
16746
|
+
inputAmount: bigint;
|
|
16747
|
+
/** Minimum acceptable output (output-token decimals). Slippage already applied. */
|
|
16748
|
+
minOutputAmount: bigint;
|
|
16749
|
+
/** Recipient on `dstChainKey`. Defaults to `srcAddress`. */
|
|
16750
|
+
recipient?: string;
|
|
16751
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16752
|
+
deadline?: bigint;
|
|
16753
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16754
|
+
solver?: Address;
|
|
16755
|
+
};
|
|
16756
|
+
/**
|
|
16757
|
+
* Action-shaped swap payload built by {@link LeverageYieldService.deposit} /
|
|
16758
|
+
* {@link LeverageYieldService.withdraw}. Spread it into
|
|
16759
|
+
* {@link LeverageYieldService.vaultSwap} (or {@link LeverageYieldService.createVaultIntent})
|
|
16760
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16761
|
+
* `withdraw` sets `hubWalletSwap: true` so the swap spends the lsoda* held in the
|
|
16762
|
+
* user's hub wallet.
|
|
16763
|
+
*/
|
|
16764
|
+
type LeverageYieldSwapPayload = {
|
|
16765
|
+
params: CreateIntentParams;
|
|
16766
|
+
hubWalletSwap?: true;
|
|
16767
|
+
/** Per-intent partner-fee override (deposit only). */
|
|
16768
|
+
partnerFee?: PartnerFee;
|
|
16769
|
+
};
|
|
16770
|
+
/**
|
|
16771
|
+
* Exec-mode params for {@link LeverageYieldService.createVaultIntent} /
|
|
16772
|
+
* {@link LeverageYieldService.vaultSwap}: `walletProvider` is required and K-narrowed
|
|
16773
|
+
* (`raw: true` returns unsigned tx data instead). The two vault-specific execution
|
|
16774
|
+
* modifiers live HERE — on the leverage-yield action wrapper, never on the generic swap
|
|
16775
|
+
* surface:
|
|
16776
|
+
* - `hubWalletSwap` marks `params.inputToken` as a hub-chain token already sitting in the
|
|
16777
|
+
* user's hub wallet — `srcChainKey` is then the chain the user *signs* on, and the
|
|
16778
|
+
* intent is created by authorising the hub wallet via a `Connection.sendMessage`
|
|
16779
|
+
* instead of a spoke-side AssetManager deposit.
|
|
16780
|
+
* - `partnerFee` overrides the effective swap fee (`config.swapPartnerFee`) for this
|
|
16781
|
+
* intent only.
|
|
16782
|
+
*/
|
|
16783
|
+
type VaultSwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>> & {
|
|
16784
|
+
hubWalletSwap?: boolean;
|
|
16785
|
+
partnerFee?: PartnerFee;
|
|
16786
|
+
};
|
|
16787
|
+
/**
|
|
16788
|
+
* Success value of {@link LeverageYieldService.createVaultIntent}. Mirrors the swap
|
|
16789
|
+
* domain's `CreateIntentResult` — duplicated deliberately so the leverage-yield surface
|
|
16790
|
+
* stands alone.
|
|
16791
|
+
*/
|
|
16792
|
+
type CreateVaultIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
16793
|
+
tx: TxReturnType<K, Raw>;
|
|
16794
|
+
intent: Intent & FeeAmount;
|
|
16795
|
+
relayData: RelayExtraData;
|
|
16796
|
+
};
|
|
16797
|
+
/**
|
|
16798
|
+
* Success value of {@link LeverageYieldService.vaultSwap}. Mirrors the swap domain's
|
|
16799
|
+
* `SwapResponse` — duplicated deliberately so the leverage-yield surface stands alone.
|
|
16800
|
+
*/
|
|
16801
|
+
type VaultSwapResponse = {
|
|
16802
|
+
solverExecutionResponse: SolverExecutionResponse;
|
|
16803
|
+
intent: Intent;
|
|
16804
|
+
intentDeliveryInfo: IntentDeliveryInfo;
|
|
16805
|
+
};
|
|
16806
|
+
type LeverageYieldApproveParams<R extends boolean> = {
|
|
16807
|
+
vault: Address;
|
|
16808
|
+
/** Amount of the vault's underlying asset to approve. */
|
|
16809
|
+
amount: bigint;
|
|
16810
|
+
walletProvider: IEvmWalletProvider;
|
|
16811
|
+
raw?: R;
|
|
16812
|
+
};
|
|
16813
|
+
type LeverageYieldAllowanceParams = {
|
|
16814
|
+
vault: Address;
|
|
16815
|
+
amount: bigint;
|
|
16816
|
+
owner: Address;
|
|
16817
|
+
};
|
|
16818
|
+
type LeverageYieldServiceConstructorParams = {
|
|
16819
|
+
hubProvider: HubProvider;
|
|
16820
|
+
config: ConfigService;
|
|
16821
|
+
spoke: SpokeService;
|
|
16822
|
+
};
|
|
16823
|
+
/**
|
|
16824
|
+
* Treats leverage-yield ERC-4626 vault shares (lsoda* tokens) as solver-tradeable tokens:
|
|
16825
|
+
* deposits and withdrawals are intent-based swaps the service executes itself via
|
|
16826
|
+
* `vaultSwap()` — the generic swap surface stays untouched by vault concerns.
|
|
16827
|
+
*
|
|
16828
|
+
* Methods:
|
|
16829
|
+
* - `deposit` / `withdraw` — build a {@link LeverageYieldSwapPayload} for a swap-style deposit
|
|
16830
|
+
* (any token → lsoda*) and withdraw (lsoda* → any token); spread the result into
|
|
16831
|
+
* `vaultSwap()`. `withdraw` sets `hubWalletSwap: true` so the vault swap spends the lsoda*
|
|
16832
|
+
* held in the user's hub wallet via a `Connection.sendMessage`.
|
|
16833
|
+
* - `createVaultIntent` / `vaultSwap` / `notifySolver` — leverage-yield copies of the swap
|
|
16834
|
+
* domain's `createIntent` / `swap()` / `postExecution` (duplicated deliberately — the vault
|
|
16835
|
+
* execution modifiers `hubWalletSwap` and per-intent `partnerFee` live here, not on the swap
|
|
16836
|
+
* domain). `createVaultIntent` submits the intent tx on the source spoke chain; `vaultSwap`
|
|
16837
|
+
* orchestrates the full create → verify → relay → notify-solver lifecycle; `notifySolver` is
|
|
16838
|
+
* the standalone notify step, public so callers driving the relay themselves (after a
|
|
16839
|
+
* `createVaultIntent`) can complete the flow.
|
|
16840
|
+
* - `approve` / `isAllowanceValid` — Sonic-direct allowance management for the vault's
|
|
16841
|
+
* underlying asset (sodaWEETH-style).
|
|
16842
|
+
* - `getPosition` / `getApr` / `getEffectiveApr` / `getLsdApr` / `getMaxWithdraw` /
|
|
16843
|
+
* `getMaxWithdrawForUser` / `getShareBalance` / `getShareBalanceForUser` /
|
|
16844
|
+
* `getTotalAssets` / `previewDeposit` / `previewWithdraw` / `previewRedeem` — reads.
|
|
16845
|
+
* Use `getEffectiveApr` for the honest LSD-aware APR; `getApr` reports the AAVE-only
|
|
16846
|
+
* spread and goes negative when the LSD's native staking yield is the alpha source.
|
|
16847
|
+
* - `listVaults` / `getVault` / `getVaultByAddress` — registry lookups.
|
|
16848
|
+
*/
|
|
16849
|
+
declare class LeverageYieldService {
|
|
16850
|
+
private readonly hubProvider;
|
|
16851
|
+
private readonly config;
|
|
16852
|
+
private readonly spoke;
|
|
16853
|
+
constructor({ hubProvider, config, spoke }: LeverageYieldServiceConstructorParams);
|
|
16854
|
+
/** Returns the static registry of known leverage-yield vaults. */
|
|
16855
|
+
listVaults(): readonly LeverageYieldVault[];
|
|
16856
|
+
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
16857
|
+
getVault(name: string): LeverageYieldVault | undefined;
|
|
16858
|
+
/**
|
|
16859
|
+
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
16860
|
+
* Returns `undefined` when the address isn't in the registry.
|
|
16861
|
+
*/
|
|
16862
|
+
getVaultByAddress(address: Address): LeverageYieldVault | undefined;
|
|
16863
|
+
/**
|
|
16864
|
+
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
16865
|
+
* derives a default from the hub-chain (Sonic) block timestamp plus
|
|
16866
|
+
* {@link INTENT_DEADLINE_BUFFER_SECONDS}. The deadline is enforced on-chain against the hub
|
|
16867
|
+
* block time, so the default is anchored to that block — never the client clock, which can
|
|
16868
|
+
* drift and produce an already-expired or over-extended deadline.
|
|
16869
|
+
*
|
|
16870
|
+
* Returns a {@link Result}: a `getBlock` RPC outage is a read failure, surfaced as
|
|
16871
|
+
* `LOOKUP_FAILED` (`method: 'resolveDeadline'`) rather than masquerading as an intent-build
|
|
16872
|
+
* failure. The `deposit` / `withdraw` callers forward it verbatim.
|
|
16873
|
+
*/
|
|
16874
|
+
private resolveDeadline;
|
|
16875
|
+
/**
|
|
16876
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield deposit (any token → lsoda*).
|
|
16877
|
+
* The lsoda* output is delivered to the user's hub wallet on Sonic so a later
|
|
16878
|
+
* {@link LeverageYieldService.withdraw} can swap it back. Spread the result into
|
|
16879
|
+
* {@link LeverageYieldService.vaultSwap}: `vaultSwap({ ...payload, walletProvider })`.
|
|
16880
|
+
* An optional `partnerFee` is forwarded on the payload as the per-intent fee override.
|
|
16881
|
+
*
|
|
16882
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16883
|
+
* destination token (`token_dst`) — vault shares are solver-tradeable, so the generic swap
|
|
16884
|
+
* quote applies; then subtract your slippage tolerance.
|
|
16885
|
+
*/
|
|
16886
|
+
deposit(params: LeverageYieldSwapDepositParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16887
|
+
/**
|
|
16888
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield withdraw (lsoda* → any
|
|
16889
|
+
* token). The payload carries `hubWalletSwap: true` — {@link LeverageYieldService.vaultSwap}
|
|
16890
|
+
* then spends the lsoda* held in the user's hub wallet by authorising it via a
|
|
16891
|
+
* `Connection.sendMessage` the user signs on `srcChainKey`. Wrapped in a {@link Result} for
|
|
16892
|
+
* a call shape uniform with {@link LeverageYieldService.deposit}; async because the default
|
|
16893
|
+
* `deadline` is read from the hub block timestamp.
|
|
16894
|
+
*
|
|
16895
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16896
|
+
* source token (`token_src`) — vault shares are solver-tradeable, so the generic swap quote
|
|
16897
|
+
* applies; then subtract your slippage tolerance.
|
|
16898
|
+
*/
|
|
16899
|
+
withdraw(params: LeverageYieldSwapWithdrawParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16900
|
+
/**
|
|
16901
|
+
* Creates a vault swap intent on the user's source spoke chain without submitting it to
|
|
16902
|
+
* the solver. Leverage-yield copy of the swap domain's `createIntent`, specialised for
|
|
16903
|
+
* vault flows — duplicated deliberately so the vault-specific execution modifiers
|
|
16904
|
+
* (`hubWalletSwap`, per-intent `partnerFee`) stay off the generic swap surface.
|
|
16905
|
+
*
|
|
16906
|
+
* Use {@link LeverageYieldService.vaultSwap} for the full end-to-end flow
|
|
16907
|
+
* (create → relay → notify solver); use this directly when you need the raw transaction
|
|
16908
|
+
* or drive the relay yourself (e.g. the backend submit-tx path). To complete a manual flow,
|
|
16909
|
+
* relay the returned `relayData` (the shared `relayTxAndWaitPacket` helper) and then call
|
|
16910
|
+
* {@link LeverageYieldService.notifySolver} with the hub-side intent tx hash.
|
|
16911
|
+
*
|
|
16912
|
+
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
16913
|
+
* and optional `skipSimulation` / `hubWalletSwap` / `partnerFee`.
|
|
16914
|
+
* @returns A `Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>`.
|
|
16915
|
+
* On success contains:
|
|
16916
|
+
* - `tx` — chain-specific tx hash (executed) or raw tx data (raw mode).
|
|
16917
|
+
* - `intent` — the fully constructed `Intent` object augmented with `feeAmount`.
|
|
16918
|
+
* - `relayData` — `{ address, payload }` needed to submit the intent to the relayer.
|
|
16919
|
+
*
|
|
16920
|
+
* On failure `result.error` is a SodaxError with `VALIDATION_FAILED` (invariant
|
|
16921
|
+
* precondition), `INTENT_CREATION_FAILED` (spoke-side creation/deposit failed) or
|
|
16922
|
+
* `UNKNOWN` (defensive fallback).
|
|
16923
|
+
*/
|
|
16924
|
+
createVaultIntent<K extends SpokeChainKey, Raw extends boolean>(_params: VaultSwapActionParams<K, Raw>): Promise<Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>>;
|
|
16925
|
+
/**
|
|
16926
|
+
* Executes a full end-to-end leverage-yield vault swap (deposit or withdraw).
|
|
16927
|
+
* Leverage-yield copy of the swap domain's `swap()` orchestrator:
|
|
16928
|
+
* 1. Calls {@link LeverageYieldService.createVaultIntent} to submit the intent
|
|
16929
|
+
* transaction on the source spoke chain.
|
|
16930
|
+
* 2. Verifies the spoke transaction landed on-chain.
|
|
16931
|
+
* 3. For non-hub source chains: submits the spoke tx to the relayer and waits for the
|
|
16932
|
+
* relay packet to land on the hub (Sonic). Skipped when `srcChainKey` is the hub.
|
|
16933
|
+
* 4. Notifies the solver, triggering it to fill the intent.
|
|
16934
|
+
*
|
|
16935
|
+
* Spread a {@link LeverageYieldSwapPayload} from `deposit` / `withdraw` into this method
|
|
16936
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16937
|
+
*
|
|
16938
|
+
* @returns A `Result<VaultSwapResponse, LeverageYieldSwapError>`. On success:
|
|
16939
|
+
* - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
|
|
16940
|
+
* - `intent` — the on-chain intent object that was created.
|
|
16941
|
+
* - `intentDeliveryInfo` — source/destination chain keys, tx hashes, and user addresses.
|
|
16942
|
+
*
|
|
16943
|
+
* On failure `result.error` carries one of the create-intent codes plus
|
|
16944
|
+
* `TX_VERIFICATION_FAILED`, `TX_SUBMIT_FAILED`, `RELAY_TIMEOUT`, `RELAY_FAILED`,
|
|
16945
|
+
* `EXECUTION_FAILED`, `EXTERNAL_API_ERROR` or `UNKNOWN`.
|
|
16946
|
+
*/
|
|
16947
|
+
vaultSwap<K extends SpokeChainKey>(_params: VaultSwapActionParams<K, false>): Promise<Result<VaultSwapResponse, LeverageYieldSwapError>>;
|
|
16948
|
+
/**
|
|
16949
|
+
* Notifies the solver that the vault intent landed on the hub, triggering it to fill.
|
|
16950
|
+
* Leverage-yield copy of the swap domain's `postExecution` — emits only
|
|
16951
|
+
* `EXECUTION_FAILED` / `EXTERNAL_API_ERROR` / `UNKNOWN` (relay/verify codes appear only
|
|
16952
|
+
* on {@link LeverageYieldService.vaultSwap}, which owns the verify + relay steps).
|
|
16953
|
+
*
|
|
16954
|
+
* Called automatically by {@link LeverageYieldService.vaultSwap} after the relay packet
|
|
16955
|
+
* lands on the hub. Public so callers who created the intent via
|
|
16956
|
+
* {@link LeverageYieldService.createVaultIntent} and relayed it themselves can finish the
|
|
16957
|
+
* flow manually.
|
|
16958
|
+
*
|
|
16959
|
+
* @param request - `{ intent_tx_hash }` — the hub-chain (Sonic) tx hash where the intent
|
|
16960
|
+
* was registered (the relay packet's `dst_tx_hash`, or the spoke tx hash for hub-sourced
|
|
16961
|
+
* intents).
|
|
16962
|
+
*/
|
|
16963
|
+
notifySolver(request: SolverExecutionRequest): Promise<Result<SolverExecutionResponse, LeverageYieldPostExecutionError>>;
|
|
16964
|
+
/**
|
|
16965
|
+
* Approves the vault's underlying asset to the leverage vault on Sonic. For callers
|
|
16966
|
+
* interacting with the vault directly on the hub — the swap-style {@link
|
|
16967
|
+
* LeverageYieldService.deposit} flow handles its own approvals.
|
|
16968
|
+
*/
|
|
16969
|
+
approve<R extends boolean = false>(params: LeverageYieldApproveParams<R>): Promise<Result<TxReturnType<HubChainKey, R>, LeverageYieldApproveError>>;
|
|
16970
|
+
/**
|
|
16971
|
+
* Reads on-chain allowance of the vault's underlying asset for `owner → vault`. Returns
|
|
16972
|
+
* `true` when the allowance covers `amount`. Use before a direct
|
|
16973
|
+
* {@link LeverageYieldService.deposit}.
|
|
16974
|
+
*/
|
|
16975
|
+
isAllowanceValid(params: LeverageYieldAllowanceParams): Promise<Result<boolean, LeverageYieldAllowanceCheckError>>;
|
|
16976
|
+
/** ERC-4626 `asset()` of the vault — the sodaWEETH-style underlying. */
|
|
16977
|
+
getAsset(vault: Address): Promise<Result<Address, LeverageYieldLookupError>>;
|
|
16978
|
+
/** Reads the vault's leveraged position snapshot via the non-standard `getPositionDetails`. */
|
|
16979
|
+
getPosition(vault: Address): Promise<Result<LeverageYieldPosition, LeverageYieldLookupError>>;
|
|
16980
|
+
/**
|
|
16981
|
+
* Computes the steady-state APR of a leverage-yield vault from the AAVE supply/borrow
|
|
16982
|
+
* rates of its asset and borrowToken, scaled by the vault's target leverage. Matches the
|
|
16983
|
+
* convention used by leveraged-LSD vaults (Origami, Gearbox, etc.) — assumes constant
|
|
16984
|
+
* LTV at `targetLTV` and constant AAVE rates.
|
|
16985
|
+
*
|
|
16986
|
+
* Returns raw fields in RAY (1e27, AAVE's native rate scale) plus the leverage multiplier
|
|
16987
|
+
* in WAD (1e18). See {@link LeverageYieldApr} for the formula and caveats.
|
|
16988
|
+
*/
|
|
16989
|
+
getApr(vault: Address): Promise<Result<LeverageYieldApr, LeverageYieldLookupError>>;
|
|
16990
|
+
/**
|
|
16991
|
+
* Off-chain LSD staking-APR for the vault's underlying asset. Looks the vault up in the
|
|
16992
|
+
* registry, hits DefiLlama's per-pool chart endpoint for the configured `poolId`, and on
|
|
16993
|
+
* any fetch failure returns the registry's hardcoded `fallbackAprPct` with `stale: true`.
|
|
16994
|
+
*
|
|
16995
|
+
* Always resolves to `{ ok: true, ... }` for a known vault — the fallback path replaces
|
|
16996
|
+
* the error, since a missing LSD APR shouldn't break the parent call. Returns
|
|
16997
|
+
* `{ aprRay: 0n, stale: true, label: 'no LSD source' }` for vaults without an
|
|
16998
|
+
* `lsdSource` configured (non-LSD strategies); callers can treat that as "skip LSD".
|
|
16999
|
+
*/
|
|
17000
|
+
getLsdApr(vault: Address): Promise<Result<LeverageYieldLsdApr, LeverageYieldLookupError>>;
|
|
17001
|
+
/**
|
|
17002
|
+
* Combined view of {@link getApr} + {@link getLsdApr}: re-applies the vault's leverage
|
|
17003
|
+
* formula with the LSD's native staking yield folded into the supply side, exposing the
|
|
17004
|
+
* **effective** net APR that LSD-backed strategies actually earn. The AAVE-only
|
|
17005
|
+
* `netAprRay` is preserved on the return value for callers who want to display both.
|
|
17006
|
+
*
|
|
17007
|
+
* effectiveSupply = supplyAprRay + lsdApr.aprRay
|
|
17008
|
+
* effectiveNet = effectiveSupply + leverage × (effectiveSupply − borrowAprRay)
|
|
17009
|
+
*
|
|
17010
|
+
* Fetches AAVE rates and the LSD APR in parallel for one round-trip's worth of latency.
|
|
17011
|
+
*/
|
|
17012
|
+
getEffectiveApr(vault: Address): Promise<Result<LeverageYieldEffectiveApr, LeverageYieldLookupError>>;
|
|
17013
|
+
/** Synchronously withdrawable assets for `owner` (clamped against leverage HF floor). */
|
|
17014
|
+
getMaxWithdraw(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17015
|
+
/** Total underlying assets currently held by the vault (vault-asset units, 18 decimals) — TVL. */
|
|
17016
|
+
getTotalAssets(vault: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17017
|
+
/** Shares minted for a given asset deposit. */
|
|
17018
|
+
previewDeposit(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17019
|
+
/** Shares burned for a given asset withdrawal. */
|
|
17020
|
+
previewWithdraw(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17021
|
+
/** Assets received for a given share redemption. */
|
|
17022
|
+
previewRedeem(vault: Address, shares: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17023
|
+
/** Vault shares held by `owner`. */
|
|
17024
|
+
getShareBalance(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17025
|
+
/**
|
|
17026
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
17027
|
+
* returns its on-chain `maxWithdraw`, less {@link MAX_WITHDRAW_DUST_BUFFER}. The trim
|
|
17028
|
+
* keeps the value safe for an asset-denominated ERC-4626 `withdraw` — the raw
|
|
17029
|
+
* `maxWithdraw` can trip the round-up that asks for one more share than the user holds.
|
|
17030
|
+
*/
|
|
17031
|
+
getMaxWithdrawForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17032
|
+
/**
|
|
17033
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
17034
|
+
* returns its on-chain share balance.
|
|
17035
|
+
*/
|
|
17036
|
+
getShareBalanceForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17037
|
+
}
|
|
17038
|
+
|
|
15848
17039
|
/**
|
|
15849
17040
|
* Sodax class is used to interact with the Sodax.
|
|
15850
17041
|
*
|
|
@@ -15856,15 +17047,17 @@ declare class Sodax {
|
|
|
15856
17047
|
readonly moneyMarket: MoneyMarketService;
|
|
15857
17048
|
readonly migration: MigrationService;
|
|
15858
17049
|
readonly backendApi: BackendApiService;
|
|
17050
|
+
readonly api: BackendApiService;
|
|
15859
17051
|
readonly bridge: BridgeService;
|
|
15860
17052
|
readonly staking: StakingService;
|
|
15861
17053
|
readonly partners: PartnerService;
|
|
15862
17054
|
readonly recovery: RecoveryService;
|
|
15863
17055
|
readonly dex: DexService;
|
|
17056
|
+
readonly leverageYield: LeverageYieldService;
|
|
15864
17057
|
readonly config: ConfigService;
|
|
15865
17058
|
readonly hubProvider: HubProvider;
|
|
15866
17059
|
readonly spoke: SpokeService;
|
|
15867
|
-
constructor(
|
|
17060
|
+
constructor(options?: SodaxOptions);
|
|
15868
17061
|
/**
|
|
15869
17062
|
* Initializes the Sodax instance with dynamic configuration.
|
|
15870
17063
|
* You should use this option if you do not want to update package versions when new chains and tokens are added.
|
|
@@ -16049,6 +17242,40 @@ declare class EvmSolverService {
|
|
|
16049
17242
|
* @throws Invariant error if `inputAmount` is `0n` or if the fee percentage is out of range.
|
|
16050
17243
|
*/
|
|
16051
17244
|
static createIntentFeeData(fee: PartnerFee | undefined, inputAmount: bigint): [Hex, bigint];
|
|
17245
|
+
/**
|
|
17246
|
+
* Recovers the partner fee amount embedded in an intent's `data` field.
|
|
17247
|
+
*
|
|
17248
|
+
* Inverse of {@link createIntentFeeData}: returns the encoded fee, regardless of whether the `data`
|
|
17249
|
+
* is a bare fee envelope or a multi-entry envelope that also carries delivery data. The envelope
|
|
17250
|
+
* parsing lives in {@link IntentDataService.extractFeePayload}; this method just decodes the fee struct.
|
|
17251
|
+
*
|
|
17252
|
+
* @param data - The intent's `data` field (`'0x'` when no fee was configured).
|
|
17253
|
+
* @returns The fee amount in the input token's smallest unit (`0n` when no fee is present).
|
|
17254
|
+
*/
|
|
17255
|
+
static decodeIntentFeeAmount(data: Hex): bigint;
|
|
17256
|
+
/** Decodes a raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) to its fee amount. */
|
|
17257
|
+
private static decodeFeePayload;
|
|
17258
|
+
/**
|
|
17259
|
+
* Re-derives the byte-identical relay payload that `createIntent` originally produced, from a
|
|
17260
|
+
* fully-populated `Intent` alone.
|
|
17261
|
+
*
|
|
17262
|
+
* Mirrors the two payload shapes built at intent-creation time:
|
|
17263
|
+
* - Hub (Sonic) source — raw `createIntent(intent)` calldata (no approval, no multicall), matching
|
|
17264
|
+
* {@link SonicSpokeService.createSwapIntent}.
|
|
17265
|
+
* - Spoke source — the `[approve(intentsContract, gross), createIntent(intent)]` multicall, matching
|
|
17266
|
+
* {@link constructCreateIntentData}. The gross approval amount is recovered as
|
|
17267
|
+
* `intent.inputAmount + feeAmount`, where `feeAmount` comes from {@link decodeIntentFeeAmount}.
|
|
17268
|
+
*
|
|
17269
|
+
* Byte-identity holds because this reuses the exact encode primitives (`encodeCreateIntent`,
|
|
17270
|
+
* `Erc20Service.encodeApprove`, `encodeContractCalls`) that produced the original — the only
|
|
17271
|
+
* originally-random input, `intentId`, is already carried on the `Intent`.
|
|
17272
|
+
*
|
|
17273
|
+
* @param intent - The fully-populated intent (e.g. from `createIntent` or `getIntent`).
|
|
17274
|
+
* @param intentsContract - The hub-chain intents contract address (`config.solver.intentsContract`).
|
|
17275
|
+
* @param isHubSource - `true` when the intent's source chain is the hub (Sonic).
|
|
17276
|
+
* @returns The byte-identical relay payload `Hex`.
|
|
17277
|
+
*/
|
|
17278
|
+
static reconstructCreateIntentData(intent: Intent, intentsContract: Address$1, isHubSource: boolean): Hex;
|
|
16052
17279
|
/**
|
|
16053
17280
|
* Reads an `Intent` struct from a hub-chain transaction receipt.
|
|
16054
17281
|
*
|
|
@@ -16063,7 +17290,7 @@ declare class EvmSolverService {
|
|
|
16063
17290
|
* @throws If the transaction contains no matching `IntentCreated` event, or if the
|
|
16064
17291
|
* intent's chain IDs are not recognized.
|
|
16065
17292
|
*/
|
|
16066
|
-
static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient
|
|
17293
|
+
static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient): Promise<Intent>;
|
|
16067
17294
|
/**
|
|
16068
17295
|
* Reads an `IntentState` struct from a hub-chain fill transaction receipt.
|
|
16069
17296
|
*
|
|
@@ -16076,7 +17303,7 @@ declare class EvmSolverService {
|
|
|
16076
17303
|
* @returns `IntentState`: `{ exists, remainingInput, receivedOutput, pendingPayment }`.
|
|
16077
17304
|
* @throws If the transaction contains no matching `IntentFilled` event.
|
|
16078
17305
|
*/
|
|
16079
|
-
static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient
|
|
17306
|
+
static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient): Promise<IntentState>;
|
|
16080
17307
|
/**
|
|
16081
17308
|
* Computes the keccak256 hash of an intent struct, which serves as its unique ID on the hub chain.
|
|
16082
17309
|
*
|
|
@@ -16105,6 +17332,89 @@ declare class EvmSolverService {
|
|
|
16105
17332
|
static encodeCancelIntent(intent: Intent, intentsContract: Address$1): EvmContractCall;
|
|
16106
17333
|
}
|
|
16107
17334
|
|
|
17335
|
+
/**
|
|
17336
|
+
* Stateless utility for the SODAX solver's delivery hooks.
|
|
17337
|
+
*
|
|
17338
|
+
* A delivery hook lets an intent's output be handed to `ISpokeReceiver(dstAddress).hook(...)` on the
|
|
17339
|
+
* destination spoke instead of transferred straight to the recipient. Each hook is two coupled things:
|
|
17340
|
+
* its **deployed address** (the registry in `@sodax/types`) and its **`deliveryData` codec** (here).
|
|
17341
|
+
* This class fuses them so the address and payload can never drift, and exposes a single
|
|
17342
|
+
* type-differentiated {@link encodeDeliveryData} rather than one encoder per hook.
|
|
17343
|
+
*/
|
|
17344
|
+
declare class HookService {
|
|
17345
|
+
private constructor();
|
|
17346
|
+
/**
|
|
17347
|
+
* Encodes a hook's `deliveryData` payload. One common entry point for all hooks — the encoding is
|
|
17348
|
+
* selected by {@link HookRequest.kind} and uses that hook's schema from {@link HOOK_DELIVERY_ABI}.
|
|
17349
|
+
*
|
|
17350
|
+
* @param request - The hook selection (and any hook-specific params).
|
|
17351
|
+
* @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
|
|
17352
|
+
*/
|
|
17353
|
+
static encodeDeliveryData(request: HookRequest, recipient: string): Hex;
|
|
17354
|
+
/**
|
|
17355
|
+
* Resolves a high-level {@link HookRequest} to the on-chain delivery pair: the deployed hook address
|
|
17356
|
+
* (becomes the intent's `dstAddress`) and the encoded payload the hook expects (`deliveryData`).
|
|
17357
|
+
* Bundling lookup + codec here guarantees the address and its payload schema can never drift.
|
|
17358
|
+
*
|
|
17359
|
+
* @param chainKey - Destination spoke chain (must have the requested hook deployed).
|
|
17360
|
+
* @param request - The hook selection (and any hook-specific params).
|
|
17361
|
+
* @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
|
|
17362
|
+
*/
|
|
17363
|
+
static resolveDeliveryHook(chainKey: SpokeChainKey, request: HookRequest, recipient: string): {
|
|
17364
|
+
dstAddress: Address$1;
|
|
17365
|
+
deliveryData: Hex;
|
|
17366
|
+
};
|
|
17367
|
+
/**
|
|
17368
|
+
* Resolves the effective delivery target for an intent. When {@link CreateIntentParams.hook} is set,
|
|
17369
|
+
* routes the output through that registered hook (overriding `dstAddress` and deriving `deliveryData`);
|
|
17370
|
+
* otherwise returns the caller's `dstAddress` and low-level `deliveryData` unchanged. Centralised so
|
|
17371
|
+
* both the hub and Sonic intent constructors apply hooks identically.
|
|
17372
|
+
*
|
|
17373
|
+
* @returns `{ dstAddress, deliveryData }` — the address to deliver to and the payload to forward.
|
|
17374
|
+
*/
|
|
17375
|
+
static resolveDelivery(params: CreateIntentParams): {
|
|
17376
|
+
dstAddress: string;
|
|
17377
|
+
deliveryData: Hex | undefined;
|
|
17378
|
+
};
|
|
17379
|
+
}
|
|
17380
|
+
|
|
17381
|
+
/**
|
|
17382
|
+
* Stateless utility for the `Intent.data` envelope layer.
|
|
17383
|
+
*
|
|
17384
|
+
* `Intent.data` carries zero or more typed entries (a partner-fee payload, a delivery payload, …).
|
|
17385
|
+
* This class owns how those entries are packed into bytes the on-chain `IntentDataLib` decodes and
|
|
17386
|
+
* how they are recovered back out, keeping the `ArrayData` codec ({@link ARRAY_DATA_ABI}) in one
|
|
17387
|
+
* place. The delivery payloads themselves are produced by `HookService`; this layer is agnostic to
|
|
17388
|
+
* their contents and simply folds them in alongside the fee.
|
|
17389
|
+
*/
|
|
17390
|
+
declare class IntentDataService {
|
|
17391
|
+
private constructor();
|
|
17392
|
+
/**
|
|
17393
|
+
* Folds a partner-fee envelope and an optional delivery payload into the final `Intent.data`:
|
|
17394
|
+
* - Neither → `'0x'`.
|
|
17395
|
+
* - Exactly one → that single packed `[uint8 type, bytes payload]` envelope (byte-identical to a
|
|
17396
|
+
* bare fee envelope, so a fee-only intent's `data` is unchanged and stays decode-stable).
|
|
17397
|
+
* - Both → a `TYPE_ARRAY` envelope wrapping `[FEE, DELIVERY]` entries.
|
|
17398
|
+
*
|
|
17399
|
+
* @param feeEnvelope - The packed fee envelope from `EvmSolverService.createIntentFeeData` (`'0x'` if no fee).
|
|
17400
|
+
* @param deliveryData - Opaque delivery payload (e.g. from `HookService.encodeDeliveryData`), or `undefined`.
|
|
17401
|
+
*/
|
|
17402
|
+
static composeIntentData(feeEnvelope: Hex, deliveryData?: Hex): Hex;
|
|
17403
|
+
/**
|
|
17404
|
+
* Encodes a list of typed `IntentData` entries into the `Intent.data` bytes the contract decodes.
|
|
17405
|
+
* Empty → `'0x'`; single → a packed `[uint8 type, bytes payload]` envelope; multiple → a `TYPE_ARRAY`
|
|
17406
|
+
* envelope wrapping the entries as `ArrayData { DataEntry[] }`.
|
|
17407
|
+
*/
|
|
17408
|
+
static encodeIntentData(entries: IntentData[]): Hex;
|
|
17409
|
+
/**
|
|
17410
|
+
* Extracts the raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) from an intent's
|
|
17411
|
+
* `data`, unwrapping whichever envelope shape it uses. Returns `undefined` when there is no fee:
|
|
17412
|
+
* empty `data`, a delivery-only envelope, or an unknown type byte (logged). Used by
|
|
17413
|
+
* `EvmSolverService.decodeIntentFeeAmount` to recover fees regardless of delivery data.
|
|
17414
|
+
*/
|
|
17415
|
+
static extractFeePayload(data: Hex): Hex | undefined;
|
|
17416
|
+
}
|
|
17417
|
+
|
|
16108
17418
|
/**
|
|
16109
17419
|
* Stateless HTTP client for the SODAX solver API.
|
|
16110
17420
|
*
|
|
@@ -16145,7 +17455,7 @@ declare class SolverApiService {
|
|
|
16145
17455
|
* @param config - Solver endpoint configuration.
|
|
16146
17456
|
* @returns A `Result` containing `{ answer: 'OK', intent_hash: Hex }` on success.
|
|
16147
17457
|
*/
|
|
16148
|
-
static postExecution(request: SolverExecutionRequest, config: SolverConfig): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
17458
|
+
static postExecution(request: SolverExecutionRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
16149
17459
|
/**
|
|
16150
17460
|
* Polls the solver API for the current execution status of an intent (`POST /status`).
|
|
16151
17461
|
*
|
|
@@ -16155,7 +17465,7 @@ declare class SolverApiService {
|
|
|
16155
17465
|
* `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
16156
17466
|
* @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
|
|
16157
17467
|
*/
|
|
16158
|
-
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
17468
|
+
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
16159
17469
|
}
|
|
16160
17470
|
|
|
16161
17471
|
/**
|
|
@@ -16178,7 +17488,7 @@ declare class StakingLogic {
|
|
|
16178
17488
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16179
17489
|
* @returns Array of `UserUnstakeInfo` records for all active unstake requests.
|
|
16180
17490
|
*/
|
|
16181
|
-
static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient
|
|
17491
|
+
static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient): Promise<readonly UserUnstakeInfo[]>;
|
|
16182
17492
|
/**
|
|
16183
17493
|
* Encodes the depositFor transaction data.
|
|
16184
17494
|
* @param stakedSoda - The address of the StakedSoda contract.
|
|
@@ -16230,7 +17540,7 @@ declare class StakingLogic {
|
|
|
16230
17540
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16231
17541
|
* @returns Total SODA deposited across all stakers.
|
|
16232
17542
|
*/
|
|
16233
|
-
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient
|
|
17543
|
+
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient): Promise<bigint>;
|
|
16234
17544
|
/**
|
|
16235
17545
|
* Calculates the number of xSoda shares equivalent to a given amount of SODA assets (`convertToShares`).
|
|
16236
17546
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16238,7 +17548,7 @@ declare class StakingLogic {
|
|
|
16238
17548
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16239
17549
|
* @returns The xSoda share count equivalent to `assets` at the current exchange rate.
|
|
16240
17550
|
*/
|
|
16241
|
-
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17551
|
+
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16242
17552
|
/**
|
|
16243
17553
|
* Calculates the SODA asset amount corresponding to a given number of xSoda shares (`convertToAssets`).
|
|
16244
17554
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16246,7 +17556,7 @@ declare class StakingLogic {
|
|
|
16246
17556
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16247
17557
|
* @returns The SODA asset amount equivalent to `shares` at the current exchange rate.
|
|
16248
17558
|
*/
|
|
16249
|
-
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17559
|
+
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16250
17560
|
/**
|
|
16251
17561
|
* Simulates a SODA deposit into the xSoda vault (`previewDeposit`) without executing it.
|
|
16252
17562
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16254,7 +17564,7 @@ declare class StakingLogic {
|
|
|
16254
17564
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16255
17565
|
* @returns The xSoda shares that would be minted for `assets`.
|
|
16256
17566
|
*/
|
|
16257
|
-
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17567
|
+
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16258
17568
|
/**
|
|
16259
17569
|
* Simulates minting a specific number of xSoda shares (`previewMint`) without executing it.
|
|
16260
17570
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16262,7 +17572,7 @@ declare class StakingLogic {
|
|
|
16262
17572
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16263
17573
|
* @returns The SODA assets that would need to be deposited to mint `shares`.
|
|
16264
17574
|
*/
|
|
16265
|
-
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17575
|
+
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16266
17576
|
/**
|
|
16267
17577
|
* Simulates withdrawing a specific SODA amount from the xSoda vault (`previewWithdraw`) without executing it.
|
|
16268
17578
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16270,7 +17580,7 @@ declare class StakingLogic {
|
|
|
16270
17580
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16271
17581
|
* @returns The xSoda shares that would be burned to withdraw `assets`.
|
|
16272
17582
|
*/
|
|
16273
|
-
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17583
|
+
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16274
17584
|
/**
|
|
16275
17585
|
* Simulates redeeming a specific number of xSoda shares (`previewRedeem`) without executing it.
|
|
16276
17586
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16278,7 +17588,7 @@ declare class StakingLogic {
|
|
|
16278
17588
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16279
17589
|
* @returns The SODA assets that would be withdrawn for `shares`.
|
|
16280
17590
|
*/
|
|
16281
|
-
static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17591
|
+
static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16282
17592
|
/**
|
|
16283
17593
|
* Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
|
|
16284
17594
|
* @param xSoda - The address of the xSoda token contract.
|
|
@@ -16344,7 +17654,7 @@ declare class StakingLogic {
|
|
|
16344
17654
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16345
17655
|
* @returns Tuple `[xSodaAmount, previewDepositAmount]` — estimated shares and vault preview figure.
|
|
16346
17656
|
*/
|
|
16347
|
-
static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient
|
|
17657
|
+
static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<readonly [bigint, bigint]>;
|
|
16348
17658
|
/**
|
|
16349
17659
|
* Estimates the SODA output for instantly unstaking a given xSoda amount.
|
|
16350
17660
|
*
|
|
@@ -16357,7 +17667,7 @@ declare class StakingLogic {
|
|
|
16357
17667
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16358
17668
|
* @returns The estimated SODA output for the instant unstake.
|
|
16359
17669
|
*/
|
|
16360
|
-
static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient
|
|
17670
|
+
static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16361
17671
|
}
|
|
16362
17672
|
|
|
16363
17673
|
declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
|
|
@@ -16369,7 +17679,7 @@ declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxC
|
|
|
16369
17679
|
|
|
16370
17680
|
declare const partnerInvariant: FeatureInvariant;
|
|
16371
17681
|
type PartnerAction = 'waitAutoSwap';
|
|
16372
|
-
type PartnerErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
17682
|
+
type PartnerErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
16373
17683
|
type PartnerError = SodaxError<PartnerErrorCode>;
|
|
16374
17684
|
declare const isPartnerError: (e: unknown) => e is SodaxError<PartnerErrorCode>;
|
|
16375
17685
|
|
|
@@ -16387,5 +17697,13 @@ declare const dexInvariant: FeatureInvariant;
|
|
|
16387
17697
|
type DexErrorCode = LookupErrorCode;
|
|
16388
17698
|
type DexError = SodaxError<DexErrorCode>;
|
|
16389
17699
|
declare const isDexError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
17700
|
+
/** Codes any DEX `executeXxx` / intent-creation method can return. */
|
|
17701
|
+
type DexCreateIntentErrorCode = CreateIntentErrorCode;
|
|
17702
|
+
type DexCreateIntentError = SodaxError<DexCreateIntentErrorCode>;
|
|
17703
|
+
declare const isDexCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
|
|
17704
|
+
/** Codes the DEX `approve` method can return. */
|
|
17705
|
+
type DexApproveErrorCode = ApproveErrorCode;
|
|
17706
|
+
type DexApproveError = SodaxError<DexApproveErrorCode>;
|
|
17707
|
+
declare const isDexApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
|
|
16390
17708
|
|
|
16391
|
-
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, type AggregatedReserveData, type AllowanceCheckErrorCode, type AllowanceInfo, type AllowanceResponse, type AllowanceTransferDetails, 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, 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 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 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, 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, 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 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 };
|
|
17709
|
+
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 };
|