@sodax/sdk 2.0.0-rc.9 → 2.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/index.cjs +5676 -1513
- package/dist/index.d.cts +1770 -294
- package/dist/index.d.ts +1770 -294
- package/dist/index.mjs +5625 -1518
- package/package.json +10 -9
package/dist/index.d.ts
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, IStellarSponsoringApi, SponsoringApiConfig, StellarSponsorConfig, StellarSponsoredAccountRequest, StellarSponsoredAccountResponse, 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, SponsoringApiErrorCode } 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.
|
|
@@ -95,6 +97,7 @@ type RelayCode = 'SUBMIT_TX_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_POLLING_FAILED' |
|
|
|
95
97
|
* - `relayCode` — set on errors whose root cause is a relay-layer failure.
|
|
96
98
|
* - `api` — set on `EXTERNAL_API_ERROR`. Identifies the upstream service.
|
|
97
99
|
* - `method` — set on `LOOKUP_FAILED`. Names the read-only method that failed.
|
|
100
|
+
* - `status` / `nextAction` / retry fields — backend failure classification.
|
|
98
101
|
* - `direction` — only set on migration's `migratebnUSD` (forward = legacy → new bnUSD;
|
|
99
102
|
* reverse = new → legacy bnUSD).
|
|
100
103
|
* - `field` / `reason` — set on `VALIDATION_FAILED` to identify which precondition tripped.
|
|
@@ -108,15 +111,20 @@ type SodaxErrorContext = {
|
|
|
108
111
|
srcChainKey?: string;
|
|
109
112
|
dstChainKey?: string;
|
|
110
113
|
relayCode?: RelayCode;
|
|
111
|
-
api?: 'solver' | 'backend';
|
|
114
|
+
api?: 'solver' | 'backend' | 'swaps' | 'sponsoring';
|
|
112
115
|
method?: string;
|
|
116
|
+
status?: number;
|
|
117
|
+
nextAction?: string;
|
|
118
|
+
retryable?: boolean;
|
|
119
|
+
retryAfterSeconds?: number;
|
|
120
|
+
sponsorSequence?: string;
|
|
113
121
|
direction?: 'forward' | 'reverse';
|
|
114
122
|
field?: string;
|
|
115
123
|
reason?: string;
|
|
116
124
|
[key: string]: unknown;
|
|
117
125
|
};
|
|
118
|
-
type CreateIntentErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'UNKNOWN'>;
|
|
119
|
-
type ApproveErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'APPROVE_FAILED' | 'UNKNOWN'>;
|
|
126
|
+
type CreateIntentErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'UNKNOWN'>;
|
|
127
|
+
type ApproveErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'APPROVE_FAILED' | 'UNKNOWN'>;
|
|
120
128
|
type AllowanceCheckErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'UNKNOWN'>;
|
|
121
129
|
type GasEstimationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'GAS_ESTIMATION_FAILED' | 'UNKNOWN'>;
|
|
122
130
|
type LookupErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'UNKNOWN'>;
|
|
@@ -131,9 +139,9 @@ declare const GAS_ESTIMATION_CODES: ReadonlySet<GasEstimationErrorCode>;
|
|
|
131
139
|
/** Codes any read-only lookup method can return. */
|
|
132
140
|
declare const LOOKUP_CODES: ReadonlySet<LookupErrorCode>;
|
|
133
141
|
/** 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"];
|
|
142
|
+
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
143
|
/** Runtime list of all valid feature tags. */
|
|
136
|
-
declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery"];
|
|
144
|
+
declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery", "backend", "sponsoring", "leverageYield"];
|
|
137
145
|
|
|
138
146
|
/**
|
|
139
147
|
* Canonical error type for the SODAX SDK.
|
|
@@ -310,12 +318,22 @@ type Ctx = Partial<SodaxErrorContext>;
|
|
|
310
318
|
declare function lookupFailed(feature: SodaxFeature, method: string, cause: unknown, context?: Ctx): SodaxError<'LOOKUP_FAILED'>;
|
|
311
319
|
/** `TX_VERIFICATION_FAILED` — spoke `verifyTxHash` returned false / threw. */
|
|
312
320
|
declare function verifyFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'TX_VERIFICATION_FAILED'>;
|
|
313
|
-
/**
|
|
314
|
-
|
|
321
|
+
/**
|
|
322
|
+
* `INTENT_CREATION_FAILED` — spoke deposit / sendMessage / intent build failed.
|
|
323
|
+
*
|
|
324
|
+
* Wraps the wallet-sign step. If the cause matches a wallet rejection shape, classifies as
|
|
325
|
+
* `USER_REJECTED` instead so consumers can branch on a single canonical "cancelled" code.
|
|
326
|
+
*/
|
|
327
|
+
declare function intentCreationFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'USER_REJECTED' | 'INTENT_CREATION_FAILED'>;
|
|
315
328
|
/** `EXECUTION_FAILED` — orchestrator-level catch-all. `context.action` discriminates the op. */
|
|
316
329
|
declare function executionFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'EXECUTION_FAILED'>;
|
|
317
|
-
/**
|
|
318
|
-
|
|
330
|
+
/**
|
|
331
|
+
* `APPROVE_FAILED` — token approval call failed.
|
|
332
|
+
*
|
|
333
|
+
* Wraps the wallet-sign step. If the cause matches a wallet rejection shape, classifies as
|
|
334
|
+
* `USER_REJECTED` instead.
|
|
335
|
+
*/
|
|
336
|
+
declare function approveFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'USER_REJECTED' | 'APPROVE_FAILED'>;
|
|
319
337
|
/** `ALLOWANCE_CHECK_FAILED` — reading on-chain allowance failed. */
|
|
320
338
|
declare function allowanceCheckFailed(feature: SodaxFeature, cause: unknown, context?: Ctx): SodaxError<'ALLOWANCE_CHECK_FAILED'>;
|
|
321
339
|
/** `GAS_ESTIMATION_FAILED` — gas estimation call failed. */
|
|
@@ -4851,6 +4869,113 @@ declare const ProtocolIntentsAbi: readonly [{
|
|
|
4851
4869
|
}];
|
|
4852
4870
|
}];
|
|
4853
4871
|
readonly stateMutability: "view";
|
|
4872
|
+
}, {
|
|
4873
|
+
readonly type: "function";
|
|
4874
|
+
readonly name: "cancelIntent";
|
|
4875
|
+
readonly inputs: readonly [{
|
|
4876
|
+
readonly name: "fromToken";
|
|
4877
|
+
readonly type: "address";
|
|
4878
|
+
readonly internalType: "address";
|
|
4879
|
+
}, {
|
|
4880
|
+
readonly name: "toToken";
|
|
4881
|
+
readonly type: "address";
|
|
4882
|
+
readonly internalType: "address";
|
|
4883
|
+
}];
|
|
4884
|
+
readonly outputs: readonly [];
|
|
4885
|
+
readonly stateMutability: "nonpayable";
|
|
4886
|
+
}, {
|
|
4887
|
+
readonly type: "function";
|
|
4888
|
+
readonly name: "getUserIntent";
|
|
4889
|
+
readonly inputs: readonly [{
|
|
4890
|
+
readonly name: "user";
|
|
4891
|
+
readonly type: "address";
|
|
4892
|
+
readonly internalType: "address";
|
|
4893
|
+
}, {
|
|
4894
|
+
readonly name: "fromToken";
|
|
4895
|
+
readonly type: "address";
|
|
4896
|
+
readonly internalType: "address";
|
|
4897
|
+
}, {
|
|
4898
|
+
readonly name: "toToken";
|
|
4899
|
+
readonly type: "address";
|
|
4900
|
+
readonly internalType: "address";
|
|
4901
|
+
}];
|
|
4902
|
+
readonly outputs: readonly [{
|
|
4903
|
+
readonly name: "intentHash";
|
|
4904
|
+
readonly type: "bytes32";
|
|
4905
|
+
readonly internalType: "bytes32";
|
|
4906
|
+
}];
|
|
4907
|
+
readonly stateMutability: "view";
|
|
4908
|
+
}, {
|
|
4909
|
+
readonly type: "function";
|
|
4910
|
+
readonly name: "getIntentDetails";
|
|
4911
|
+
readonly inputs: readonly [{
|
|
4912
|
+
readonly name: "intentHash";
|
|
4913
|
+
readonly type: "bytes32";
|
|
4914
|
+
readonly internalType: "bytes32";
|
|
4915
|
+
}];
|
|
4916
|
+
readonly outputs: readonly [{
|
|
4917
|
+
readonly name: "intent";
|
|
4918
|
+
readonly type: "tuple";
|
|
4919
|
+
readonly internalType: "struct Intents.Intent";
|
|
4920
|
+
readonly components: readonly [{
|
|
4921
|
+
readonly name: "intentId";
|
|
4922
|
+
readonly type: "uint256";
|
|
4923
|
+
readonly internalType: "uint256";
|
|
4924
|
+
}, {
|
|
4925
|
+
readonly name: "creator";
|
|
4926
|
+
readonly type: "address";
|
|
4927
|
+
readonly internalType: "address";
|
|
4928
|
+
}, {
|
|
4929
|
+
readonly name: "inputToken";
|
|
4930
|
+
readonly type: "address";
|
|
4931
|
+
readonly internalType: "address";
|
|
4932
|
+
}, {
|
|
4933
|
+
readonly name: "outputToken";
|
|
4934
|
+
readonly type: "address";
|
|
4935
|
+
readonly internalType: "address";
|
|
4936
|
+
}, {
|
|
4937
|
+
readonly name: "inputAmount";
|
|
4938
|
+
readonly type: "uint256";
|
|
4939
|
+
readonly internalType: "uint256";
|
|
4940
|
+
}, {
|
|
4941
|
+
readonly name: "minOutputAmount";
|
|
4942
|
+
readonly type: "uint256";
|
|
4943
|
+
readonly internalType: "uint256";
|
|
4944
|
+
}, {
|
|
4945
|
+
readonly name: "deadline";
|
|
4946
|
+
readonly type: "uint256";
|
|
4947
|
+
readonly internalType: "uint256";
|
|
4948
|
+
}, {
|
|
4949
|
+
readonly name: "allowPartialFill";
|
|
4950
|
+
readonly type: "bool";
|
|
4951
|
+
readonly internalType: "bool";
|
|
4952
|
+
}, {
|
|
4953
|
+
readonly name: "srcChain";
|
|
4954
|
+
readonly type: "uint256";
|
|
4955
|
+
readonly internalType: "uint256";
|
|
4956
|
+
}, {
|
|
4957
|
+
readonly name: "dstChain";
|
|
4958
|
+
readonly type: "uint256";
|
|
4959
|
+
readonly internalType: "uint256";
|
|
4960
|
+
}, {
|
|
4961
|
+
readonly name: "srcAddress";
|
|
4962
|
+
readonly type: "bytes";
|
|
4963
|
+
readonly internalType: "bytes";
|
|
4964
|
+
}, {
|
|
4965
|
+
readonly name: "dstAddress";
|
|
4966
|
+
readonly type: "bytes";
|
|
4967
|
+
readonly internalType: "bytes";
|
|
4968
|
+
}, {
|
|
4969
|
+
readonly name: "solver";
|
|
4970
|
+
readonly type: "address";
|
|
4971
|
+
readonly internalType: "address";
|
|
4972
|
+
}, {
|
|
4973
|
+
readonly name: "data";
|
|
4974
|
+
readonly type: "bytes";
|
|
4975
|
+
readonly internalType: "bytes";
|
|
4976
|
+
}];
|
|
4977
|
+
}];
|
|
4978
|
+
readonly stateMutability: "view";
|
|
4854
4979
|
}];
|
|
4855
4980
|
|
|
4856
4981
|
declare const sonicWalletFactoryAbi: readonly [{
|
|
@@ -7383,6 +7508,167 @@ type RequestOverrideConfig = {
|
|
|
7383
7508
|
timeout?: number;
|
|
7384
7509
|
headers?: Record<string, string>;
|
|
7385
7510
|
};
|
|
7511
|
+
/**
|
|
7512
|
+
* Non-2xx failure with structured status and body. The legacy
|
|
7513
|
+
* `HTTP_REQUEST_FAILED` message and cause chain are preserved.
|
|
7514
|
+
*/
|
|
7515
|
+
declare class BackendHttpError extends Error {
|
|
7516
|
+
readonly status: number;
|
|
7517
|
+
readonly bodyText: string;
|
|
7518
|
+
/** Parsed JSON, or `undefined` for empty or malformed bodies. */
|
|
7519
|
+
readonly body: unknown;
|
|
7520
|
+
constructor(status: number, bodyText: string);
|
|
7521
|
+
}
|
|
7522
|
+
/** Bundle-safe guard that tolerates duplicate SDK copies. */
|
|
7523
|
+
declare function isBackendHttpError(error: unknown): error is BackendHttpError;
|
|
7524
|
+
|
|
7525
|
+
/**
|
|
7526
|
+
* {@link ISwapsApiV2} with every method's return wrapped in `Result<T>` and an
|
|
7527
|
+
* optional trailing `RequestOverrideConfig`. `SwapsApiService` implements this
|
|
7528
|
+
* (rather than `ISwapsApiV2` directly) because it never throws — like
|
|
7529
|
+
* `BackendApiService`, it returns `{ ok: false }` on failure instead of
|
|
7530
|
+
* `Promise<T>` rejection. The mapped type keeps the class in lockstep with the
|
|
7531
|
+
* canonical interface: every endpoint is covered with its exact payload types.
|
|
7532
|
+
*/
|
|
7533
|
+
type ResultifiedSwapsApiV2 = {
|
|
7534
|
+
[K in keyof ISwapsApiV2]: ISwapsApiV2[K] extends (...args: infer A) => Promise<infer R> ? (...args: [...A, config?: RequestOverrideConfig]) => Promise<Result<R>> : never;
|
|
7535
|
+
};
|
|
7536
|
+
/**
|
|
7537
|
+
* HTTP client for the backend **Swaps API v2** (`/swaps/*`).
|
|
7538
|
+
*
|
|
7539
|
+
* A thin adapter over the standalone `@sodax/swaps-api` package (the single source of the wire
|
|
7540
|
+
* client — request building, per-chain `tx` validation/transform, response schemas, HTTP + retry).
|
|
7541
|
+
* This service adds the SDK conventions on top: `Result<T>` (it never throws), a `SodaxLogger`,
|
|
7542
|
+
* `SwapsApiConfig`/`ApiConfig` resolution, and per-call `RequestOverrideConfig`.
|
|
7543
|
+
*
|
|
7544
|
+
* All public methods return `Promise<Result<T>>`. On network failure, timeout, non-2xx HTTP
|
|
7545
|
+
* response, or response-shape validation failure, the returned Result has `ok: false` with a
|
|
7546
|
+
* canonical `SodaxError<'EXTERNAL_API_ERROR'>` (`feature: 'backend'`, `context.api: 'swaps'`,
|
|
7547
|
+
* `context.endpoint`); the underlying `SwapsApiError` is preserved on `error.cause`.
|
|
7548
|
+
*
|
|
7549
|
+
* Per-call request overrides (base URL, timeout, headers) can be passed as the optional last
|
|
7550
|
+
* argument to any method via `RequestOverrideConfig`.
|
|
7551
|
+
*
|
|
7552
|
+
* Reachable on the Sodax facade as `sodax.api.swaps`.
|
|
7553
|
+
*/
|
|
7554
|
+
declare class SwapsApiService implements ResultifiedSwapsApiV2 {
|
|
7555
|
+
private readonly config;
|
|
7556
|
+
private readonly headers;
|
|
7557
|
+
private readonly logger;
|
|
7558
|
+
constructor(config: SwapsApiConfig, logger?: SodaxLogger);
|
|
7559
|
+
/**
|
|
7560
|
+
* Build a `@sodax/swaps-api` client for a single call. Maps the SDK's `SwapsApiConfig`
|
|
7561
|
+
* (`baseURL`/`timeout`/`headers`) to the package's config (`baseUrl`/`timeout`/`headers`), layering
|
|
7562
|
+
* the optional per-call `RequestOverrideConfig` on top (override wins per field; headers merge).
|
|
7563
|
+
* `timeout` falls back to the backend-API default so a config that omits it still gets a ceiling
|
|
7564
|
+
* rather than an unbounded request. Constructed per call so `setHeaders` mutations and per-call
|
|
7565
|
+
* overrides both take effect without caching stale state.
|
|
7566
|
+
*/
|
|
7567
|
+
private buildClient;
|
|
7568
|
+
/**
|
|
7569
|
+
* Run one delegated `SwapsApi` call and wrap it in `Result<T>`. A thrown `SwapsApiError`
|
|
7570
|
+
* (network/timeout/HTTP/parse/validation) becomes `{ ok: false }` with a canonical
|
|
7571
|
+
* `SodaxError<'EXTERNAL_API_ERROR'>`; the original error is kept as `cause`, and its
|
|
7572
|
+
* `code`/`status`/`issues` are projected into `context` so consumers can discriminate failure
|
|
7573
|
+
* kinds without unwrapping `cause`. Only a RESPONSE-shape validation failure is tagged
|
|
7574
|
+
* `reason: 'invalid_response_shape'` — a request-side validation error is a caller bug, not a
|
|
7575
|
+
* backend fault.
|
|
7576
|
+
*/
|
|
7577
|
+
private toResult;
|
|
7578
|
+
/**
|
|
7579
|
+
* Drop the SDK-only display field `feeAmount` before an intent reaches the strict wire serializer.
|
|
7580
|
+
* `sodax.swaps.createIntent` returns `Intent & FeeAmount`, which is structurally assignable to the
|
|
7581
|
+
* wire `IntentRequestV2` and so gets passed straight into the intent-carrying endpoints; the extra
|
|
7582
|
+
* bigint would trip `serializeIntentRequest`. This is a no-op for an already-clean `IntentRequestV2`.
|
|
7583
|
+
*/
|
|
7584
|
+
private static toWireIntent;
|
|
7585
|
+
/** Fetch all supported swap tokens grouped by SpokeChainKey. */
|
|
7586
|
+
getTokens(config?: RequestOverrideConfig): Promise<Result<GetSwapTokensResponseV2>>;
|
|
7587
|
+
/** Fetch supported swap tokens for a single SpokeChainKey. */
|
|
7588
|
+
getTokensByChain(chainKey: string, config?: RequestOverrideConfig): Promise<Result<GetSwapTokensByChainResponseV2>>;
|
|
7589
|
+
/**
|
|
7590
|
+
* Get a solver quote for a cross-chain swap. Pass `query.includeTxData = true` to also build an
|
|
7591
|
+
* unsigned create-intent transaction (`txData`); in that case `srcAddress`/`dstAddress` are required.
|
|
7592
|
+
*/
|
|
7593
|
+
getQuote(body: QuoteRequestV2, query?: QuoteQueryV2, config?: RequestOverrideConfig): Promise<Result<QuoteResponseV2>>;
|
|
7594
|
+
/** Compute a swap deadline (hub timestamp + `offsetSeconds`, default 300s). */
|
|
7595
|
+
getDeadline(query?: DeadlineQueryV2, config?: RequestOverrideConfig): Promise<Result<DeadlineResponseV2>>;
|
|
7596
|
+
/** Check whether the source token allowance is already sufficient for the intent. */
|
|
7597
|
+
checkAllowance(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<AllowanceCheckResponseV2>>;
|
|
7598
|
+
/** Build an unsigned token-approval transaction for the source token. */
|
|
7599
|
+
approve(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<ApproveResponseV2>>;
|
|
7600
|
+
/** Build an unsigned create-intent transaction. */
|
|
7601
|
+
createIntent(body: CreateIntentParamsV2, config?: RequestOverrideConfig): Promise<Result<CreateIntentResponseV2>>;
|
|
7602
|
+
/** Submit the broadcast intent tx to the relay. */
|
|
7603
|
+
submitIntent(body: SubmitIntentRequestV2, config?: RequestOverrideConfig): Promise<Result<SubmitIntentResponseV2>>;
|
|
7604
|
+
/** Poll the solver for intent execution status. */
|
|
7605
|
+
getStatus(body: StatusRequestV2, config?: RequestOverrideConfig): Promise<Result<StatusResponseV2>>;
|
|
7606
|
+
/** Build an unsigned cancel-intent transaction (the `intent` bigint numerics serialize to strings). */
|
|
7607
|
+
cancelIntent(body: CancelIntentRequestV2, config?: RequestOverrideConfig): Promise<Result<CancelIntentResponseV2>>;
|
|
7608
|
+
/** Compute the keccak256 hash of an Intent struct (bigint numerics serialize to strings). */
|
|
7609
|
+
getIntentHash(body: IntentHashRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentHashResponseV2>>;
|
|
7610
|
+
/** Long-poll the relayer until the fill packet lands on the destination chain. */
|
|
7611
|
+
getSolvedIntentPacket(body: IntentPacketRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentPacketResponseV2>>;
|
|
7612
|
+
/** Recover the relay extra data needed by `/swaps/intents/submit` (provide EITHER `txHash` OR `intent`). */
|
|
7613
|
+
getIntentSubmitTxExtraData(body: IntentExtraDataRequestV2, config?: RequestOverrideConfig): Promise<Result<IntentExtraDataResponseV2>>;
|
|
7614
|
+
/** Get the on-chain fill state for an intent by its hub-chain tx hash. */
|
|
7615
|
+
getFilledIntent(txHash: string, config?: RequestOverrideConfig): Promise<Result<IntentStateV2>>;
|
|
7616
|
+
/** Look up an Intent struct by its hub-chain creation tx hash. */
|
|
7617
|
+
getIntent(txHash: string, config?: RequestOverrideConfig): Promise<Result<GetIntentResponseV2>>;
|
|
7618
|
+
/** Build an unsigned create-limit-order-intent transaction (create-intent with optional `deadline`). */
|
|
7619
|
+
createLimitOrderIntent(body: CreateLimitOrderParamsV2, config?: RequestOverrideConfig): Promise<Result<CreateLimitOrderResponseV2>>;
|
|
7620
|
+
/** Estimate gas for a raw transaction on a spoke chain (bigint `tx` numerics serialize to strings). */
|
|
7621
|
+
estimateGas(body: GasEstimateRequestV2, config?: RequestOverrideConfig): Promise<Result<GasEstimateResponseV2>>;
|
|
7622
|
+
/** Compute the partner fee for a given input amount. */
|
|
7623
|
+
getPartnerFee(query: FeeQueryV2, config?: RequestOverrideConfig): Promise<Result<FeeResponseV2>>;
|
|
7624
|
+
/** Compute the protocol (solver) fee for a given input amount. */
|
|
7625
|
+
getSolverFee(query: FeeQueryV2, config?: RequestOverrideConfig): Promise<Result<FeeResponseV2>>;
|
|
7626
|
+
/** Submit a swap transaction to be processed (relay, post-execution, etc.). Idempotent on `(txHash, srcChainKey)`. */
|
|
7627
|
+
submitTx(body: SubmitTxRequestV2, config?: RequestOverrideConfig): Promise<Result<SubmitTxResponseV2>>;
|
|
7628
|
+
/** Get the processing status of a submitted swap transaction by `(txHash, srcChainKey)`. */
|
|
7629
|
+
getSubmitTxStatus(query: SubmitTxStatusQueryV2, config?: RequestOverrideConfig): Promise<Result<SubmitTxStatusResponseV2>>;
|
|
7630
|
+
/**
|
|
7631
|
+
* Merge additional headers into the service's default header set. Existing
|
|
7632
|
+
* keys are overwritten; keys absent from `headers` are preserved. Applied to
|
|
7633
|
+
* every subsequent call (the delegated client is rebuilt per call).
|
|
7634
|
+
*/
|
|
7635
|
+
setHeaders(headers: Record<string, string>): void;
|
|
7636
|
+
/** Return the base URL the service is currently pointing at. */
|
|
7637
|
+
getBaseURL(): string;
|
|
7638
|
+
}
|
|
7639
|
+
|
|
7640
|
+
/** Result-wrapped {@link IStellarSponsoringApi} with per-request overrides. */
|
|
7641
|
+
type ResultifiedSponsoringApi = {
|
|
7642
|
+
[K in keyof IStellarSponsoringApi]: IStellarSponsoringApi[K] extends (...args: infer A) => Promise<infer R> ? (...args: [...A, config?: RequestOverrideConfig]) => Promise<Result<R, SodaxError<'EXTERNAL_API_ERROR'>>> : never;
|
|
7643
|
+
};
|
|
7644
|
+
/**
|
|
7645
|
+
* Uncached HTTP client for the sponsoring API. Stellar orchestration and
|
|
7646
|
+
* config caching belong to `SponsoringService`.
|
|
7647
|
+
*
|
|
7648
|
+
* Transport errors use `feature: 'backend'`; only the user-facing orchestrator
|
|
7649
|
+
* uses `feature: 'sponsoring'`.
|
|
7650
|
+
*/
|
|
7651
|
+
declare class SponsoringApiService implements ResultifiedSponsoringApi {
|
|
7652
|
+
private readonly config;
|
|
7653
|
+
private readonly headers;
|
|
7654
|
+
private readonly logger;
|
|
7655
|
+
constructor(config: SponsoringApiConfig, logger?: SodaxLogger);
|
|
7656
|
+
/**
|
|
7657
|
+
* Validate a response while preserving HTTP failures on `error.cause` for
|
|
7658
|
+
* sponsor-error classification.
|
|
7659
|
+
*/
|
|
7660
|
+
private request;
|
|
7661
|
+
/** Fetch build parameters, including the rotatable sponsor account. */
|
|
7662
|
+
getStellarSponsorConfig(config?: RequestOverrideConfig): Promise<Result<StellarSponsorConfig, SodaxError<'EXTERNAL_API_ERROR'>>>;
|
|
7663
|
+
/**
|
|
7664
|
+
* Submit a client-signed transaction for sponsor co-signing. An
|
|
7665
|
+
* `alreadyActive` response is also successful.
|
|
7666
|
+
*/
|
|
7667
|
+
createStellarSponsoredAccount(body: StellarSponsoredAccountRequest, config?: RequestOverrideConfig): Promise<Result<StellarSponsoredAccountResponse, SodaxError<'EXTERNAL_API_ERROR'>>>;
|
|
7668
|
+
setHeaders(headers: Record<string, string>): void;
|
|
7669
|
+
getBaseURL(): string;
|
|
7670
|
+
}
|
|
7671
|
+
|
|
7386
7672
|
/** Full details of a single swap intent as stored and returned by the backend. */
|
|
7387
7673
|
interface IntentResponse {
|
|
7388
7674
|
intentHash: string;
|
|
@@ -7394,16 +7680,16 @@ interface IntentResponse {
|
|
|
7394
7680
|
intent: {
|
|
7395
7681
|
intentId: string;
|
|
7396
7682
|
creator: string;
|
|
7397
|
-
inputToken:
|
|
7398
|
-
outputToken:
|
|
7683
|
+
inputToken: string;
|
|
7684
|
+
outputToken: string;
|
|
7399
7685
|
inputAmount: string;
|
|
7400
7686
|
minOutputAmount: string;
|
|
7401
7687
|
deadline: string;
|
|
7402
7688
|
allowPartialFill: boolean;
|
|
7403
7689
|
srcChain: number;
|
|
7404
7690
|
dstChain: number;
|
|
7405
|
-
srcAddress:
|
|
7406
|
-
dstAddress:
|
|
7691
|
+
srcAddress: string;
|
|
7692
|
+
dstAddress: string;
|
|
7407
7693
|
solver: string;
|
|
7408
7694
|
data: string;
|
|
7409
7695
|
};
|
|
@@ -7516,36 +7802,38 @@ interface MoneyMarketBorrowers {
|
|
|
7516
7802
|
* - **Money market** — query per-user positions, per-reserve asset stats,
|
|
7517
7803
|
* and paginated borrower/supplier lists.
|
|
7518
7804
|
*
|
|
7519
|
-
* All public methods return `Promise<Result<T>>` — they never throw. On
|
|
7520
|
-
*
|
|
7521
|
-
* has `ok: false` with a
|
|
7805
|
+
* All public methods return `Promise<Result<T>>` — they never throw. On network
|
|
7806
|
+
* failure, timeout, non-2xx HTTP response, or unexpected response shape the
|
|
7807
|
+
* returned Result has `ok: false` with a canonical `SodaxError<'EXTERNAL_API_ERROR'>`
|
|
7808
|
+
* (`feature: 'backend'`, `context.api: 'backend'`) in the `error` field; the
|
|
7809
|
+
* underlying failure is preserved on `error.cause`.
|
|
7522
7810
|
*
|
|
7523
7811
|
* Per-call request overrides (base URL, timeout, headers) can be passed as
|
|
7524
7812
|
* the optional last argument to any method via `RequestOverrideConfig`.
|
|
7525
7813
|
*/
|
|
7526
|
-
declare class BackendApiService implements
|
|
7814
|
+
declare class BackendApiService implements IConfigApiV1 {
|
|
7815
|
+
readonly swaps: SwapsApiService;
|
|
7816
|
+
readonly sponsoring: SponsoringApiService;
|
|
7527
7817
|
private readonly config;
|
|
7528
7818
|
private readonly headers;
|
|
7529
|
-
|
|
7819
|
+
private readonly logger;
|
|
7820
|
+
constructor(config: ApiConfig, logger?: SodaxLogger);
|
|
7530
7821
|
/**
|
|
7531
|
-
*
|
|
7532
|
-
*
|
|
7533
|
-
*
|
|
7534
|
-
*
|
|
7535
|
-
*
|
|
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.
|
|
7822
|
+
* Issue a request and validate the JSON body against `schema`, wrapping the result in `Result<T>`.
|
|
7823
|
+
* Mirrors {@link SwapsApiService}: a 2xx body that fails the schema is surfaced as
|
|
7824
|
+
* `EXTERNAL_API_ERROR` (`context.reason: 'invalid_response_shape'`) rather than returned untyped.
|
|
7825
|
+
* Every data/token/money-market method delegates here; the config/relay reads use
|
|
7826
|
+
* {@link requestUnvalidated} instead.
|
|
7541
7827
|
*/
|
|
7542
|
-
private
|
|
7828
|
+
private request;
|
|
7543
7829
|
/**
|
|
7544
|
-
*
|
|
7545
|
-
*
|
|
7546
|
-
*
|
|
7830
|
+
* Issue a request WITHOUT response-shape validation (passthrough typing). Reserved for the
|
|
7831
|
+
* config/relay reads whose shapes are too large/brittle to schema-validate (`SodaxConfig` via
|
|
7832
|
+
* `getAllConfig`, `SpokeChainConfigMap` via `getSpokeChainConfig`) or carry `bigint` values that
|
|
7833
|
+
* cannot survive JSON validation (`getRelayChainIdMap`). `ConfigService` version-gates and falls
|
|
7834
|
+
* back to packaged defaults, so it relies on no response-shape guarantee from these endpoints.
|
|
7547
7835
|
*/
|
|
7548
|
-
private
|
|
7836
|
+
private requestUnvalidated;
|
|
7549
7837
|
/**
|
|
7550
7838
|
* Fetch a swap intent by the hub-chain transaction hash that created it.
|
|
7551
7839
|
*
|
|
@@ -7564,34 +7852,6 @@ declare class BackendApiService implements IConfigApi {
|
|
|
7564
7852
|
* @returns `Result<IntentResponse>` — on success, the full intent details.
|
|
7565
7853
|
*/
|
|
7566
7854
|
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
7855
|
/**
|
|
7596
7856
|
* Fetch a paginated snapshot of the solver orderbook — open swap intents
|
|
7597
7857
|
* that are currently waiting to be filled by the solver.
|
|
@@ -7797,6 +8057,9 @@ declare class BackendApiService implements IConfigApi {
|
|
|
7797
8057
|
* without constructing a new service instance. Existing header keys are
|
|
7798
8058
|
* overwritten; keys absent from `headers` are preserved.
|
|
7799
8059
|
*
|
|
8060
|
+
* Headers also reach `swaps`, which shares this origin, but never `sponsoring`,
|
|
8061
|
+
* whose separate origin must not receive base-API credentials.
|
|
8062
|
+
*
|
|
7800
8063
|
* @param headers - Key-value pairs to add or overwrite in the default headers.
|
|
7801
8064
|
*/
|
|
7802
8065
|
setHeaders(headers: Record<string, string>): void;
|
|
@@ -7808,23 +8071,107 @@ declare class BackendApiService implements IConfigApi {
|
|
|
7808
8071
|
getBaseURL(): string;
|
|
7809
8072
|
}
|
|
7810
8073
|
|
|
8074
|
+
/**
|
|
8075
|
+
* Optional per-phase payload builders for {@link ResolvedAnalytics.trackResult}. Each is a lazy thunk
|
|
8076
|
+
* invoked only if its event actually emits, so payloads are never built when analytics is off.
|
|
8077
|
+
* `success` receives the resolved value, `failure` the `Result` error.
|
|
8078
|
+
*/
|
|
8079
|
+
interface AnalyticsActionData<T, E> {
|
|
8080
|
+
start?: () => Record<string, unknown>;
|
|
8081
|
+
success?: (value: T) => Record<string, unknown>;
|
|
8082
|
+
failure?: (error: E) => Record<string, unknown>;
|
|
8083
|
+
}
|
|
8084
|
+
/**
|
|
8085
|
+
* The SDK-internal analytics emitter, resolved once from the consumer's {@link AnalyticsOption} and
|
|
8086
|
+
* held on `ConfigService` (`config.analytics`).
|
|
8087
|
+
*
|
|
8088
|
+
* Services never touch the raw config — they call {@link ResolvedAnalytics.emit}, which is the only
|
|
8089
|
+
* gate. When analytics is disabled, off for a feature/action, or above the configured detail level,
|
|
8090
|
+
* the `build` thunk is never invoked, so event payloads are never constructed on hot feature paths.
|
|
8091
|
+
* This is what keeps feature code free of analytics overhead unless a consumer explicitly opts in.
|
|
8092
|
+
*/
|
|
8093
|
+
interface ResolvedAnalytics {
|
|
8094
|
+
/**
|
|
8095
|
+
* Whether an event for `feature`/`action` at `level` would be emitted. Call sites rarely need this
|
|
8096
|
+
* directly — {@link emit} checks it internally — but it is exposed for the rare case where even
|
|
8097
|
+
* deciding what to emit is itself costly. Omit `action` to ask whether the feature is tracked at all.
|
|
8098
|
+
*/
|
|
8099
|
+
isEnabled(feature: SodaxFeature, action?: string, level?: AnalyticsDetailLevel): boolean;
|
|
8100
|
+
/**
|
|
8101
|
+
* Emit one user-action event. `build` produces the optional structured payload and is invoked
|
|
8102
|
+
* lazily — only when the event passes the enabled/feature/action/level gate — so disabled analytics
|
|
8103
|
+
* costs nothing but a boolean check at the call site. A faulty consumer tracker can never break a
|
|
8104
|
+
* feature flow: delivery is wrapped and fire-and-forget.
|
|
8105
|
+
*/
|
|
8106
|
+
emit(feature: SodaxFeature, action: string, phase: AnalyticsEventPhase, build?: () => Record<string, unknown>, level?: AnalyticsDetailLevel): void;
|
|
8107
|
+
/**
|
|
8108
|
+
* Wrap a `Result`-returning action flow: emit `start` before `run`, then `success` or `failure`
|
|
8109
|
+
* from the resolved `Result` (and `failure` + rethrow if `run` throws), returning the `Result`
|
|
8110
|
+
* unchanged. This is the canonical way to instrument a feature method — one call at the boundary
|
|
8111
|
+
* covers every internal return point, so action code stays free of scattered emit calls.
|
|
8112
|
+
*/
|
|
8113
|
+
trackResult<T, E>(feature: SodaxFeature, action: string, run: () => Promise<Result<T, E>>, data?: AnalyticsActionData<T, E>): Promise<Result<T, E>>;
|
|
8114
|
+
}
|
|
8115
|
+
/** Disabled emitter: every gate is closed, `build` is never called, nothing is delivered. */
|
|
8116
|
+
declare const noopAnalytics: ResolvedAnalytics;
|
|
8117
|
+
/**
|
|
8118
|
+
* Resolve an {@link AnalyticsOption} (a config object, `false`, or `undefined`) into a concrete
|
|
8119
|
+
* {@link ResolvedAnalytics}.
|
|
8120
|
+
*
|
|
8121
|
+
* Defaults to {@link noopAnalytics} so analytics is **off** unless a consumer opts in with an
|
|
8122
|
+
* `AnalyticsConfig`. This mirrors `resolveLogger` but with the opposite default — logging is on by
|
|
8123
|
+
* default, analytics is off — per issue #175 ("no needless invocations unless explicitly enabled").
|
|
8124
|
+
*/
|
|
8125
|
+
declare function resolveAnalytics(option: AnalyticsOption | undefined): ResolvedAnalytics;
|
|
8126
|
+
|
|
7811
8127
|
type ConfigServiceConstructorParams = {
|
|
7812
8128
|
api: BackendApiService;
|
|
7813
8129
|
config: SodaxConfig;
|
|
7814
8130
|
/**
|
|
7815
|
-
* The raw user-provided config override (the `
|
|
8131
|
+
* The raw user-provided config override (the `SodaxOptions` passed to `new Sodax(...)`),
|
|
7816
8132
|
* NOT the merged result. Re-applied on top of dynamic config in {@link ConfigService.initialize} so
|
|
7817
8133
|
* that a remote config fetch never clobbers explicit user overrides.
|
|
7818
8134
|
*/
|
|
7819
|
-
userConfig?:
|
|
8135
|
+
userConfig?: SodaxOptions;
|
|
8136
|
+
/**
|
|
8137
|
+
* Pre-resolved SDK log sink. Held outside the swappable `SodaxConfig` so a dynamic config fetch
|
|
8138
|
+
* in {@link ConfigService.initialize} never replaces it. Defaults to the console logger when omitted.
|
|
8139
|
+
*/
|
|
8140
|
+
logger?: SodaxLogger;
|
|
8141
|
+
/**
|
|
8142
|
+
* Pre-resolved analytics emitter. Like {@link logger}, held outside the swappable `SodaxConfig` so a
|
|
8143
|
+
* dynamic config fetch never replaces it. Defaults to the no-op (disabled) emitter when omitted.
|
|
8144
|
+
*/
|
|
8145
|
+
analytics?: ResolvedAnalytics;
|
|
8146
|
+
/**
|
|
8147
|
+
* Global partner fee (the `fee` option passed to `new Sodax(...)`). Held outside the swappable
|
|
8148
|
+
* `SodaxConfig` — like {@link logger} — so a dynamic config fetch never replaces it. The backend
|
|
8149
|
+
* never supplies it; it is purely a client-side option.
|
|
8150
|
+
*/
|
|
8151
|
+
fee?: PartnerFee;
|
|
7820
8152
|
};
|
|
7821
8153
|
/**
|
|
7822
8154
|
* ConfigApiService - Service for fetching configuration data from the backend API or fallbacking to default values
|
|
7823
8155
|
*/
|
|
7824
8156
|
declare class ConfigService {
|
|
7825
8157
|
private sodax;
|
|
7826
|
-
|
|
7827
|
-
|
|
8158
|
+
/**
|
|
8159
|
+
* SDK log sink. Resolved once at construction and kept independent of {@link sodax} so that
|
|
8160
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.logger`.
|
|
8161
|
+
*/
|
|
8162
|
+
readonly logger: SodaxLogger;
|
|
8163
|
+
/**
|
|
8164
|
+
* Analytics emitter. Resolved once at construction and kept independent of {@link sodax} so that
|
|
8165
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.analytics`;
|
|
8166
|
+
* disabled (no-op) unless the consumer passed an `analytics` config to `new Sodax(...)`.
|
|
8167
|
+
*/
|
|
8168
|
+
readonly analytics: ResolvedAnalytics;
|
|
8169
|
+
/**
|
|
8170
|
+
* Global partner fee. Resolved once at construction and kept independent of {@link sodax} so that
|
|
8171
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. The backend never supplies it — it is
|
|
8172
|
+
* a client-side option set via `new Sodax({ fee })`. Per-feature overrides live on the feature config.
|
|
8173
|
+
*/
|
|
8174
|
+
readonly fee: PartnerFee | undefined;
|
|
7828
8175
|
private initialized;
|
|
7829
8176
|
private supportedHubAssetsSet;
|
|
7830
8177
|
private supportedSodaVaultAssetsSet;
|
|
@@ -7835,7 +8182,7 @@ declare class ConfigService {
|
|
|
7835
8182
|
private stakedATokenAddressesSet;
|
|
7836
8183
|
private chainToSupportedTokenAddressMap;
|
|
7837
8184
|
private hubAssetToXTokenMap;
|
|
7838
|
-
constructor({ api, config, userConfig }: ConfigServiceConstructorParams);
|
|
8185
|
+
constructor({ api, config, userConfig, logger, analytics, fee }: ConfigServiceConstructorParams);
|
|
7839
8186
|
initialize(): Promise<Result<void>>;
|
|
7840
8187
|
getChains(): GetChainsApiResponse;
|
|
7841
8188
|
getSwapTokens(): GetSwapTokensApiResponse;
|
|
@@ -7846,6 +8193,14 @@ declare class ConfigService {
|
|
|
7846
8193
|
getMoneyMarketReserveAssets(): GetMoneyMarketReserveAssetsApiResponse;
|
|
7847
8194
|
isValidOriginalAssetAddress(chainId: SpokeChainKey, asset: OriginalAssetAddress): boolean;
|
|
7848
8195
|
getOriginalAssetAddress(chainId: SpokeChainKey, hubAsset: Address): OriginalAssetAddress | undefined;
|
|
8196
|
+
/**
|
|
8197
|
+
* Resolves the {@link XToken} descriptor (hub asset, vault, decimals) for a hub-asset address.
|
|
8198
|
+
*
|
|
8199
|
+
* Useful when a caller holds a hub asset directly on Sonic that has no spoke-token entry under
|
|
8200
|
+
* the hub chain — e.g. a partner BTC fee held as the BTC hub asset, which only exists as a spoke
|
|
8201
|
+
* token on Bitcoin. Returns `undefined` when the address is not a known hub asset.
|
|
8202
|
+
*/
|
|
8203
|
+
getXTokenFromHubAsset(hubAsset: string): XToken | undefined;
|
|
7849
8204
|
getSpokeTokenFromOriginalAssetAddress(chainId: SpokeChainKey, originalAssetAddress: OriginalAssetAddress): XToken | undefined;
|
|
7850
8205
|
isValidHubAsset(hubAsset: Address): boolean;
|
|
7851
8206
|
/**
|
|
@@ -7888,6 +8243,11 @@ declare class ConfigService {
|
|
|
7888
8243
|
get swaps(): SwapsConfig;
|
|
7889
8244
|
get bridge(): BridgeConfig;
|
|
7890
8245
|
get moneyMarket(): MoneyMarketConfig;
|
|
8246
|
+
get leverageYield(): LeverageYieldConfig;
|
|
8247
|
+
get swapPartnerFee(): PartnerFee | undefined;
|
|
8248
|
+
get moneyMarketPartnerFee(): PartnerFee | undefined;
|
|
8249
|
+
get bridgePartnerFee(): PartnerFee | undefined;
|
|
8250
|
+
get leverageYieldPartnerFee(): PartnerFee | undefined;
|
|
7891
8251
|
get dex(): DexConfig;
|
|
7892
8252
|
getChainConfig<K extends SpokeChainKey>(key: K): GetSpokeChainConfigType<K>;
|
|
7893
8253
|
get sodaxConfig(): SodaxConfig;
|
|
@@ -7901,18 +8261,25 @@ declare class ConfigService {
|
|
|
7901
8261
|
declare function parseTokenArrayFromJson(input: unknown): readonly XToken[];
|
|
7902
8262
|
|
|
7903
8263
|
/**
|
|
7904
|
-
* Layers a user
|
|
8264
|
+
* Layers a user SodaxOptions override on top of a full base config (the static default in the
|
|
7905
8265
|
* Sodax constructor, or the dynamic config in {@link ConfigService.initialize}).
|
|
7906
8266
|
*
|
|
7907
|
-
*
|
|
7908
|
-
*
|
|
7909
|
-
*
|
|
7910
|
-
*
|
|
7911
|
-
*
|
|
7912
|
-
*
|
|
7913
|
-
*
|
|
8267
|
+
* Every field is deep-merged, so a user can override `api.timeout` without dropping the sibling `api.baseURL`,
|
|
8268
|
+
* and can set a per-feature `partnerFee` (`swaps` / `moneyMarket` / `bridge` / `leverageYield`) without
|
|
8269
|
+
* disturbing that feature's other defaults. A per-feature `partnerFee` is never present on the base config —
|
|
8270
|
+
* it is a `SodaxOptions`/feature-options field, not part of `SodaxDefaultConfig` or the backend dynamic
|
|
8271
|
+
* config, so it never travels on the wire. Every fee override therefore lands on an empty slot and a complete
|
|
8272
|
+
* `PartnerFee` is written wholesale; there is no base variant to merge against, so no partial-variant hybrid
|
|
8273
|
+
* (`{address, amount, percentage}`) can arise. `PartnerFee` is a discriminated union and downstream
|
|
8274
|
+
* discrimination treats any object with a bigint `amount` as the amount variant (see `isPartnerFeeAmount` /
|
|
8275
|
+
* `calculateFeeAmount`), which is exactly why a fee override must be a complete `PartnerFee`, not a partial.
|
|
8276
|
+
*
|
|
8277
|
+
* The global `fee` is NOT merged here: it is a `SodaxOptions` client option (like `logger`), resolved once
|
|
8278
|
+
* and held on `ConfigService.fee`, where it acts as the per-feature fee fallback (`featureFee ?? fee`, via
|
|
8279
|
+
* `ConfigService.swapPartnerFee` / `moneyMarketPartnerFee` / `bridgePartnerFee`). Config merging and
|
|
8280
|
+
* effective-fee resolution are separate concerns, so the merge layer deliberately leaves `fee` alone.
|
|
7914
8281
|
*/
|
|
7915
|
-
declare function mergeSodaxConfig(base:
|
|
8282
|
+
declare function mergeSodaxConfig(base: SodaxDefaultConfig, override: SodaxOptions): SodaxConfig;
|
|
7916
8283
|
|
|
7917
8284
|
/**
|
|
7918
8285
|
* ABI-encode an array of ContractCall objects.
|
|
@@ -8080,6 +8447,8 @@ type OptionalSkipSimulation$1 = {
|
|
|
8080
8447
|
};
|
|
8081
8448
|
type DepositParams<C extends SpokeChainKey, Raw extends boolean = boolean> = {
|
|
8082
8449
|
srcAddress: GetAddressType<C>;
|
|
8450
|
+
srcPublicKey?: string;
|
|
8451
|
+
accessToken?: string;
|
|
8083
8452
|
srcChainKey: C;
|
|
8084
8453
|
to: HubAddress;
|
|
8085
8454
|
token: GetTokenAddressType<C>;
|
|
@@ -8193,6 +8562,17 @@ type RawDestinationParams = {
|
|
|
8193
8562
|
dstAddress: string;
|
|
8194
8563
|
};
|
|
8195
8564
|
|
|
8565
|
+
/**
|
|
8566
|
+
* High-level request for routing an intent's output through a deployed delivery hook. Pick a hook by
|
|
8567
|
+
* its {@link HookKind}; the SDK resolves the hook's deployed address and encodes the payload it expects
|
|
8568
|
+
* (so address and codec can never drift). The recipient is taken from the intent's `dstAddress`.
|
|
8569
|
+
*
|
|
8570
|
+
* Prefer this over setting {@link CreateIntentParams.deliveryData} + `dstAddress` by hand — those remain
|
|
8571
|
+
* available as a low-level escape hatch for hooks not yet in the registry.
|
|
8572
|
+
*/
|
|
8573
|
+
type HookRequest = {
|
|
8574
|
+
kind: typeof HookKind.HYPERCORE_DEPOSIT;
|
|
8575
|
+
};
|
|
8196
8576
|
type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
8197
8577
|
inputToken: string;
|
|
8198
8578
|
outputToken: string;
|
|
@@ -8206,6 +8586,21 @@ type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
8206
8586
|
dstAddress: string;
|
|
8207
8587
|
solver?: Address;
|
|
8208
8588
|
data: Hex;
|
|
8589
|
+
/**
|
|
8590
|
+
* High-level delivery-hook selector. When set, the SDK routes the output through the chosen hook:
|
|
8591
|
+
* it overrides `dstAddress` with the hook's deployed address and encodes `deliveryData` from this
|
|
8592
|
+
* request (the recipient is the `dstAddress` you supply). This is the preferred way to use hooks —
|
|
8593
|
+
* the hook address and its payload codec come from the registry, so they can never drift.
|
|
8594
|
+
*/
|
|
8595
|
+
hook?: HookRequest;
|
|
8596
|
+
/**
|
|
8597
|
+
* Low-level delivery payload forwarded with the output transfer — an escape hatch for hooks not in
|
|
8598
|
+
* the registry. On arrival at the destination spoke, `SpokeAssetManager` calls
|
|
8599
|
+
* `ISpokeReceiver(dstAddress).hook(token, amount, deliveryData)`. Opaque bytes whose schema is
|
|
8600
|
+
* defined by the destination receiver; when set, you must also point `dstAddress` at that receiver.
|
|
8601
|
+
* Prefer {@link hook} when the target is a registered hook. Ignored when {@link hook} is set.
|
|
8602
|
+
*/
|
|
8603
|
+
deliveryData?: Hex;
|
|
8209
8604
|
};
|
|
8210
8605
|
/**
|
|
8211
8606
|
* Parameters for creating a limit order intent.
|
|
@@ -8214,6 +8609,29 @@ type CreateIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
8214
8609
|
type CreateLimitOrderParams<K extends SpokeChainKey = SpokeChainKey> = Omit<CreateIntentParams<K>, 'deadline'> & {
|
|
8215
8610
|
deadline?: bigint;
|
|
8216
8611
|
};
|
|
8612
|
+
type SrcPublicKeySlot<K extends SpokeChainKey> = GetChainType<K> extends 'STACKS' ? {
|
|
8613
|
+
srcPublicKey?: string;
|
|
8614
|
+
} : {
|
|
8615
|
+
srcPublicKey?: never;
|
|
8616
|
+
};
|
|
8617
|
+
/** Bound Exchange (Radfi) inputs for raw Bitcoin TRADING-mode swap intents. */
|
|
8618
|
+
type BitcoinBoundExtras = {
|
|
8619
|
+
/** Bound token, for raw Bitcoin TRADING callers; falls back to the RadfiProvider instance token when omitted. */
|
|
8620
|
+
accessToken?: string;
|
|
8621
|
+
};
|
|
8622
|
+
type BitcoinBoundSlot<K extends SpokeChainKey> = GetChainType<K> extends 'BITCOIN' ? {
|
|
8623
|
+
bound?: BitcoinBoundExtras;
|
|
8624
|
+
} : {
|
|
8625
|
+
bound?: never;
|
|
8626
|
+
};
|
|
8627
|
+
/**
|
|
8628
|
+
* Per-action extras for swap intent creation, supplied via the `extras` slot of the swap
|
|
8629
|
+
* action params.
|
|
8630
|
+
*/
|
|
8631
|
+
type SwapExtras<K extends SpokeChainKey = SpokeChainKey> = {
|
|
8632
|
+
/** Overrides the configured swap partner fee for this action; falls back to config when omitted. */
|
|
8633
|
+
partnerFee?: PartnerFee;
|
|
8634
|
+
} & SrcPublicKeySlot<K> & BitcoinBoundSlot<K>;
|
|
8217
8635
|
type Intent = {
|
|
8218
8636
|
intentId: bigint;
|
|
8219
8637
|
creator: Address;
|
|
@@ -8231,7 +8649,10 @@ type Intent = {
|
|
|
8231
8649
|
data: Hex;
|
|
8232
8650
|
};
|
|
8233
8651
|
declare enum IntentDataType {
|
|
8234
|
-
|
|
8652
|
+
ARRAY = 0,
|
|
8653
|
+
FEE = 1,
|
|
8654
|
+
HOOK = 2,
|
|
8655
|
+
DELIVERY = 3
|
|
8235
8656
|
}
|
|
8236
8657
|
type FeeData = {
|
|
8237
8658
|
fee: bigint;
|
|
@@ -8274,7 +8695,7 @@ type CreateSonicSwapIntentParams<Raw extends boolean> = {
|
|
|
8274
8695
|
} & WalletProviderSlot<SonicChainKey, Raw>;
|
|
8275
8696
|
declare class SonicSpokeService {
|
|
8276
8697
|
private readonly config;
|
|
8277
|
-
readonly publicClient: PublicClient
|
|
8698
|
+
readonly publicClient: PublicClient;
|
|
8278
8699
|
private readonly pollingIntervalMs;
|
|
8279
8700
|
private readonly maxTimeoutMs;
|
|
8280
8701
|
constructor(config: ConfigService);
|
|
@@ -8339,11 +8760,11 @@ type EvmHubProviderConstructorParams = {
|
|
|
8339
8760
|
config: ConfigService;
|
|
8340
8761
|
};
|
|
8341
8762
|
declare class EvmHubProvider {
|
|
8342
|
-
readonly publicClient: PublicClient
|
|
8763
|
+
readonly publicClient: PublicClient;
|
|
8343
8764
|
readonly chainConfig: HubConfig;
|
|
8344
8765
|
readonly config: ConfigService;
|
|
8345
8766
|
readonly service: SonicSpokeService;
|
|
8346
|
-
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}`>;
|
|
8767
|
+
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}`>;
|
|
8347
8768
|
constructor({ config }: EvmHubProviderConstructorParams);
|
|
8348
8769
|
/**
|
|
8349
8770
|
* Gets the cached user's hub wallet address for a spoke chain address.
|
|
@@ -8433,10 +8854,10 @@ declare class EvmVaultTokenService {
|
|
|
8433
8854
|
* Fetches token information for a specific token in the vault.
|
|
8434
8855
|
* @param vault - The address of the vault.
|
|
8435
8856
|
* @param token - The address of the token.
|
|
8436
|
-
* @param publicClient - PublicClient
|
|
8857
|
+
* @param publicClient - PublicClient
|
|
8437
8858
|
* @returns Token information as a TokenInfo object.
|
|
8438
8859
|
*/
|
|
8439
|
-
static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient
|
|
8860
|
+
static getTokenInfo(vault: Address$1, token: Address$1, publicClient: PublicClient): Promise<TokenInfo>;
|
|
8440
8861
|
/**
|
|
8441
8862
|
* Fetches token information for a list of tokens in a vault using a multicall.
|
|
8442
8863
|
* @param vault - The address of the vault contract.
|
|
@@ -8444,21 +8865,21 @@ declare class EvmVaultTokenService {
|
|
|
8444
8865
|
* @param publicClient - The Viem PublicClient instance used to interact with the blockchain.
|
|
8445
8866
|
* @returns A promise that resolves to an array of TokenInfo objects, one for each provided token.
|
|
8446
8867
|
*/
|
|
8447
|
-
static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient
|
|
8868
|
+
static getTokenInfos(vault: Address$1, tokens: Address$1[], publicClient: PublicClient): Promise<TokenInfo[]>;
|
|
8448
8869
|
/**
|
|
8449
8870
|
* Retrieves the reserves of the vault.
|
|
8450
8871
|
* @param vault - The address of the vault.
|
|
8451
|
-
* @param publicClient - PublicClient
|
|
8872
|
+
* @param publicClient - PublicClient
|
|
8452
8873
|
* @returns An object containing tokens and their balances.
|
|
8453
8874
|
*/
|
|
8454
|
-
static getVaultReserves(vault: Address$1, publicClient: PublicClient
|
|
8875
|
+
static getVaultReserves(vault: Address$1, publicClient: PublicClient): Promise<VaultReserves>;
|
|
8455
8876
|
/**
|
|
8456
8877
|
* Retrieves all token information for the vault.
|
|
8457
8878
|
* @param vault - The address of the vault.
|
|
8458
|
-
* @param publicClient - PublicClient
|
|
8879
|
+
* @param publicClient - PublicClient
|
|
8459
8880
|
* @returns A promise that resolves to an object containing tokens, their infos, and reserves.
|
|
8460
8881
|
*/
|
|
8461
|
-
static getAllTokenInfo(vault: Address$1, publicClient: PublicClient
|
|
8882
|
+
static getAllTokenInfo(vault: Address$1, publicClient: PublicClient): Promise<{
|
|
8462
8883
|
tokens: readonly Address$1[];
|
|
8463
8884
|
infos: readonly TokenInfo[];
|
|
8464
8885
|
reserves: readonly bigint[];
|
|
@@ -8620,49 +9041,157 @@ declare class StacksSpokeService {
|
|
|
8620
9041
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<StacksChainKey>): Promise<Result<WaitForTxReceiptReturnType<StacksChainKey>>>;
|
|
8621
9042
|
}
|
|
8622
9043
|
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
* `code` carrying a Radfi-specific identifier (e.g. "2002" insufficientBTCBalance,
|
|
8627
|
-
* "4008" duplicatedPubKey) and `message` an i18n key.
|
|
8628
|
-
*/
|
|
8629
|
-
type RadfiErrorBody = {
|
|
8630
|
-
code?: string;
|
|
8631
|
-
message?: string;
|
|
8632
|
-
details?: string;
|
|
8633
|
-
error?: {
|
|
8634
|
-
details?: string;
|
|
8635
|
-
message?: string;
|
|
8636
|
-
};
|
|
9044
|
+
type RelayExtraData = {
|
|
9045
|
+
address: Hex;
|
|
9046
|
+
payload: Hex;
|
|
8637
9047
|
};
|
|
8638
9048
|
/**
|
|
8639
|
-
*
|
|
8640
|
-
*
|
|
8641
|
-
*
|
|
8642
|
-
*
|
|
9049
|
+
* Signed Bitcoin on-demand payload (money-market borrow/withdraw) carried in the relay submit
|
|
9050
|
+
* `data` as a JSON object — not a stringified JSON. There is no broadcast tx for these.
|
|
9051
|
+
* `public_key` is the signer's public key, required by the relay to verify a BIP-322 signature
|
|
9052
|
+
* (BIP-322 is not public-key-recoverable, unlike BIP-137).
|
|
8643
9053
|
*/
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
readonly cause?: unknown;
|
|
8649
|
-
constructor(status: number, body: RadfiErrorBody, fallback: string);
|
|
8650
|
-
}
|
|
8651
|
-
type RadfiTradingWallet = {
|
|
8652
|
-
tradingAddress: string;
|
|
8653
|
-
userAddress: string;
|
|
8654
|
-
userPublicKey: string;
|
|
9054
|
+
type OnDemandRelayData = {
|
|
9055
|
+
payload_hex: string;
|
|
9056
|
+
signature?: string;
|
|
9057
|
+
public_key?: string;
|
|
8655
9058
|
};
|
|
8656
|
-
type
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
9059
|
+
type IntentDeliveryInfo = {
|
|
9060
|
+
srcChainKey: SpokeChainKey;
|
|
9061
|
+
srcTxHash: string;
|
|
9062
|
+
srcAddress: string;
|
|
9063
|
+
dstChainKey: SpokeChainKey;
|
|
9064
|
+
dstTxHash: string;
|
|
9065
|
+
dstAddress: string;
|
|
8660
9066
|
};
|
|
8661
|
-
type
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
9067
|
+
type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
|
|
9068
|
+
type PacketData = {
|
|
9069
|
+
src_chain_id: number;
|
|
9070
|
+
src_tx_hash: string;
|
|
9071
|
+
src_address: string;
|
|
9072
|
+
status: RelayTxStatus;
|
|
9073
|
+
dst_chain_id: number;
|
|
9074
|
+
conn_sn: number;
|
|
9075
|
+
dst_address: string;
|
|
9076
|
+
dst_tx_hash: string;
|
|
9077
|
+
signatures: string[];
|
|
9078
|
+
payload: string;
|
|
9079
|
+
};
|
|
9080
|
+
type WaitUntilIntentExecutedPayload = {
|
|
9081
|
+
intentRelayChainId: string;
|
|
9082
|
+
srcTxHash: string;
|
|
9083
|
+
timeout?: number;
|
|
9084
|
+
apiUrl: HttpUrl;
|
|
9085
|
+
/**
|
|
9086
|
+
* Disambiguates when a single src tx emits multiple relay packets. Receives the candidates
|
|
9087
|
+
* already filtered by `srcTxHash` and `src_chain_id` (so only packets for the awaited
|
|
9088
|
+
* transaction and source chain reach it) and returns the desired one (or undefined to keep
|
|
9089
|
+
* polling). Defaults to "first candidate" — the legacy behavior for single-packet flows.
|
|
9090
|
+
*/
|
|
9091
|
+
selectPacket?: (packets: PacketData[]) => PacketData | undefined;
|
|
9092
|
+
};
|
|
9093
|
+
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
9094
|
+
type IntentRelayRequest<T extends RelayAction> = {
|
|
9095
|
+
action: T;
|
|
9096
|
+
params: T extends 'submit' ? {
|
|
9097
|
+
chain_id: string;
|
|
9098
|
+
tx_hash: string;
|
|
9099
|
+
data?: RelayExtraData | OnDemandRelayData;
|
|
9100
|
+
} : T extends 'get_transaction_packets' ? {
|
|
9101
|
+
chain_id: string;
|
|
9102
|
+
tx_hash: string;
|
|
9103
|
+
} : T extends 'get_packet' ? {
|
|
9104
|
+
chain_id: string;
|
|
9105
|
+
tx_hash: string;
|
|
9106
|
+
conn_sn: string;
|
|
9107
|
+
} : never;
|
|
9108
|
+
};
|
|
9109
|
+
|
|
9110
|
+
/**
|
|
9111
|
+
* Types derived from Core SDK specific types
|
|
9112
|
+
* NOTE: common (non Core SDK specific) types should be put in @sodax/types package
|
|
9113
|
+
*/
|
|
9114
|
+
type HubProvider = EvmHubProvider;
|
|
9115
|
+
type RateLimitConfig = {
|
|
9116
|
+
maxAvailable: number;
|
|
9117
|
+
ratePerSecond: number;
|
|
9118
|
+
available: number;
|
|
9119
|
+
};
|
|
9120
|
+
/**
|
|
9121
|
+
* Structural types
|
|
9122
|
+
*/
|
|
9123
|
+
type OptionalRaw<R extends boolean> = {
|
|
9124
|
+
raw?: R;
|
|
9125
|
+
};
|
|
9126
|
+
type OptionalSkipSimulation = {
|
|
9127
|
+
skipSimulation?: boolean;
|
|
9128
|
+
};
|
|
9129
|
+
type OptionalTimeout = {
|
|
9130
|
+
timeout?: number;
|
|
9131
|
+
};
|
|
9132
|
+
type TxHashPair = {
|
|
9133
|
+
srcChainTxHash: string;
|
|
9134
|
+
dstChainTxHash: string;
|
|
9135
|
+
};
|
|
9136
|
+
type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
9137
|
+
tx: TxReturnType<K, Raw>;
|
|
9138
|
+
relayData: RelayExtraData;
|
|
9139
|
+
};
|
|
9140
|
+
|
|
9141
|
+
type DestinationParamsType = RawDestinationParams;
|
|
9142
|
+
|
|
9143
|
+
/**
|
|
9144
|
+
* Raw error body shape returned by the Bound Exchange HTTP API on non-2xx responses.
|
|
9145
|
+
* The human-readable detail typically lives at `error.details` (nested), with
|
|
9146
|
+
* `code` carrying a Bound Exchange-specific identifier (e.g. "2002" insufficientBTCBalance,
|
|
9147
|
+
* "4008" duplicatedPubKey) and `message` an i18n key.
|
|
9148
|
+
*/
|
|
9149
|
+
type RadfiErrorBody = {
|
|
9150
|
+
code?: string;
|
|
9151
|
+
message?: string;
|
|
9152
|
+
details?: string;
|
|
9153
|
+
error?: {
|
|
9154
|
+
details?: string;
|
|
9155
|
+
message?: string;
|
|
9156
|
+
};
|
|
9157
|
+
};
|
|
9158
|
+
/**
|
|
9159
|
+
* Shape of a parsed Bound Exchange JSON response: the {@link RadfiErrorBody} envelope fields plus an
|
|
9160
|
+
* optional, per-call typed `data` payload. Modeled as a superset of `RadfiErrorBody` so a parsed body
|
|
9161
|
+
* can be handed straight to {@link RadfiApiError} on the error path. `data` is optional because Bound
|
|
9162
|
+
* can answer 2xx with a logical-error envelope (no `data`); callers guard before dereferencing it.
|
|
9163
|
+
*/
|
|
9164
|
+
type RadfiResponseEnvelope<T = unknown> = RadfiErrorBody & {
|
|
9165
|
+
data?: T;
|
|
9166
|
+
};
|
|
9167
|
+
/**
|
|
9168
|
+
* Structured error from a Bound Exchange HTTP request. Exposes `status` (HTTP), `code`
|
|
9169
|
+
* (Bound Exchange-specific identifier), and `details` (human-readable) so callers can
|
|
9170
|
+
* discriminate without fragile string-matching on `message`. The raw response
|
|
9171
|
+
* body is preserved on `cause` for structured logging.
|
|
9172
|
+
*/
|
|
9173
|
+
declare class RadfiApiError extends Error {
|
|
9174
|
+
readonly status: number;
|
|
9175
|
+
readonly code?: string;
|
|
9176
|
+
readonly details?: string;
|
|
9177
|
+
readonly cause?: unknown;
|
|
9178
|
+
constructor(status: number, body: RadfiErrorBody, fallback: string);
|
|
9179
|
+
}
|
|
9180
|
+
type RadfiTradingWallet = {
|
|
9181
|
+
tradingAddress: string;
|
|
9182
|
+
userAddress: string;
|
|
9183
|
+
userPublicKey: string;
|
|
9184
|
+
};
|
|
9185
|
+
type RadfiAuthResult = {
|
|
9186
|
+
accessToken: string;
|
|
9187
|
+
refreshToken: string;
|
|
9188
|
+
tradingAddress: string;
|
|
9189
|
+
};
|
|
9190
|
+
type RadfiWalletBalance = {
|
|
9191
|
+
btcSatoshi: bigint;
|
|
9192
|
+
pendingSatoshi: bigint;
|
|
9193
|
+
externalPendingSatoshi: bigint;
|
|
9194
|
+
totalUtxos: number;
|
|
8666
9195
|
};
|
|
8667
9196
|
type RadfiUtxo = {
|
|
8668
9197
|
_id: string;
|
|
@@ -8712,7 +9241,7 @@ declare class RadfiProvider {
|
|
|
8712
9241
|
refreshToken: string;
|
|
8713
9242
|
constructor(config: RadfiConfig);
|
|
8714
9243
|
/**
|
|
8715
|
-
* Authenticate with
|
|
9244
|
+
* Authenticate with Bound Exchange: BIP322-sign a login message, then call the Bound Exchange API.
|
|
8716
9245
|
* Returns accessToken, refreshToken, and tradingAddress.
|
|
8717
9246
|
*/
|
|
8718
9247
|
authenticateWithWallet(walletProvider: IBitcoinWalletProvider, cachedPublicKey?: string): Promise<{
|
|
@@ -8722,8 +9251,8 @@ declare class RadfiProvider {
|
|
|
8722
9251
|
publicKey: string;
|
|
8723
9252
|
}>;
|
|
8724
9253
|
/**
|
|
8725
|
-
* Ensure a valid
|
|
8726
|
-
* If a token exists, validates it via the
|
|
9254
|
+
* Ensure a valid Bound Exchange access token is set on this provider.
|
|
9255
|
+
* If a token exists, validates it via the Bound Exchange API.
|
|
8727
9256
|
* If invalid, tries refreshing with the refresh token first.
|
|
8728
9257
|
* If refresh also fails, falls back to full re-authentication (BIP322 sign).
|
|
8729
9258
|
*/
|
|
@@ -8743,7 +9272,7 @@ declare class RadfiProvider {
|
|
|
8743
9272
|
walletAddress: string;
|
|
8744
9273
|
publicKey: string;
|
|
8745
9274
|
}, accessToken: string): Promise<RadfiTradingWallet>;
|
|
8746
|
-
getTradingWallet(userAddress: string
|
|
9275
|
+
getTradingWallet(userAddress: string): Promise<RadfiTradingWallet>;
|
|
8747
9276
|
getBalance(address: string): Promise<RadfiWalletBalance>;
|
|
8748
9277
|
checkIfTradingWalletExists(userAddress: string): Promise<boolean>;
|
|
8749
9278
|
createWithdrawTransaction(params: {
|
|
@@ -8753,9 +9282,18 @@ declare class RadfiProvider {
|
|
|
8753
9282
|
userAddress: string;
|
|
8754
9283
|
data: string;
|
|
8755
9284
|
}, accessToken: string): Promise<RadfiDepositTxResponse>;
|
|
9285
|
+
/**
|
|
9286
|
+
* Co-sign and broadcast a `sodax-withdraw` deposit via the Bound Exchange API.
|
|
9287
|
+
*
|
|
9288
|
+
* `relayData` ({ address, payload }) is the same `RelayExtraData` the SDK returns from
|
|
9289
|
+
* `createIntent()` / money-market supply etc. It is optional and non-breaking: when supplied,
|
|
9290
|
+
* the Bound Exchange backend persists it so it can auto-resubmit the intent relay if the relay
|
|
9291
|
+
* gets stuck (otherwise a stuck relay eventually refunds instead of completing the swap).
|
|
9292
|
+
*/
|
|
8756
9293
|
requestRadfiSignature(params: {
|
|
8757
9294
|
userAddress: string;
|
|
8758
9295
|
signedBase64Tx: string;
|
|
9296
|
+
relayData?: RelayExtraData;
|
|
8759
9297
|
}, accessToken: string): Promise<string>;
|
|
8760
9298
|
/**
|
|
8761
9299
|
* Fetch expired (or near-expiry) UTXOs for a trading wallet address from UMS API.
|
|
@@ -8765,7 +9303,7 @@ declare class RadfiProvider {
|
|
|
8765
9303
|
pageSize?: number;
|
|
8766
9304
|
}): Promise<RadfiUtxoListResponse>;
|
|
8767
9305
|
/**
|
|
8768
|
-
* Build a renew-utxo transaction via the
|
|
9306
|
+
* Build a renew-utxo transaction via the Bound Exchange API.
|
|
8769
9307
|
* Returns a PSBT that needs to be signed by the user.
|
|
8770
9308
|
*/
|
|
8771
9309
|
buildRenewUtxoTransaction(params: {
|
|
@@ -8773,8 +9311,8 @@ declare class RadfiProvider {
|
|
|
8773
9311
|
txIdVouts: string[];
|
|
8774
9312
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8775
9313
|
/**
|
|
8776
|
-
* Sign and broadcast a renew-utxo transaction via the
|
|
8777
|
-
* The user signs the PSBT first, then
|
|
9314
|
+
* Sign and broadcast a renew-utxo transaction via the Bound Exchange API.
|
|
9315
|
+
* The user signs the PSBT first, then Bound Exchange co-signs and broadcasts.
|
|
8778
9316
|
*/
|
|
8779
9317
|
signAndBroadcastRenewUtxo(params: {
|
|
8780
9318
|
userAddress: string;
|
|
@@ -8791,7 +9329,7 @@ declare class RadfiProvider {
|
|
|
8791
9329
|
withdrawTo: string;
|
|
8792
9330
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8793
9331
|
/**
|
|
8794
|
-
* Sign and broadcast a withdraw transaction via
|
|
9332
|
+
* Sign and broadcast a withdraw transaction via Bound Exchange.
|
|
8795
9333
|
*/
|
|
8796
9334
|
signAndBroadcastWithdraw(params: {
|
|
8797
9335
|
userAddress: string;
|
|
@@ -8806,6 +9344,27 @@ declare class RadfiProvider {
|
|
|
8806
9344
|
tokenId: string;
|
|
8807
9345
|
withdrawTo: string;
|
|
8808
9346
|
}, accessToken: string): Promise<RadfiMaxSpentResponse>;
|
|
9347
|
+
/**
|
|
9348
|
+
* Resolve the bearer credential for an authenticated Bound Exchange call, failing fast when none
|
|
9349
|
+
* is available. A server-side raw-build caller that never ran the interactive sign-in would
|
|
9350
|
+
* otherwise send `Authorization: Bearer ` (empty) and get an opaque 403 from Bound's gateway;
|
|
9351
|
+
* throwing here turns that into an actionable client-side error naming the fix. We deliberately do
|
|
9352
|
+
* NOT validate the token's contents (expiry / scope / signature) — only Bound can, and an invalid
|
|
9353
|
+
* token still surfaces as a legible 401/403 via `parseJsonBody`.
|
|
9354
|
+
*/
|
|
9355
|
+
private resolveAuth;
|
|
9356
|
+
/**
|
|
9357
|
+
* Parse a Bound Exchange response body as JSON defensively.
|
|
9358
|
+
*
|
|
9359
|
+
* Bound (or an upstream gateway / WAF / CDN) can answer a request with an HTML error page
|
|
9360
|
+
* instead of JSON — e.g. an unauthenticated call, a blocked origin, a 404, or a 5xx. Calling
|
|
9361
|
+
* `res.json()` on that throws a cryptic `SyntaxError: Unexpected token '<'` that masks the real
|
|
9362
|
+
* HTTP status and bubbles up as an opaque failure (it surfaced as a `createIntent` /
|
|
9363
|
+
* `INTENT_CREATION_FAILED` "is not valid JSON" error on the Bitcoin raw-tx path). Reading the
|
|
9364
|
+
* body as text first and parsing it ourselves lets us raise a `RadfiApiError` carrying the
|
|
9365
|
+
* actual status code and a body snippet instead.
|
|
9366
|
+
*/
|
|
9367
|
+
private parseJsonBody;
|
|
8809
9368
|
private request;
|
|
8810
9369
|
}
|
|
8811
9370
|
|
|
@@ -8819,20 +9378,33 @@ interface BtcPayload {
|
|
|
8819
9378
|
timestamp: number;
|
|
8820
9379
|
address_type: BtcAddressType;
|
|
8821
9380
|
}
|
|
9381
|
+
/**
|
|
9382
|
+
* Calculate the actual vbytes of an OP_RETURN output given the payload byte length.
|
|
9383
|
+
* Accounts for variable-length pushdata opcodes and script-length varints.
|
|
9384
|
+
*/
|
|
9385
|
+
declare function calcOpReturnOutputVbytes(payloadByteLength: number): number;
|
|
8822
9386
|
/**
|
|
8823
9387
|
* Estimate transaction size in vbytes.
|
|
8824
9388
|
* @param addressType — caller's address type for accurate per-input weight.
|
|
8825
9389
|
* P2PKH ≈ 148 vB, P2SH-P2WPKH ≈ 91 vB, P2WPKH ≈ 68 vB, P2TR ≈ 58 vB.
|
|
8826
9390
|
* Defaults to P2WPKH (68 vB) when omitted.
|
|
9391
|
+
* @param opReturnOutputVbytes — actual OP_RETURN output size in vbytes.
|
|
9392
|
+
* Use calcOpReturnOutputVbytes() when the payload size is known. Defaults to 44 vB (~33-byte payload).
|
|
8827
9393
|
*/
|
|
8828
|
-
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType): number;
|
|
9394
|
+
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType, opReturnOutputVbytes?: number): number;
|
|
8829
9395
|
declare function encodeBtcPayloadToBytes(payload: BtcPayload): string;
|
|
8830
9396
|
/**
|
|
8831
9397
|
* Normalize a signed PSBT to base64 format.
|
|
8832
9398
|
* Unisat/OKX wallets return hex, Xverse returns base64.
|
|
8833
|
-
*
|
|
9399
|
+
* Bound Exchange API expects base64.
|
|
8834
9400
|
*/
|
|
8835
9401
|
declare function normalizePsbtToBase64(signedPsbt: string): string;
|
|
9402
|
+
/**
|
|
9403
|
+
* Normalize a wallet message signature to base64. The intent relay requires the on-demand
|
|
9404
|
+
* withdrawal signature as base64. Browser wallets (UniSat/Xverse/OKX) already return base64; a hex
|
|
9405
|
+
* signature (e.g. a private-key wallet) is encoded. Mirrors `normalizePsbtToBase64`.
|
|
9406
|
+
*/
|
|
9407
|
+
declare function normalizeSignatureToBase64(signature: string): string;
|
|
8836
9408
|
|
|
8837
9409
|
type BitcoinUTXO = {
|
|
8838
9410
|
txid: string;
|
|
@@ -8854,6 +9426,7 @@ interface BitcoinTransactionResult {
|
|
|
8854
9426
|
interface OnDemandBtcPayload {
|
|
8855
9427
|
payload_hex: string;
|
|
8856
9428
|
signature?: string;
|
|
9429
|
+
public_key?: string;
|
|
8857
9430
|
}
|
|
8858
9431
|
declare class BitcoinSpokeService {
|
|
8859
9432
|
private readonly config;
|
|
@@ -8899,7 +9472,7 @@ declare class BitcoinSpokeService {
|
|
|
8899
9472
|
*/
|
|
8900
9473
|
getDeposit(params: GetDepositParams<BitcoinChainKey>): Promise<bigint>;
|
|
8901
9474
|
/**
|
|
8902
|
-
* Fund the
|
|
9475
|
+
* Fund the Bound Exchange trading wallet by sending BTC from the user's personal wallet
|
|
8903
9476
|
*
|
|
8904
9477
|
* @param {bigint} amount - Amount in satoshis to send
|
|
8905
9478
|
* @param {BitcoinSpokeProvider} spokeProvider - The Bitcoin spoke provider (must have signing capability)
|
|
@@ -8920,19 +9493,54 @@ declare class BitcoinSpokeService {
|
|
|
8920
9493
|
sendMessage<Raw extends boolean>(params: SendMessageParams<BitcoinChainKey, Raw> & {
|
|
8921
9494
|
walletMode?: WalletMode;
|
|
8922
9495
|
}): Promise<TxReturnType<BitcoinChainKey, Raw>>;
|
|
9496
|
+
/**
|
|
9497
|
+
* Build the relay submit/poll identity for an on-demand action (borrow/withdraw).
|
|
9498
|
+
*
|
|
9499
|
+
* Bitcoin borrow/withdraw are on-demand: there is no broadcast transaction — the spoke result is
|
|
9500
|
+
* the signed payload JSON produced by {@link encodeWithdrawalData}/{@link sendMessage}. The relay
|
|
9501
|
+
* accepts the submit under the literal `withdraw` tx_hash with the signed payload (as a JSON object)
|
|
9502
|
+
* in `data`, then tracks the resulting packet under a derived id: `od:` + keccak256 of the ASCII
|
|
9503
|
+
* `payload_hex` string (hash the hex characters, not the decoded bytes). Polling must use that
|
|
9504
|
+
* derived id (`pollTxHash`), not `withdraw`.
|
|
9505
|
+
*
|
|
9506
|
+
* @param tx - The JSON-stringified signed payload returned by `sendMessage` / `encodeWithdrawalData`.
|
|
9507
|
+
*/
|
|
9508
|
+
getOnDemandRelayIdentity(tx: string): {
|
|
9509
|
+
srcTxHash: string;
|
|
9510
|
+
data: OnDemandRelayData;
|
|
9511
|
+
pollTxHash: string;
|
|
9512
|
+
};
|
|
8923
9513
|
/**
|
|
8924
9514
|
* Build a priority Bitcoin transaction with proper fee calculation
|
|
8925
9515
|
*/
|
|
8926
9516
|
buildBitcoinTransaction(utxos: BitcoinUTXO[], outputs: Array<{
|
|
8927
9517
|
address: string;
|
|
8928
9518
|
value: number;
|
|
8929
|
-
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number): Promise<Psbt>;
|
|
9519
|
+
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number, opReturnOutputVbytes?: number): Promise<Psbt>;
|
|
8930
9520
|
/**
|
|
8931
9521
|
* Deposit operation - transfer BTC to the asset manager
|
|
8932
9522
|
*/
|
|
8933
|
-
deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw>
|
|
9523
|
+
deposit<Raw extends boolean = false>(params: DepositParams<BitcoinChainKey, Raw>): Promise<TxReturnType<BitcoinChainKey, Raw>>;
|
|
9524
|
+
/**
|
|
9525
|
+
* Sign and submit a TRADING-wallet raw transaction — the Bound-built *unsigned* PSBT returned by
|
|
9526
|
+
* `deposit({ raw: true })` / the Swaps API (`createIntent().tx.data`). Signs it with the wallet
|
|
9527
|
+
* provider's key, then sends it to Bound Exchange to co-sign with the second 2-of-2 key and
|
|
9528
|
+
* broadcast. Returns the broadcast tx id.
|
|
9529
|
+
*
|
|
9530
|
+
* This is the client-side completion of the TRADING deposit flow: the backend builds the PSBT
|
|
9531
|
+
* (it can't broadcast — the user's signature is missing), the client signs here, and Bound
|
|
9532
|
+
* co-signs + broadcasts. `relayData` ({ address, payload }) is the relay identity returned by
|
|
9533
|
+
* `createIntent()`; forwarding it lets Bound auto-resubmit a stuck relay. It is **not** recoverable
|
|
9534
|
+
* from `rawTx` (whose `to` is the asset manager, not the hub wallet), so callers must supply it.
|
|
9535
|
+
*
|
|
9536
|
+
* @throws if the chain is not in `TRADING` wallet mode (raw txs only exist in TRADING mode).
|
|
9537
|
+
*/
|
|
9538
|
+
signAndSubmitRawTransaction(params: {
|
|
9539
|
+
rawTx: BitcoinRawTransaction;
|
|
9540
|
+
walletProvider: IBitcoinWalletProvider;
|
|
9541
|
+
relayData?: RelayExtraData;
|
|
8934
9542
|
accessToken?: string;
|
|
8935
|
-
}): Promise<
|
|
9543
|
+
}): Promise<string>;
|
|
8936
9544
|
/**
|
|
8937
9545
|
* Build deposit PSBT with embedded cross-chain data
|
|
8938
9546
|
*/
|
|
@@ -8941,6 +9549,12 @@ declare class BitcoinSpokeService {
|
|
|
8941
9549
|
* Fetch UTXOs for an address
|
|
8942
9550
|
*/
|
|
8943
9551
|
fetchUTXOs(address: string): Promise<BitcoinUTXO[]>;
|
|
9552
|
+
/**
|
|
9553
|
+
* Returns the set of "txid:vout" outpoints currently being spent by
|
|
9554
|
+
* unconfirmed transactions in the mempool for the given address.
|
|
9555
|
+
* Used to prevent double-spend when building a new PSBT.
|
|
9556
|
+
*/
|
|
9557
|
+
private fetchMempoolSpentOutpoints;
|
|
8944
9558
|
/**
|
|
8945
9559
|
* Fetch raw transaction hex
|
|
8946
9560
|
*/
|
|
@@ -8959,77 +9573,11 @@ declare class BitcoinSpokeService {
|
|
|
8959
9573
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<BitcoinChainKey>): Promise<Result<WaitForTxReceiptReturnType<BitcoinChainKey>>>;
|
|
8960
9574
|
}
|
|
8961
9575
|
|
|
8962
|
-
type RelayExtraData = {
|
|
8963
|
-
address: Hex;
|
|
8964
|
-
payload: Hex;
|
|
8965
|
-
};
|
|
8966
|
-
type IntentDeliveryInfo = {
|
|
8967
|
-
srcChainKey: SpokeChainKey;
|
|
8968
|
-
srcTxHash: string;
|
|
8969
|
-
srcAddress: string;
|
|
8970
|
-
dstChainKey: SpokeChainKey;
|
|
8971
|
-
dstTxHash: string;
|
|
8972
|
-
dstAddress: string;
|
|
8973
|
-
};
|
|
8974
|
-
type WaitUntilIntentExecutedPayload = {
|
|
8975
|
-
intentRelayChainId: string;
|
|
8976
|
-
srcTxHash: string;
|
|
8977
|
-
timeout?: number;
|
|
8978
|
-
apiUrl: HttpUrl;
|
|
8979
|
-
};
|
|
8980
|
-
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
8981
|
-
type IntentRelayRequest<T extends RelayAction> = {
|
|
8982
|
-
action: T;
|
|
8983
|
-
params: T extends 'submit' ? {
|
|
8984
|
-
chain_id: string;
|
|
8985
|
-
tx_hash: string;
|
|
8986
|
-
data?: RelayExtraData;
|
|
8987
|
-
} : T extends 'get_transaction_packets' ? {
|
|
8988
|
-
chain_id: string;
|
|
8989
|
-
tx_hash: string;
|
|
8990
|
-
} : T extends 'get_packet' ? {
|
|
8991
|
-
chain_id: string;
|
|
8992
|
-
tx_hash: string;
|
|
8993
|
-
conn_sn: string;
|
|
8994
|
-
} : never;
|
|
8995
|
-
};
|
|
8996
|
-
|
|
8997
|
-
/**
|
|
8998
|
-
* Types derived from Core SDK specific types
|
|
8999
|
-
* NOTE: common (non Core SDK specific) types should be put in @sodax/types package
|
|
9000
|
-
*/
|
|
9001
|
-
type HubProvider = EvmHubProvider;
|
|
9002
|
-
type RateLimitConfig = {
|
|
9003
|
-
maxAvailable: number;
|
|
9004
|
-
ratePerSecond: number;
|
|
9005
|
-
available: number;
|
|
9006
|
-
};
|
|
9007
|
-
/**
|
|
9008
|
-
* Structural types
|
|
9009
|
-
*/
|
|
9010
|
-
type OptionalRaw<R extends boolean> = {
|
|
9011
|
-
raw?: R;
|
|
9012
|
-
};
|
|
9013
|
-
type OptionalSkipSimulation = {
|
|
9014
|
-
skipSimulation?: boolean;
|
|
9015
|
-
};
|
|
9016
|
-
type OptionalTimeout = {
|
|
9017
|
-
timeout?: number;
|
|
9018
|
-
};
|
|
9019
|
-
type TxHashPair = {
|
|
9020
|
-
srcChainTxHash: string;
|
|
9021
|
-
dstChainTxHash: string;
|
|
9022
|
-
};
|
|
9023
|
-
type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
9024
|
-
tx: TxReturnType<K, Raw>;
|
|
9025
|
-
relayData: RelayExtraData;
|
|
9026
|
-
};
|
|
9027
|
-
|
|
9028
|
-
type DestinationParamsType = RawDestinationParams;
|
|
9029
|
-
|
|
9030
9576
|
type QueryResponse = string | number | boolean | object | undefined;
|
|
9031
9577
|
type CallResponse = string | number | object | bigint | boolean;
|
|
9032
9578
|
declare const NEAR_DEFAULT_GAS: bigint;
|
|
9579
|
+
/** NEP-141 default storage bond for a one-time `storage_deposit` registration (0.00125 NEAR). */
|
|
9580
|
+
declare const NEAR_STORAGE_DEPOSIT: bigint;
|
|
9033
9581
|
declare class NearSpokeService {
|
|
9034
9582
|
private readonly config;
|
|
9035
9583
|
readonly rpcProvider: JsonRpcProvider;
|
|
@@ -9060,6 +9608,34 @@ declare class NearSpokeService {
|
|
|
9060
9608
|
* @returns {Promise<bigint>} The balance of the token.
|
|
9061
9609
|
*/
|
|
9062
9610
|
getDeposit(params: GetDepositParams<NearChainKey>): Promise<bigint>;
|
|
9611
|
+
/**
|
|
9612
|
+
* Whether `accountId` is storage-registered on a NEP-141 `token` contract. NEP-141 requires an
|
|
9613
|
+
* account to pay a one-time storage bond before it can receive (hold a balance of) the token, so
|
|
9614
|
+
* this gates any leg that delivers a token to a user on NEAR (swap output on NEAR, bridge into
|
|
9615
|
+
* NEAR, money-market borrow/withdraw to NEAR).
|
|
9616
|
+
*
|
|
9617
|
+
* Native NEAR is not a NEP-141 token and has no storage registration, so this returns `true` for
|
|
9618
|
+
* the native token. The view goes through {@link queryContract}, i.e. the configurable RPC from
|
|
9619
|
+
* chain config — a custom `rpcUrl` passed to the SDK is honoured.
|
|
9620
|
+
*/
|
|
9621
|
+
isStorageRegistered(token: string, accountId: string): Promise<boolean>;
|
|
9622
|
+
/**
|
|
9623
|
+
* Build (and, unless `raw`, submit) a NEP-141 `storage_deposit` registration for `accountId` on
|
|
9624
|
+
* the `token` contract. Call this when {@link isStorageRegistered} is `false` before a token is
|
|
9625
|
+
* delivered to the account on NEAR.
|
|
9626
|
+
*
|
|
9627
|
+
* Native NEAR has no storage registration — passing the native token throws.
|
|
9628
|
+
*
|
|
9629
|
+
* @param params.deposit Storage bond to attach; defaults to {@link NEAR_STORAGE_DEPOSIT}
|
|
9630
|
+
* (0.00125 NEAR). Override per token if its `storage_balance_bounds.min` differs.
|
|
9631
|
+
*/
|
|
9632
|
+
registerStorage<Raw extends boolean = false>(params: {
|
|
9633
|
+
token: string;
|
|
9634
|
+
accountId: string;
|
|
9635
|
+
walletProvider: INearWalletProvider;
|
|
9636
|
+
deposit?: bigint;
|
|
9637
|
+
raw?: Raw;
|
|
9638
|
+
}): Promise<TxReturnType<NearChainKey, Raw>>;
|
|
9063
9639
|
/**
|
|
9064
9640
|
* Sends a message to the hub chain.
|
|
9065
9641
|
* @param {SendMessageParams} params - Includes dstChainKey, the chain key of the hub chain.
|
|
@@ -9210,6 +9786,11 @@ declare class StellarSpokeService {
|
|
|
9210
9786
|
* @returns {Promise<TxReturnType<StellarChainKey, R>>} A promise that resolves to the transaction hash or raw transaction.
|
|
9211
9787
|
*/
|
|
9212
9788
|
deposit<R extends boolean = false>(params: DepositParams<StellarChainKey, R>): Promise<TxReturnType<StellarChainKey, R>>;
|
|
9789
|
+
/**
|
|
9790
|
+
* Whether a token requires a trustline. Native XLM and legacy bnUSD are
|
|
9791
|
+
* exempt and therefore need no subentry reserve.
|
|
9792
|
+
*/
|
|
9793
|
+
requiresTrustline(token: string): boolean;
|
|
9213
9794
|
/**
|
|
9214
9795
|
* Check if the user has sufficient trustline established for the token.
|
|
9215
9796
|
* @param token - The token address to check the trustline for.
|
|
@@ -9279,7 +9860,12 @@ declare class SolanaSpokeService {
|
|
|
9279
9860
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<SolanaChainKey>): Promise<Result<WaitForTxReceiptReturnType<SolanaChainKey>>>;
|
|
9280
9861
|
static getBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<number>;
|
|
9281
9862
|
static getTokenAccountBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
9282
|
-
|
|
9863
|
+
/**
|
|
9864
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
9865
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
9866
|
+
*/
|
|
9867
|
+
static getMintTokenProgramId(connection: Connection$1, mint: PublicKey): Promise<PublicKey>;
|
|
9868
|
+
static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey, tokenProgramId?: PublicKey): Promise<SolanaBase58PublicKey>;
|
|
9283
9869
|
static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
|
|
9284
9870
|
}
|
|
9285
9871
|
|
|
@@ -9366,14 +9952,6 @@ interface State {
|
|
|
9366
9952
|
hub_chain_id: string;
|
|
9367
9953
|
owner: string;
|
|
9368
9954
|
}
|
|
9369
|
-
/**
|
|
9370
|
-
* InjectiveSpokeService provides methods for interacting with the Injective spoke chain,
|
|
9371
|
-
* specifically for managing token deposits and transfers between the spoke chain and hub chain.
|
|
9372
|
-
* It handles the cross-chain communication and token bridging functionality, allowing users to:
|
|
9373
|
-
* - Deposit tokens from Injective to the hub chain
|
|
9374
|
-
* - Check token balances on the spoke chain
|
|
9375
|
-
* - Transfer tokens with custom data payloads
|
|
9376
|
-
*/
|
|
9377
9955
|
declare class InjectiveSpokeService {
|
|
9378
9956
|
private readonly config;
|
|
9379
9957
|
readonly chainGrpcWasmApi: ChainGrpcWasmApi;
|
|
@@ -9381,7 +9959,10 @@ declare class InjectiveSpokeService {
|
|
|
9381
9959
|
readonly endpoints: NetworkEndpoints;
|
|
9382
9960
|
private readonly pollingIntervalMs;
|
|
9383
9961
|
private readonly maxTimeoutMs;
|
|
9962
|
+
private readonly gasPrice;
|
|
9384
9963
|
constructor(config: ConfigService);
|
|
9964
|
+
/** Parse a chain-config gas price like `"500000000inj"` into its numeric price and denom. */
|
|
9965
|
+
private parseGasPrice;
|
|
9385
9966
|
/**
|
|
9386
9967
|
* Estimate the gas for a transaction.
|
|
9387
9968
|
* @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
@@ -9405,7 +9986,7 @@ declare class InjectiveSpokeService {
|
|
|
9405
9986
|
* @returns {Promise<bigint>} The balance of the token.
|
|
9406
9987
|
*/
|
|
9407
9988
|
getDeposit(params: GetDepositParams<InjectiveChainKey>): Promise<bigint>;
|
|
9408
|
-
getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string): Promise<InjectiveRawTransaction>;
|
|
9989
|
+
getRawTransaction(chainId: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string, funds?: InjectiveCoin[]): Promise<InjectiveRawTransaction>;
|
|
9409
9990
|
getState(chainId: InjectiveChainKey): Promise<State>;
|
|
9410
9991
|
/**
|
|
9411
9992
|
* Sends a message to the hub chain.
|
|
@@ -9546,7 +10127,6 @@ declare class SpokeService {
|
|
|
9546
10127
|
waitForTxReceipt<C extends SpokeChainKey = SpokeChainKey>(params: WaitForTxReceiptParams<C>): Promise<Result<WaitForTxReceiptReturnType<C>>>;
|
|
9547
10128
|
}
|
|
9548
10129
|
|
|
9549
|
-
type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
|
|
9550
10130
|
/**
|
|
9551
10131
|
* Stable error message strings emitted by relay-layer helpers ({@link submitTransaction},
|
|
9552
10132
|
* {@link relayTxAndWaitPacket}) on failure.
|
|
@@ -9601,18 +10181,6 @@ type SubmitTxResponse = {
|
|
|
9601
10181
|
success: boolean;
|
|
9602
10182
|
message: string;
|
|
9603
10183
|
};
|
|
9604
|
-
type PacketData = {
|
|
9605
|
-
src_chain_id: number;
|
|
9606
|
-
src_tx_hash: string;
|
|
9607
|
-
src_address: string;
|
|
9608
|
-
status: RelayTxStatus;
|
|
9609
|
-
dst_chain_id: number;
|
|
9610
|
-
conn_sn: number;
|
|
9611
|
-
dst_address: string;
|
|
9612
|
-
dst_tx_hash: string;
|
|
9613
|
-
signatures: string[];
|
|
9614
|
-
payload: string;
|
|
9615
|
-
};
|
|
9616
10184
|
type GetTransactionPacketsResponse = {
|
|
9617
10185
|
success: boolean;
|
|
9618
10186
|
data: PacketData[];
|
|
@@ -9629,10 +10197,11 @@ type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResp
|
|
|
9629
10197
|
type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
|
|
9630
10198
|
type RelayAndWaitParams = {
|
|
9631
10199
|
srcTxHash: string;
|
|
9632
|
-
data: RelayExtraData;
|
|
10200
|
+
data: RelayExtraData | OnDemandRelayData;
|
|
9633
10201
|
chainKey: SpokeChainKey;
|
|
9634
10202
|
relayerApiEndpoint: HttpUrl;
|
|
9635
10203
|
timeout: number | undefined;
|
|
10204
|
+
pollTxHash?: string;
|
|
9636
10205
|
};
|
|
9637
10206
|
/**
|
|
9638
10207
|
* Submits a transaction to the intent relay service.
|
|
@@ -9648,6 +10217,8 @@ type RelayAndWaitParams = {
|
|
|
9648
10217
|
* requires coordinated updates across all callers — prefer adding a new code to
|
|
9649
10218
|
* {@link RELAY_ERROR_CODES} over renaming.
|
|
9650
10219
|
*
|
|
10220
|
+
* NOTE: if transaction was already relayed, post request will return { success: true, message: 'Transaction registered' }
|
|
10221
|
+
*
|
|
9651
10222
|
* @param payload - The request payload containing the 'submit' action type and parameters.
|
|
9652
10223
|
* @param apiUrl - The URL of the intent relay service.
|
|
9653
10224
|
* @returns The response from the intent relay service.
|
|
@@ -11523,8 +12094,6 @@ declare function isSpokeApproveParamsStellar<K extends SpokeChainKey, Raw extend
|
|
|
11523
12094
|
srcChainKey: StellarChainKey;
|
|
11524
12095
|
}>;
|
|
11525
12096
|
declare function isRawDestinationParams(value: unknown): value is RawDestinationParams;
|
|
11526
|
-
declare function isSubmitSwapTxResponse(value: unknown): value is SubmitSwapTxResponse;
|
|
11527
|
-
declare function isSubmitSwapTxStatusResponse(value: unknown): value is SubmitSwapTxStatusResponse;
|
|
11528
12097
|
declare function isBitcoinWalletProviderType(wp: IWalletProvider): wp is IBitcoinWalletProvider;
|
|
11529
12098
|
declare function isEvmWalletProviderType(walletProvider: IWalletProvider): walletProvider is IEvmWalletProvider;
|
|
11530
12099
|
declare function isStellarWalletProviderType(walletProvider: IWalletProvider): walletProvider is IStellarWalletProvider;
|
|
@@ -11534,6 +12103,20 @@ declare function isOptionalStellarWalletProviderType(walletProvider: IWalletProv
|
|
|
11534
12103
|
declare function isUndefinedOrValidWalletProviderForChainKey<K extends SpokeChainKey>(chainKey: K, walletProvider: IWalletProvider | undefined): walletProvider is GetWalletProviderType<K> | undefined;
|
|
11535
12104
|
declare function isOptionalBitcoinWalletProviderType(walletProvider: IWalletProvider | undefined): walletProvider is IBitcoinWalletProvider | undefined;
|
|
11536
12105
|
|
|
12106
|
+
/**
|
|
12107
|
+
* Default logger. Mirrors the SDK's historical `console.*` behavior so existing consumers
|
|
12108
|
+
* see no change when they don't pass a `logger`. `data` is appended only when present to keep
|
|
12109
|
+
* single-arg log lines unchanged.
|
|
12110
|
+
*/
|
|
12111
|
+
declare const consoleLogger: SodaxLogger;
|
|
12112
|
+
/** No-op logger. Drops every SDK log line. Selected via `new Sodax({ logger: 'silent' })`. */
|
|
12113
|
+
declare const silentLogger: SodaxLogger;
|
|
12114
|
+
/**
|
|
12115
|
+
* Resolve a {@link SodaxLoggerOption} (a preset name, a custom logger, or `undefined`) into a
|
|
12116
|
+
* concrete {@link SodaxLogger}. Defaults to {@link consoleLogger} so logging is on unless opted out.
|
|
12117
|
+
*/
|
|
12118
|
+
declare function resolveLogger(option: SodaxLoggerOption | undefined): SodaxLogger;
|
|
12119
|
+
|
|
11537
12120
|
/** Swap-module narrow error types. */
|
|
11538
12121
|
|
|
11539
12122
|
declare const swapInvariant: FeatureInvariant;
|
|
@@ -11547,7 +12130,7 @@ type SwapCreateIntentErrorCode = CreateIntentErrorCode;
|
|
|
11547
12130
|
* that handles both `postExecution` and `swap` errors expecting the same union.
|
|
11548
12131
|
*/
|
|
11549
12132
|
type PostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
11550
|
-
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'>;
|
|
12133
|
+
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'>;
|
|
11551
12134
|
type SwapCreateIntentError = SodaxError<SwapCreateIntentErrorCode>;
|
|
11552
12135
|
type PostExecutionError = SodaxError<PostExecutionErrorCode>;
|
|
11553
12136
|
type SwapError = SodaxError<SwapErrorCode>;
|
|
@@ -11570,8 +12153,8 @@ type CreateIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
|
11570
12153
|
intent: Intent & FeeAmount;
|
|
11571
12154
|
relayData: RelayExtraData;
|
|
11572
12155
|
};
|
|
11573
|
-
type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>>;
|
|
11574
|
-
type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>>;
|
|
12156
|
+
type SwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>, SwapExtras<K>>;
|
|
12157
|
+
type LimitOrderActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateLimitOrderParams<K>, SwapExtras<K>>;
|
|
11575
12158
|
/**
|
|
11576
12159
|
* Params for `cancelIntent`.
|
|
11577
12160
|
* Because `Intent.srcChain` is an `IntentRelayChainId` (bigint) whose literal type cannot
|
|
@@ -11585,10 +12168,17 @@ type CancelIntentParams<K extends SpokeChainKey> = {
|
|
|
11585
12168
|
timeout?: number;
|
|
11586
12169
|
};
|
|
11587
12170
|
type CancelIntentActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CancelIntentParams<K>>;
|
|
12171
|
+
type GetQuoteParams = SolverIntentQuoteRequest & {
|
|
12172
|
+
/** Optional per-call override of the configured swap partner fee. Falls back to config when omitted. */
|
|
12173
|
+
partnerFee?: PartnerFee;
|
|
12174
|
+
};
|
|
11588
12175
|
type SwapServiceConstructorParams = {
|
|
11589
12176
|
config: ConfigService;
|
|
11590
12177
|
spoke: SpokeService;
|
|
11591
12178
|
hubProvider: HubProvider;
|
|
12179
|
+
backendApi: BackendApiService;
|
|
12180
|
+
/** Opt-in backend submit-tx 2-step flow (from `SodaxOptions.swapsOptions.useBackendSubmitTx`). Default off. */
|
|
12181
|
+
useBackendSubmitTx?: boolean;
|
|
11592
12182
|
};
|
|
11593
12183
|
/**
|
|
11594
12184
|
* Main entry point for the SODAX swap feature.
|
|
@@ -11613,7 +12203,9 @@ declare class SwapService {
|
|
|
11613
12203
|
readonly solver: SolverConfig;
|
|
11614
12204
|
readonly partnerFee: PartnerFee | undefined;
|
|
11615
12205
|
readonly relayerApiEndpoint: HttpUrl;
|
|
11616
|
-
|
|
12206
|
+
readonly backendApi: BackendApiService;
|
|
12207
|
+
readonly useBackendSubmitTx: boolean;
|
|
12208
|
+
constructor({ config, hubProvider, spoke, backendApi, useBackendSubmitTx }: SwapServiceConstructorParams);
|
|
11617
12209
|
/**
|
|
11618
12210
|
* Estimates the gas cost for a raw (unsigned) transaction on a spoke chain.
|
|
11619
12211
|
*
|
|
@@ -11624,10 +12216,13 @@ declare class SwapService {
|
|
|
11624
12216
|
/**
|
|
11625
12217
|
* Requests a price quote from the solver API for a given token pair and amount.
|
|
11626
12218
|
*
|
|
11627
|
-
* Adjusts `payload.amount` by the
|
|
11628
|
-
*
|
|
12219
|
+
* Adjusts `payload.amount` by the partner fee before forwarding to the solver, so the returned
|
|
12220
|
+
* `quoted_amount` reflects the net output the user actually receives. Pass `partnerFee` to match
|
|
12221
|
+
* a per-action override supplied to `createIntent` (`extras.partnerFee`); omit it to use the
|
|
12222
|
+
* configured swap fee.
|
|
11629
12223
|
*
|
|
11630
|
-
* @param payload -
|
|
12224
|
+
* @param payload - The solver quote request, optionally carrying a per-call `partnerFee` override
|
|
12225
|
+
* (defaults to the configured swap partner fee). `partnerFee` is stripped before forwarding.
|
|
11631
12226
|
* @returns A `Result` containing `{ quoted_amount: bigint }` on success, or a
|
|
11632
12227
|
* `SolverErrorResponse` (with a `SolverIntentErrorCode`) on failure.
|
|
11633
12228
|
*
|
|
@@ -11642,7 +12237,7 @@ declare class SwapService {
|
|
|
11642
12237
|
* });
|
|
11643
12238
|
* if (response.ok) console.log('Quoted amount:', response.value.quoted_amount);
|
|
11644
12239
|
*/
|
|
11645
|
-
getQuote(payload:
|
|
12240
|
+
getQuote(payload: GetQuoteParams): Promise<Result<SolverIntentQuoteResponse, SolverErrorResponse>>;
|
|
11646
12241
|
/**
|
|
11647
12242
|
* Calculates the partner fee that will be deducted from the given input amount.
|
|
11648
12243
|
*
|
|
@@ -11704,14 +12299,22 @@ declare class SwapService {
|
|
|
11704
12299
|
/**
|
|
11705
12300
|
* Executes a full end-to-end cross-chain swap.
|
|
11706
12301
|
*
|
|
11707
|
-
* Orchestrates the complete swap lifecycle
|
|
11708
|
-
*
|
|
11709
|
-
*
|
|
11710
|
-
*
|
|
11711
|
-
*
|
|
11712
|
-
*
|
|
11713
|
-
*
|
|
11714
|
-
*
|
|
12302
|
+
* Orchestrates the complete swap lifecycle. `createIntent` first submits the intent transaction on
|
|
12303
|
+
* the source spoke chain; completion then runs via one of two paths, both bounded by a single
|
|
12304
|
+
* shared `timeout` budget:
|
|
12305
|
+
*
|
|
12306
|
+
* - **Client-side (default), {@link fallbackSwapSteps}:** verifies the spoke tx landed on-chain,
|
|
12307
|
+
* relays it to the hub (Sonic) and waits for the packet — skipped when `srcChainKey` is the hub,
|
|
12308
|
+
* where the spoke tx already is the hub tx — then calls `postExecution` to notify the solver,
|
|
12309
|
+
* triggering it to fill the intent.
|
|
12310
|
+
* - **Backend 2-step (opt-in via `swapsOptions.useBackendSubmitTx`), {@link submitTx}:** hands the
|
|
12311
|
+
* broadcast tx to the swaps API, which verifies, relays and post-executes server-side, then polls
|
|
12312
|
+
* for completion. On ANY non-success it transparently falls back to the client-side path above —
|
|
12313
|
+
* safe because re-relaying / re-posting an already-processed swap is idempotent (no double-fill).
|
|
12314
|
+
*
|
|
12315
|
+
* @param _params - Swap action params including intent parameters, wallet provider, and an optional
|
|
12316
|
+
* `timeout` — the single shared budget for the whole completion flow (relay/poll plus any
|
|
12317
|
+
* fallback), so total wall-clock never exceeds it.
|
|
11715
12318
|
* @returns A `Result<SwapResponse, SwapError>`. On success:
|
|
11716
12319
|
* - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
|
|
11717
12320
|
* - `intent` — the on-chain intent object that was created.
|
|
@@ -11732,6 +12335,29 @@ declare class SwapService {
|
|
|
11732
12335
|
* - `UNKNOWN` — uncategorized fallback.
|
|
11733
12336
|
*/
|
|
11734
12337
|
swap<K extends SpokeChainKey>(_params: SwapActionParams<K, false>): Promise<Result<SwapResponse, SwapError>>;
|
|
12338
|
+
/**
|
|
12339
|
+
* Client-side swap completion (the default path): relay the broadcast intent tx to the hub — or
|
|
12340
|
+
* use it directly when the source IS the hub — then notify the solver via post-execution and
|
|
12341
|
+
* build the {@link SwapResponse}. Extracted verbatim from `swap()` so the opt-in backend 2-step
|
|
12342
|
+
* path ({@link submitTx}) can fall back to it on any non-success.
|
|
12343
|
+
*/
|
|
12344
|
+
private fallbackSwapSteps;
|
|
12345
|
+
/**
|
|
12346
|
+
* Backend 2-step swap path (opt-in via `swapsOptions.useBackendSubmitTx`): hand the broadcast
|
|
12347
|
+
* intent tx to the swaps API (`POST /swaps/submit-tx`); the backend relays + post-executes
|
|
12348
|
+
* server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs the same
|
|
12349
|
+
* {@link SwapResponse} the client-side path returns (`result.dstIntentTxHash` → delivery info,
|
|
12350
|
+
* `result.intent_hash` → solver response).
|
|
12351
|
+
*
|
|
12352
|
+
* Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, terminal `failed` /
|
|
12353
|
+
* abandoned, or poll timeout) so `swap()` falls back to {@link fallbackSwapSteps}.
|
|
12354
|
+
*
|
|
12355
|
+
* Falling back is safe: re-relaying / re-posting an already-processed swap is idempotent — the
|
|
12356
|
+
* relay dedups and returns the existing `executed` packet, and the solver re-affirms the intent
|
|
12357
|
+
* (no double-fill). Verified live by `e2e-tests/e2e-relay.test.ts`. Polling stops at
|
|
12358
|
+
* `deadline - reserve` so the fallback keeps a guaranteed slice of the shared `swap` budget.
|
|
12359
|
+
*/
|
|
12360
|
+
private submitTx;
|
|
11735
12361
|
/**
|
|
11736
12362
|
* Checks whether the relevant spender contract is already approved to spend the input token amount.
|
|
11737
12363
|
*
|
|
@@ -11775,7 +12401,7 @@ declare class SwapService {
|
|
|
11775
12401
|
* - `raw: false` — broadcasts the transaction; `walletProvider` is required and must match `K`.
|
|
11776
12402
|
*
|
|
11777
12403
|
* Validates tokens and chain keys against the active `ConfigService` before constructing the
|
|
11778
|
-
* intent. Bitcoin source chains require an additional
|
|
12404
|
+
* intent. Bitcoin source chains require an additional Bound Exchange access token step.
|
|
11779
12405
|
*
|
|
11780
12406
|
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
11781
12407
|
* and optional `skipSimulation` flag.
|
|
@@ -11922,6 +12548,11 @@ declare class SwapService {
|
|
|
11922
12548
|
* Use this after `getStatus` returns `SolverIntentStatusCode.SOLVED (3)` to obtain the
|
|
11923
12549
|
* destination-chain transaction hash from `packet.dst_tx_hash`.
|
|
11924
12550
|
*
|
|
12551
|
+
* A single solver fill tx emits multiple relay packets sharing the same `src_tx_hash`. The
|
|
12552
|
+
* user-facing `IntentFilled` delivery is the packet whose payload targets the hub intents
|
|
12553
|
+
* contract; `selectSolvedIntentPacket` disambiguates so the returned `dst_tx_hash` is the
|
|
12554
|
+
* destination delivery tx rather than an internal hop.
|
|
12555
|
+
*
|
|
11925
12556
|
* @param chainId - The destination spoke chain key (where output tokens are delivered).
|
|
11926
12557
|
* @param fillTxHash - The solver's fill transaction hash, obtained from `getStatus.fill_tx_hash`.
|
|
11927
12558
|
* @param timeout - Poll timeout in milliseconds. Defaults to `DEFAULT_RELAY_TX_TIMEOUT` (120 s).
|
|
@@ -11979,13 +12610,13 @@ declare class SwapService {
|
|
|
11979
12610
|
declare const migrationInvariant: FeatureInvariant;
|
|
11980
12611
|
type MigrationOp = 'migratebnUSD' | 'migrateIcxToSoda' | 'revertMigrateSodaToIcx' | 'migrateBaln';
|
|
11981
12612
|
type MigrationDirection = 'forward' | 'reverse';
|
|
11982
|
-
type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12613
|
+
type MigrateOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
11983
12614
|
type RevertMigrationOrchestrationErrorCode = Exclude<MigrateOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
|
|
11984
12615
|
type MigrationCreateIntentErrorCode = CreateIntentErrorCode;
|
|
11985
12616
|
type MigrationApproveErrorCode = ApproveErrorCode;
|
|
11986
12617
|
type MigrationAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
11987
12618
|
type MigrationLookupErrorCode = LookupErrorCode;
|
|
11988
|
-
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'>;
|
|
12619
|
+
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'>;
|
|
11989
12620
|
type MigrateOrchestrationError = SodaxError<MigrateOrchestrationErrorCode>;
|
|
11990
12621
|
type RevertMigrationOrchestrationError = SodaxError<RevertMigrationOrchestrationErrorCode>;
|
|
11991
12622
|
type MigrationCreateIntentError = SodaxError<MigrationCreateIntentErrorCode>;
|
|
@@ -12386,7 +13017,7 @@ declare class BalnSwapService {
|
|
|
12386
13017
|
* @param user - The EVM address of the user to query locks for.
|
|
12387
13018
|
* @returns An immutable array of `DetailedLock` objects, one per active lock.
|
|
12388
13019
|
*/
|
|
12389
|
-
getDetailedUserLocks(publicClient: PublicClient
|
|
13020
|
+
getDetailedUserLocks(publicClient: PublicClient, user: Address$1): Promise<readonly DetailedLock[]>;
|
|
12390
13021
|
/**
|
|
12391
13022
|
* Encodes a single `swap` call on the BALN swap contract.
|
|
12392
13023
|
*
|
|
@@ -12671,12 +13302,12 @@ declare class MigrationService {
|
|
|
12671
13302
|
|
|
12672
13303
|
declare const bridgeInvariant: FeatureInvariant;
|
|
12673
13304
|
type BridgeAction = 'bridge';
|
|
12674
|
-
type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
13305
|
+
type BridgeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12675
13306
|
type BridgeCreateIntentErrorCode = CreateIntentErrorCode;
|
|
12676
13307
|
type BridgeApproveErrorCode = ApproveErrorCode;
|
|
12677
13308
|
type BridgeAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
12678
13309
|
type BridgeLookupErrorCode = LookupErrorCode;
|
|
12679
|
-
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'>;
|
|
13310
|
+
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'>;
|
|
12680
13311
|
type BridgeOrchestrationError = SodaxError<BridgeOrchestrationErrorCode>;
|
|
12681
13312
|
type BridgeCreateIntentError = SodaxError<BridgeCreateIntentErrorCode>;
|
|
12682
13313
|
type BridgeApproveError = SodaxError<BridgeApproveErrorCode>;
|
|
@@ -12813,7 +13444,7 @@ declare class BridgeService {
|
|
|
12813
13444
|
* transaction simulation or batching). When `raw` is `false`, signs and submits the deposit
|
|
12814
13445
|
* transaction via the provided wallet provider.
|
|
12815
13446
|
*
|
|
12816
|
-
* Bitcoin is only supported with `raw: false` because it requires the
|
|
13447
|
+
* Bitcoin is only supported with `raw: false` because it requires the Bound Exchange trading wallet
|
|
12817
13448
|
* derivation flow.
|
|
12818
13449
|
*
|
|
12819
13450
|
* @param _params - Bridge parameters including source/destination chain keys, token addresses,
|
|
@@ -12823,6 +13454,16 @@ declare class BridgeService {
|
|
|
12823
13454
|
* contains the hub wallet address and encoded hub execution payload needed for relay.
|
|
12824
13455
|
*/
|
|
12825
13456
|
createBridgeIntent<K extends SpokeChainKey, Raw extends boolean>(_params: BridgeParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, BridgeCreateIntentError>>;
|
|
13457
|
+
/**
|
|
13458
|
+
* Resolves a bridge endpoint's {@link XToken} descriptor from a chain key + token address.
|
|
13459
|
+
*
|
|
13460
|
+
* Spoke endpoints (and hub-native tokens such as USDC/WETH/S whose on-chain address equals their
|
|
13461
|
+
* hub asset) resolve by original asset address. On the hub a caller may instead hold a hub asset
|
|
13462
|
+
* that has no spoke-token entry under the hub chain — e.g. a partner BTC fee held as the BTC hub
|
|
13463
|
+
* asset, whose only spoke-token entry lives on Bitcoin. Resolve those by hub-asset address so the
|
|
13464
|
+
* Sonic-sourced "withdraw directly" bridge can find the matching vault/decimals.
|
|
13465
|
+
*/
|
|
13466
|
+
private resolveBridgeEndpointToken;
|
|
12826
13467
|
/**
|
|
12827
13468
|
* Encodes the hub-side execution payload for a bridge operation.
|
|
12828
13469
|
*
|
|
@@ -12939,7 +13580,7 @@ declare const stakingInvariant: FeatureInvariant;
|
|
|
12939
13580
|
/** The 5 user-facing staking operations. Carried on `context.action`. */
|
|
12940
13581
|
type StakingActionType = 'stake' | 'unstake' | 'instantUnstake' | 'claim' | 'cancelUnstake';
|
|
12941
13582
|
/** Codes the `stake` orchestrator can return — only one that calls `verifyTxHash`. */
|
|
12942
|
-
type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
13583
|
+
type StakeOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
12943
13584
|
/** Codes the 4 non-stake orchestrators (`unstake`/`instantUnstake`/`claim`/`cancelUnstake`) share. */
|
|
12944
13585
|
type StakingOrchestrationErrorCode = Exclude<StakeOrchestrationErrorCode, 'TX_VERIFICATION_FAILED'>;
|
|
12945
13586
|
type StakingCreateIntentErrorCode = CreateIntentErrorCode;
|
|
@@ -13939,7 +14580,7 @@ declare class ClService {
|
|
|
13939
14580
|
* @returns `Result<PoolRewardConfig>` — on success, contains the reward token address,
|
|
13940
14581
|
* reward rate per second, and the timestamp of the last position-affecting action.
|
|
13941
14582
|
*/
|
|
13942
|
-
getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient
|
|
14583
|
+
getPoolRewardConfig(poolKey: PoolKey, publicClient: PublicClient): Promise<Result<PoolRewardConfig>>;
|
|
13943
14584
|
/**
|
|
13944
14585
|
* Build and submit the spoke-side transaction that harvests hook rewards for a position.
|
|
13945
14586
|
*
|
|
@@ -14008,7 +14649,7 @@ declare class ClService {
|
|
|
14008
14649
|
* fee tiers, token metadata with optional StatAToken enrichment, and optional
|
|
14009
14650
|
* reward configuration. `isActive` is `true` when `sqrtPriceX96 > 0`.
|
|
14010
14651
|
*/
|
|
14011
|
-
getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient
|
|
14652
|
+
getPoolData(poolKey: PoolKey<'CL'>, publicClient: PublicClient): Promise<Result<PoolData>>;
|
|
14012
14653
|
/**
|
|
14013
14654
|
* Fetch full details for a concentrated-liquidity position NFT.
|
|
14014
14655
|
*
|
|
@@ -14025,7 +14666,7 @@ declare class ClService {
|
|
|
14025
14666
|
* current token amounts, tick-boundary prices, unclaimed fees, and optional
|
|
14026
14667
|
* underlying amounts for StatAToken pools.
|
|
14027
14668
|
*/
|
|
14028
|
-
getPositionInfo(tokenId: bigint, publicClient: PublicClient
|
|
14669
|
+
getPositionInfo(tokenId: bigint, publicClient: PublicClient): Promise<Result<ClPositionInfo>>;
|
|
14029
14670
|
/**
|
|
14030
14671
|
* Compute the maximum liquidity achievable given both token input amounts.
|
|
14031
14672
|
*
|
|
@@ -14156,7 +14797,7 @@ declare const mmInvariant: FeatureInvariant;
|
|
|
14156
14797
|
type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
|
|
14157
14798
|
type MoneyMarketCreateIntentErrorCode = CreateIntentErrorCode;
|
|
14158
14799
|
/** Codes any of the 4 orchestrators (`supply`/`borrow`/`withdraw`/`repay`) can return. */
|
|
14159
|
-
type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
14800
|
+
type MoneyMarketOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
14160
14801
|
type MoneyMarketApproveErrorCode = ApproveErrorCode;
|
|
14161
14802
|
type MoneyMarketAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
14162
14803
|
type MoneyMarketGasEstimationErrorCode = GasEstimationErrorCode;
|
|
@@ -15304,6 +15945,15 @@ declare class MoneyMarketService {
|
|
|
15304
15945
|
* trigger the hub-side execution via {@link relayTxAndWaitPacket}.
|
|
15305
15946
|
*/
|
|
15306
15947
|
createSupplyIntent<K extends SpokeChainKey, Raw extends boolean>(_params: MoneyMarketSupplyActionParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, MoneyMarketCreateIntentError>>;
|
|
15948
|
+
/**
|
|
15949
|
+
* Build the relay submit/poll identity for a money-market borrow/withdraw.
|
|
15950
|
+
*
|
|
15951
|
+
* Bitcoin borrow/withdraw are on-demand: the spoke result is a signed payload JSON that the relay
|
|
15952
|
+
* submits under the literal "withdraw" tx_hash and tracks under a derived `od:<hash>` poll id
|
|
15953
|
+
* (see {@link BitcoinSpokeService.getOnDemandRelayIdentity}). Every other chain relays and polls by
|
|
15954
|
+
* its real spoke tx hash, so `pollTxHash` is undefined and `srcChainTxHash` stays the spoke tx.
|
|
15955
|
+
*/
|
|
15956
|
+
private buildRelayIdentity;
|
|
15307
15957
|
/**
|
|
15308
15958
|
* Borrow tokens from the money market lending pool and wait for the cross-chain relay to
|
|
15309
15959
|
* deliver the funds to the destination address.
|
|
@@ -15593,7 +16243,19 @@ type PartnerFeeClaimSwapParams = {
|
|
|
15593
16243
|
timeout?: number;
|
|
15594
16244
|
};
|
|
15595
16245
|
type PartnerFeeClaimSwapAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimSwapParams>;
|
|
15596
|
-
type
|
|
16246
|
+
type PartnerFeeClaimCancelParams = {
|
|
16247
|
+
srcChainKey: HubChainKey;
|
|
16248
|
+
srcAddress: Address$1;
|
|
16249
|
+
fromToken: Address$1;
|
|
16250
|
+
toToken: Address$1;
|
|
16251
|
+
};
|
|
16252
|
+
type PartnerFeeClaimCancelAction<K extends SpokeChainKey, Raw extends boolean> = SpokeExecActionParams<K, Raw, PartnerFeeClaimCancelParams>;
|
|
16253
|
+
type GetUserIntentParams = {
|
|
16254
|
+
user: Address$1;
|
|
16255
|
+
fromToken: Address$1;
|
|
16256
|
+
toToken: Address$1;
|
|
16257
|
+
};
|
|
16258
|
+
type PartnerFeeClaimServiceConstructorParams = {
|
|
15597
16259
|
config: ConfigService;
|
|
15598
16260
|
hubProvider: HubProvider;
|
|
15599
16261
|
spoke: SpokeService;
|
|
@@ -15727,6 +16389,11 @@ declare class PartnerFeeClaimService {
|
|
|
15727
16389
|
* This is the low-level building block. Use `swap` for the full flow that also waits for
|
|
15728
16390
|
* the solver to execute the intent.
|
|
15729
16391
|
*
|
|
16392
|
+
* Guards against same-token intents: if the configured output token equals `fromToken` the solver
|
|
16393
|
+
* cannot fill the swap, so the call is rejected with `VALIDATION_FAILED` before any transaction is
|
|
16394
|
+
* built. The guard fails closed — if the preference lookup fails the call returns that error rather
|
|
16395
|
+
* than submitting an intent that may become unfillable.
|
|
16396
|
+
*
|
|
15730
16397
|
* @param _params - Action descriptor containing:
|
|
15731
16398
|
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
15732
16399
|
* - `params.srcAddress` — partner's EVM address; also used as the intent creator.
|
|
@@ -15757,10 +16424,59 @@ declare class PartnerFeeClaimService {
|
|
|
15757
16424
|
*
|
|
15758
16425
|
* On failure the `error` is tagged:
|
|
15759
16426
|
* - `WAIT_INTENT_AUTO_SWAP_FAILED` — transaction was submitted but receipt polling failed.
|
|
15760
|
-
* - Error from `createIntentAutoSwap` — if the initial submission failed
|
|
16427
|
+
* - Error from `createIntentAutoSwap` — if the initial submission failed, including
|
|
16428
|
+
* `VALIDATION_FAILED` when the output token equals the fee token (same-token guard) or the
|
|
16429
|
+
* preference lookup that backs the guard fails.
|
|
15761
16430
|
* - Error from `SolverApiService.postExecution` — if the solver notification failed.
|
|
15762
16431
|
*/
|
|
15763
16432
|
swap(_params: PartnerFeeClaimSwapAction<HubChainKey, false>): Promise<Result<IntentAutoSwapResult>>;
|
|
16433
|
+
/**
|
|
16434
|
+
* Cancels a partner fee-claim auto-swap intent and refunds the input token to the partner.
|
|
16435
|
+
*
|
|
16436
|
+
* This targets the ProtocolIntents contract's own `cancelIntent(fromToken, toToken)`, which is
|
|
16437
|
+
* the only authorized cancel path for partner auto-swap intents: the intent's `creator` is the
|
|
16438
|
+
* ProtocolIntents contract (not the partner), so the generic `SwapService.cancelIntent` reverts
|
|
16439
|
+
* with `Unauthorized()`. ProtocolIntents looks up the caller's intent for the token pair, cancels
|
|
16440
|
+
* it in the main intents contract (as the creator), and transfers the locked `inputAmount` back
|
|
16441
|
+
* to the partner (`msg.sender`).
|
|
16442
|
+
*
|
|
16443
|
+
* Use this to recover funds stuck in an unfillable intent — most commonly a same-token claim
|
|
16444
|
+
* (`fromToken === toToken`) the solver refused to fill (see the guard in {@link swap}).
|
|
16445
|
+
*
|
|
16446
|
+
* @param _params - Action descriptor containing:
|
|
16447
|
+
* - `params.srcChainKey` — must be the hub chain key (Sonic).
|
|
16448
|
+
* - `params.srcAddress` — the partner's EVM address; must match the intent's owner.
|
|
16449
|
+
* - `params.fromToken` — the stuck intent's input (fee) token, hub-chain address.
|
|
16450
|
+
* - `params.toToken` — the stuck intent's output token, hub-chain address.
|
|
16451
|
+
* - `raw` — when `true`, returns the unsigned transaction object instead of submitting it.
|
|
16452
|
+
* - `walletProvider` — required when `raw` is `false`; must be an EVM wallet provider.
|
|
16453
|
+
* @returns A `Result` containing the submitted transaction hash (`raw: false`) or the unsigned
|
|
16454
|
+
* raw transaction (`raw: true`).
|
|
16455
|
+
*/
|
|
16456
|
+
cancelIntent<Raw extends boolean>(_params: PartnerFeeClaimCancelAction<HubChainKey, Raw>): Promise<Result<TxReturnType<HubChainKey, Raw>>>;
|
|
16457
|
+
/**
|
|
16458
|
+
* Returns the stored intent hash for a partner's `(user, fromToken, toToken)` token pair.
|
|
16459
|
+
*
|
|
16460
|
+
* A non-zero hash means an auto-swap intent currently exists for that pair (e.g. an unfilled
|
|
16461
|
+
* same-token claim) and can be cancelled via {@link cancelIntent}. A zero hash
|
|
16462
|
+
* (`0x000…0`) means there is no open intent for the pair.
|
|
16463
|
+
*
|
|
16464
|
+
* @param params.user - The partner's EVM address on Sonic.
|
|
16465
|
+
* @param params.fromToken - Input (fee) token, hub-chain address.
|
|
16466
|
+
* @param params.toToken - Output token, hub-chain address.
|
|
16467
|
+
* @returns A `Result` containing the intent hash, or an `Error` tagged `LOOKUP_FAILED`.
|
|
16468
|
+
*/
|
|
16469
|
+
getUserIntent({ user, fromToken, toToken }: GetUserIntentParams): Promise<Result<Hex, Error>>;
|
|
16470
|
+
/**
|
|
16471
|
+
* Reads the full {@link Intent} details for a stored intent hash from the ProtocolIntents contract.
|
|
16472
|
+
*
|
|
16473
|
+
* Useful for displaying a stuck intent before cancelling it — e.g. the locked `inputAmount` and
|
|
16474
|
+
* `inputToken`. Pair with {@link getUserIntent} to resolve the hash from a token pair.
|
|
16475
|
+
*
|
|
16476
|
+
* @param intentHash - The intent hash (from {@link getUserIntent}).
|
|
16477
|
+
* @returns A `Result` containing the `Intent`, or an `Error` tagged `LOOKUP_FAILED`.
|
|
16478
|
+
*/
|
|
16479
|
+
getIntentDetails(intentHash: Hex): Promise<Result<Intent, Error>>;
|
|
15764
16480
|
}
|
|
15765
16481
|
|
|
15766
16482
|
type PartnerServiceConfig = {
|
|
@@ -15884,6 +16600,671 @@ declare class RecoveryService {
|
|
|
15884
16600
|
withdrawHubAsset<K extends SpokeChainKey, Raw extends boolean>(_params: WithdrawHubAssetAction<K, Raw>): Promise<Result<TxReturnType<K, Raw>>>;
|
|
15885
16601
|
}
|
|
15886
16602
|
|
|
16603
|
+
/**
|
|
16604
|
+
* leverageYield module narrow error types.
|
|
16605
|
+
*
|
|
16606
|
+
* The service owns the full vault-swap lifecycle: `deposit` / `withdraw` build
|
|
16607
|
+
* `CreateIntentParams`, `createVaultIntent` submits the intent on the source spoke chain,
|
|
16608
|
+
* and `vaultSwap` orchestrates the end-to-end flow (create → verify → relay → notify
|
|
16609
|
+
* solver). `approve` / `isAllowanceValid` manage the underlying-asset allowance on Sonic,
|
|
16610
|
+
* and the read methods query on-chain state.
|
|
16611
|
+
*
|
|
16612
|
+
* User-facing actions discriminated by `context.action`: `'deposit' | 'withdraw' |
|
|
16613
|
+
* 'approve' | 'vaultSwap'`. Read-only methods emit `LOOKUP_FAILED` partitioned by
|
|
16614
|
+
* `context.method`. Relay/verify codes appear only on `vaultSwap` — `createVaultIntent`
|
|
16615
|
+
* alone emits the create-intent subset.
|
|
16616
|
+
*/
|
|
16617
|
+
|
|
16618
|
+
declare const leverageYieldInvariant: FeatureInvariant;
|
|
16619
|
+
type LeverageYieldAction = 'deposit' | 'withdraw' | 'approve' | 'allowanceCheck' | 'vaultSwap';
|
|
16620
|
+
type LeverageYieldCreateIntentErrorCode = CreateIntentErrorCode;
|
|
16621
|
+
type LeverageYieldApproveErrorCode = ApproveErrorCode;
|
|
16622
|
+
type LeverageYieldAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
16623
|
+
type LeverageYieldLookupErrorCode = LookupErrorCode;
|
|
16624
|
+
/**
|
|
16625
|
+
* Codes returnable by the solver-notify step inside `vaultSwap`. Mirrors the swap
|
|
16626
|
+
* domain's `PostExecutionErrorCode` — duplicated deliberately so the leverage-yield
|
|
16627
|
+
* error surface stands alone (see `vaultSwap`).
|
|
16628
|
+
*/
|
|
16629
|
+
type LeverageYieldPostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
16630
|
+
/**
|
|
16631
|
+
* Codes returnable by the end-to-end `vaultSwap` orchestrator: the create-intent subset
|
|
16632
|
+
* plus verify, relay and solver-notify codes. Mirrors the swap domain's `SwapErrorCode`.
|
|
16633
|
+
*/
|
|
16634
|
+
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'>;
|
|
16635
|
+
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'>;
|
|
16636
|
+
type LeverageYieldCreateIntentError = SodaxError<LeverageYieldCreateIntentErrorCode>;
|
|
16637
|
+
type LeverageYieldApproveError = SodaxError<LeverageYieldApproveErrorCode>;
|
|
16638
|
+
type LeverageYieldAllowanceCheckError = SodaxError<LeverageYieldAllowanceCheckErrorCode>;
|
|
16639
|
+
type LeverageYieldLookupError = SodaxError<LeverageYieldLookupErrorCode>;
|
|
16640
|
+
type LeverageYieldPostExecutionError = SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16641
|
+
type LeverageYieldSwapError = SodaxError<LeverageYieldSwapErrorCode>;
|
|
16642
|
+
type LeverageYieldError = SodaxError<LeverageYieldErrorCode>;
|
|
16643
|
+
declare const isLeverageYieldCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
|
|
16644
|
+
declare const isLeverageYieldApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
|
|
16645
|
+
declare const isLeverageYieldAllowanceCheckError: (e: unknown) => e is SodaxError<AllowanceCheckErrorCode>;
|
|
16646
|
+
declare const isLeverageYieldLookupError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
16647
|
+
declare const isLeverageYieldPostExecutionError: (e: unknown) => e is SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16648
|
+
declare const isLeverageYieldSwapError: (e: unknown) => e is SodaxError<LeverageYieldSwapErrorCode>;
|
|
16649
|
+
declare const isLeverageYieldError: (e: unknown) => e is SodaxError<LeverageYieldErrorCode>;
|
|
16650
|
+
|
|
16651
|
+
/**
|
|
16652
|
+
* Leveraged-position snapshot from the vault's non-standard `getPositionDetails()`.
|
|
16653
|
+
* Field scales (mirroring the AAVE conventions the vault inherits):
|
|
16654
|
+
*/
|
|
16655
|
+
type LeverageYieldPosition = {
|
|
16656
|
+
/** Collateral supplied to the AAVE pool, in vault-asset units (18 decimals). */
|
|
16657
|
+
collateral: bigint;
|
|
16658
|
+
/** Variable debt borrowed against the collateral, in vault-asset units (18 decimals). */
|
|
16659
|
+
debt: bigint;
|
|
16660
|
+
/** Current loan-to-value in basis points (out of `10_000`; e.g. `8_500` = 85%). */
|
|
16661
|
+
ltv: bigint;
|
|
16662
|
+
/** AAVE health factor in WAD (1e18); below `1e18` implies liquidation risk, `type(uint256).max` = no debt. */
|
|
16663
|
+
healthFactor: bigint;
|
|
16664
|
+
/** Asset held by the vault but not yet supplied to the pool, in vault-asset units (18 decimals). */
|
|
16665
|
+
idleAsset: bigint;
|
|
16666
|
+
};
|
|
16667
|
+
/**
|
|
16668
|
+
* Output of {@link LeverageYieldService.getApr}. All rate fields are in RAY (1e27 = 100%)
|
|
16669
|
+
* matching the AAVE convention — divide by `RAY = 10n ** 27n` for the decimal form.
|
|
16670
|
+
*
|
|
16671
|
+
* `netAprRay` is the headline number a UI shows: net APR earned by a depositor at the
|
|
16672
|
+
* vault's `targetLTV`. It's a STEADY-STATE APR, not realised APY — assumes the AAVE rates
|
|
16673
|
+
* stay constant and the vault holds at `targetLTV` continuously. Realised APY in practice
|
|
16674
|
+
* depends on tick cadence, rate volatility, and the spread between supplyApr and borrowApr.
|
|
16675
|
+
*
|
|
16676
|
+
* The math:
|
|
16677
|
+
* ```
|
|
16678
|
+
* leverageMultiplier = targetLTV / (1 - targetLTV) // e.g. 0.85 / 0.15 = 5.667x
|
|
16679
|
+
* netAprRay = supplyAprRay + leverageMultiplier × (supplyAprRay - borrowAprRay)
|
|
16680
|
+
* ```
|
|
16681
|
+
* Equivalent to the geometric-series limit of recursive borrow → swap → supply at the
|
|
16682
|
+
* vault's target LTV. When `supplyApr > borrowApr` the leverage adds yield; when the
|
|
16683
|
+
* spread inverts the loop is a net cost and `netAprRay` goes negative.
|
|
16684
|
+
*/
|
|
16685
|
+
type LeverageYieldApr = {
|
|
16686
|
+
/** AAVE supply rate of the vault's `asset` (sodaWEETH-style), in RAY. */
|
|
16687
|
+
supplyAprRay: bigint;
|
|
16688
|
+
/** AAVE variable borrow rate of the vault's `borrowToken` (sodaETH-style), in RAY. */
|
|
16689
|
+
borrowAprRay: bigint;
|
|
16690
|
+
/** Target LTV in basis points, as read from `vault.targetLTV()`. */
|
|
16691
|
+
targetLtvBps: bigint;
|
|
16692
|
+
/**
|
|
16693
|
+
* Leverage multiplier ×1e18 (e.g. 5.667x is `5_666_666_666_666_666_667n`). Caller can
|
|
16694
|
+
* divide by `10n ** 18n` for the decimal form.
|
|
16695
|
+
*/
|
|
16696
|
+
leverageMultiplierWad: bigint;
|
|
16697
|
+
/** Net APR earned by a depositor at `targetLtvBps`, in RAY. Can be negative. */
|
|
16698
|
+
netAprRay: bigint;
|
|
16699
|
+
};
|
|
16700
|
+
/**
|
|
16701
|
+
* Off-chain LSD staking-APR snapshot for a leverage-yield vault's underlying asset.
|
|
16702
|
+
* Returned by {@link LeverageYieldService.getLsdApr} and embedded in
|
|
16703
|
+
* {@link LeverageYieldEffectiveApr}.
|
|
16704
|
+
*/
|
|
16705
|
+
type LeverageYieldLsdApr = {
|
|
16706
|
+
/** LSD staking APR in RAY (1e27 = 100%). Zero when the vault has no configured LSD source. */
|
|
16707
|
+
aprRay: bigint;
|
|
16708
|
+
/** Human-readable provider label, e.g. `'Lido (stETH)'` (suffixed with `(fallback)` on error). */
|
|
16709
|
+
label: string;
|
|
16710
|
+
/**
|
|
16711
|
+
* `true` when this value came from the hardcoded `fallbackAprPct` rather than a live
|
|
16712
|
+
* fetch — either because the provider has no live endpoint (`manual`), the network
|
|
16713
|
+
* call failed, or the vault has no LSD source configured. UIs should label the value
|
|
16714
|
+
* as an estimate in this state.
|
|
16715
|
+
*/
|
|
16716
|
+
stale: boolean;
|
|
16717
|
+
};
|
|
16718
|
+
/**
|
|
16719
|
+
* Combined AAVE + LSD APR view — extends {@link LeverageYieldApr} with the LSD staking
|
|
16720
|
+
* yield folded into the supply side. Returned by {@link LeverageYieldService.getEffectiveApr}.
|
|
16721
|
+
*
|
|
16722
|
+
* The `netAprRay` inherited from {@link LeverageYieldApr} is the **AAVE-only** number —
|
|
16723
|
+
* the negative-spread case the SDK historically reported. `effectiveNetAprRay` is the
|
|
16724
|
+
* honest one for LSD-backed strategies because it includes the LSD's native staking yield,
|
|
16725
|
+
* which is the dominant component for these vaults.
|
|
16726
|
+
*/
|
|
16727
|
+
type LeverageYieldEffectiveApr = LeverageYieldApr & {
|
|
16728
|
+
/** LSD staking APR snapshot used to compute the effective rates. */
|
|
16729
|
+
lsdApr: LeverageYieldLsdApr;
|
|
16730
|
+
/** `supplyAprRay + lsdApr.aprRay`, in RAY — the yield the supply side actually earns. */
|
|
16731
|
+
effectiveSupplyAprRay: bigint;
|
|
16732
|
+
/**
|
|
16733
|
+
* `effectiveSupplyAprRay + leverage × (effectiveSupplyAprRay − borrowAprRay)`, in RAY.
|
|
16734
|
+
* The headline number a UI should display.
|
|
16735
|
+
*/
|
|
16736
|
+
effectiveNetAprRay: bigint;
|
|
16737
|
+
};
|
|
16738
|
+
/**
|
|
16739
|
+
* Builds the swap payload for a swap-style leverage-yield deposit — swapping any
|
|
16740
|
+
* solver-supported `inputToken` on `srcChainKey` into the vault's lsoda* share token,
|
|
16741
|
+
* delivered to the user's hub wallet on Sonic. Spread the result into `swaps.swap()`.
|
|
16742
|
+
*/
|
|
16743
|
+
type LeverageYieldSwapDepositParams = {
|
|
16744
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16745
|
+
vault: Address;
|
|
16746
|
+
/** Spoke chain the user holds `inputToken` on and signs from. */
|
|
16747
|
+
srcChainKey: SpokeChainKey;
|
|
16748
|
+
/** User's EOA on `srcChainKey`. */
|
|
16749
|
+
srcAddress: string;
|
|
16750
|
+
/** Spoke-side token the user pays in. */
|
|
16751
|
+
inputToken: string;
|
|
16752
|
+
/** Amount of `inputToken` to swap (input-token decimals). */
|
|
16753
|
+
inputAmount: bigint;
|
|
16754
|
+
/** Minimum acceptable lsoda* output (18 decimals). Slippage already applied. */
|
|
16755
|
+
minOutputAmount: bigint;
|
|
16756
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16757
|
+
deadline?: bigint;
|
|
16758
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16759
|
+
solver?: Address;
|
|
16760
|
+
/**
|
|
16761
|
+
* Partner fee for this deposit, carried on the payload as the swap layer's per-intent
|
|
16762
|
+
* fee override. Defaults to the effective swap fee (`config.swapPartnerFee` = the `swaps`
|
|
16763
|
+
* override if set, else the global `fee`).
|
|
16764
|
+
*/
|
|
16765
|
+
partnerFee?: PartnerFee;
|
|
16766
|
+
};
|
|
16767
|
+
/**
|
|
16768
|
+
* Builds the swap payload for a swap-style leverage-yield withdraw — swapping the vault's
|
|
16769
|
+
* lsoda* shares (held in the user's hub wallet) back into any solver-supported token on
|
|
16770
|
+
* any chain. The payload carries `hubWalletSwap: true`; spread it into `swaps.swap()`,
|
|
16771
|
+
* which authorises the hub wallet via `Connection.sendMessage`.
|
|
16772
|
+
*/
|
|
16773
|
+
type LeverageYieldSwapWithdrawParams = {
|
|
16774
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16775
|
+
vault: Address;
|
|
16776
|
+
/** Spoke chain the user signs the `sendMessage` from (drives hub-wallet derivation). */
|
|
16777
|
+
srcChainKey: SpokeChainKey;
|
|
16778
|
+
/** User's EOA on `srcChainKey`. */
|
|
16779
|
+
srcAddress: string;
|
|
16780
|
+
/** Output chain — where the solver delivers the swapped-back token. */
|
|
16781
|
+
dstChainKey: SpokeChainKey;
|
|
16782
|
+
/** Output spoke-side token address. */
|
|
16783
|
+
outputToken: string;
|
|
16784
|
+
/** Amount of lsoda* shares to swap (18 decimals). */
|
|
16785
|
+
inputAmount: bigint;
|
|
16786
|
+
/** Minimum acceptable output (output-token decimals). Slippage already applied. */
|
|
16787
|
+
minOutputAmount: bigint;
|
|
16788
|
+
/** Recipient on `dstChainKey`. Defaults to `srcAddress`. */
|
|
16789
|
+
recipient?: string;
|
|
16790
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16791
|
+
deadline?: bigint;
|
|
16792
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16793
|
+
solver?: Address;
|
|
16794
|
+
};
|
|
16795
|
+
/**
|
|
16796
|
+
* Action-shaped swap payload built by {@link LeverageYieldService.deposit} /
|
|
16797
|
+
* {@link LeverageYieldService.withdraw}. Spread it into
|
|
16798
|
+
* {@link LeverageYieldService.vaultSwap} (or {@link LeverageYieldService.createVaultIntent})
|
|
16799
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16800
|
+
* `withdraw` sets `hubWalletSwap: true` so the swap spends the lsoda* held in the
|
|
16801
|
+
* user's hub wallet.
|
|
16802
|
+
*/
|
|
16803
|
+
type LeverageYieldSwapPayload = {
|
|
16804
|
+
params: CreateIntentParams;
|
|
16805
|
+
hubWalletSwap?: true;
|
|
16806
|
+
/** Per-intent partner-fee override (deposit only). */
|
|
16807
|
+
partnerFee?: PartnerFee;
|
|
16808
|
+
};
|
|
16809
|
+
/**
|
|
16810
|
+
* Exec-mode params for {@link LeverageYieldService.createVaultIntent} /
|
|
16811
|
+
* {@link LeverageYieldService.vaultSwap}: `walletProvider` is required and K-narrowed
|
|
16812
|
+
* (`raw: true` returns unsigned tx data instead). The two vault-specific execution
|
|
16813
|
+
* modifiers live HERE — on the leverage-yield action wrapper, never on the generic swap
|
|
16814
|
+
* surface:
|
|
16815
|
+
* - `hubWalletSwap` marks `params.inputToken` as a hub-chain token already sitting in the
|
|
16816
|
+
* user's hub wallet — `srcChainKey` is then the chain the user *signs* on, and the
|
|
16817
|
+
* intent is created by authorising the hub wallet via a `Connection.sendMessage`
|
|
16818
|
+
* instead of a spoke-side AssetManager deposit.
|
|
16819
|
+
* - `partnerFee` overrides the effective swap fee (`config.swapPartnerFee`) for this
|
|
16820
|
+
* intent only.
|
|
16821
|
+
*/
|
|
16822
|
+
type VaultSwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>> & {
|
|
16823
|
+
hubWalletSwap?: boolean;
|
|
16824
|
+
partnerFee?: PartnerFee;
|
|
16825
|
+
};
|
|
16826
|
+
/**
|
|
16827
|
+
* Success value of {@link LeverageYieldService.createVaultIntent}. Mirrors the swap
|
|
16828
|
+
* domain's `CreateIntentResult` — duplicated deliberately so the leverage-yield surface
|
|
16829
|
+
* stands alone.
|
|
16830
|
+
*/
|
|
16831
|
+
type CreateVaultIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
16832
|
+
tx: TxReturnType<K, Raw>;
|
|
16833
|
+
intent: Intent & FeeAmount;
|
|
16834
|
+
relayData: RelayExtraData;
|
|
16835
|
+
};
|
|
16836
|
+
/**
|
|
16837
|
+
* Success value of {@link LeverageYieldService.vaultSwap}. Mirrors the swap domain's
|
|
16838
|
+
* `SwapResponse` — duplicated deliberately so the leverage-yield surface stands alone.
|
|
16839
|
+
*/
|
|
16840
|
+
type VaultSwapResponse = {
|
|
16841
|
+
solverExecutionResponse: SolverExecutionResponse;
|
|
16842
|
+
intent: Intent;
|
|
16843
|
+
intentDeliveryInfo: IntentDeliveryInfo;
|
|
16844
|
+
};
|
|
16845
|
+
type LeverageYieldApproveParams<R extends boolean> = {
|
|
16846
|
+
vault: Address;
|
|
16847
|
+
/** Amount of the vault's underlying asset to approve. */
|
|
16848
|
+
amount: bigint;
|
|
16849
|
+
walletProvider: IEvmWalletProvider;
|
|
16850
|
+
raw?: R;
|
|
16851
|
+
};
|
|
16852
|
+
type LeverageYieldAllowanceParams = {
|
|
16853
|
+
vault: Address;
|
|
16854
|
+
amount: bigint;
|
|
16855
|
+
owner: Address;
|
|
16856
|
+
};
|
|
16857
|
+
type LeverageYieldServiceConstructorParams = {
|
|
16858
|
+
hubProvider: HubProvider;
|
|
16859
|
+
config: ConfigService;
|
|
16860
|
+
spoke: SpokeService;
|
|
16861
|
+
};
|
|
16862
|
+
/**
|
|
16863
|
+
* Treats leverage-yield ERC-4626 vault shares (lsoda* tokens) as solver-tradeable tokens:
|
|
16864
|
+
* deposits and withdrawals are intent-based swaps the service executes itself via
|
|
16865
|
+
* `vaultSwap()` — the generic swap surface stays untouched by vault concerns.
|
|
16866
|
+
*
|
|
16867
|
+
* Methods:
|
|
16868
|
+
* - `deposit` / `withdraw` — build a {@link LeverageYieldSwapPayload} for a swap-style deposit
|
|
16869
|
+
* (any token → lsoda*) and withdraw (lsoda* → any token); spread the result into
|
|
16870
|
+
* `vaultSwap()`. `withdraw` sets `hubWalletSwap: true` so the vault swap spends the lsoda*
|
|
16871
|
+
* held in the user's hub wallet via a `Connection.sendMessage`.
|
|
16872
|
+
* - `createVaultIntent` / `vaultSwap` / `notifySolver` — leverage-yield copies of the swap
|
|
16873
|
+
* domain's `createIntent` / `swap()` / `postExecution` (duplicated deliberately — the vault
|
|
16874
|
+
* execution modifiers `hubWalletSwap` and per-intent `partnerFee` live here, not on the swap
|
|
16875
|
+
* domain). `createVaultIntent` submits the intent tx on the source spoke chain; `vaultSwap`
|
|
16876
|
+
* orchestrates the full create → verify → relay → notify-solver lifecycle; `notifySolver` is
|
|
16877
|
+
* the standalone notify step, public so callers driving the relay themselves (after a
|
|
16878
|
+
* `createVaultIntent`) can complete the flow.
|
|
16879
|
+
* - `approve` / `isAllowanceValid` — Sonic-direct allowance management for the vault's
|
|
16880
|
+
* underlying asset (sodaWEETH-style).
|
|
16881
|
+
* - `getPosition` / `getApr` / `getEffectiveApr` / `getLsdApr` / `getMaxWithdraw` /
|
|
16882
|
+
* `getMaxWithdrawForUser` / `getShareBalance` / `getShareBalanceForUser` /
|
|
16883
|
+
* `getTotalAssets` / `previewDeposit` / `previewWithdraw` / `previewRedeem` — reads.
|
|
16884
|
+
* Use `getEffectiveApr` for the honest LSD-aware APR; `getApr` reports the AAVE-only
|
|
16885
|
+
* spread and goes negative when the LSD's native staking yield is the alpha source.
|
|
16886
|
+
* - `listVaults` / `getVault` / `getVaultByAddress` — registry lookups.
|
|
16887
|
+
*/
|
|
16888
|
+
declare class LeverageYieldService {
|
|
16889
|
+
private readonly hubProvider;
|
|
16890
|
+
private readonly config;
|
|
16891
|
+
private readonly spoke;
|
|
16892
|
+
constructor({ hubProvider, config, spoke }: LeverageYieldServiceConstructorParams);
|
|
16893
|
+
/** Returns the static registry of known leverage-yield vaults. */
|
|
16894
|
+
listVaults(): readonly LeverageYieldVault[];
|
|
16895
|
+
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
16896
|
+
getVault(name: string): LeverageYieldVault | undefined;
|
|
16897
|
+
/**
|
|
16898
|
+
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
16899
|
+
* Returns `undefined` when the address isn't in the registry.
|
|
16900
|
+
*/
|
|
16901
|
+
getVaultByAddress(address: Address): LeverageYieldVault | undefined;
|
|
16902
|
+
/**
|
|
16903
|
+
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
16904
|
+
* derives a default from the hub-chain (Sonic) block timestamp plus
|
|
16905
|
+
* {@link INTENT_DEADLINE_BUFFER_SECONDS}. The deadline is enforced on-chain against the hub
|
|
16906
|
+
* block time, so the default is anchored to that block — never the client clock, which can
|
|
16907
|
+
* drift and produce an already-expired or over-extended deadline.
|
|
16908
|
+
*
|
|
16909
|
+
* Returns a {@link Result}: a `getBlock` RPC outage is a read failure, surfaced as
|
|
16910
|
+
* `LOOKUP_FAILED` (`method: 'resolveDeadline'`) rather than masquerading as an intent-build
|
|
16911
|
+
* failure. The `deposit` / `withdraw` callers forward it verbatim.
|
|
16912
|
+
*/
|
|
16913
|
+
private resolveDeadline;
|
|
16914
|
+
/**
|
|
16915
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield deposit (any token → lsoda*).
|
|
16916
|
+
* The lsoda* output is delivered to the user's hub wallet on Sonic so a later
|
|
16917
|
+
* {@link LeverageYieldService.withdraw} can swap it back. Spread the result into
|
|
16918
|
+
* {@link LeverageYieldService.vaultSwap}: `vaultSwap({ ...payload, walletProvider })`.
|
|
16919
|
+
* An optional `partnerFee` is forwarded on the payload as the per-intent fee override.
|
|
16920
|
+
*
|
|
16921
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16922
|
+
* destination token (`token_dst`) — vault shares are solver-tradeable, so the generic swap
|
|
16923
|
+
* quote applies; then subtract your slippage tolerance.
|
|
16924
|
+
*/
|
|
16925
|
+
deposit(params: LeverageYieldSwapDepositParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16926
|
+
/**
|
|
16927
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield withdraw (lsoda* → any
|
|
16928
|
+
* token). The payload carries `hubWalletSwap: true` — {@link LeverageYieldService.vaultSwap}
|
|
16929
|
+
* then spends the lsoda* held in the user's hub wallet by authorising it via a
|
|
16930
|
+
* `Connection.sendMessage` the user signs on `srcChainKey`. Wrapped in a {@link Result} for
|
|
16931
|
+
* a call shape uniform with {@link LeverageYieldService.deposit}; async because the default
|
|
16932
|
+
* `deadline` is read from the hub block timestamp.
|
|
16933
|
+
*
|
|
16934
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16935
|
+
* source token (`token_src`) — vault shares are solver-tradeable, so the generic swap quote
|
|
16936
|
+
* applies; then subtract your slippage tolerance.
|
|
16937
|
+
*/
|
|
16938
|
+
withdraw(params: LeverageYieldSwapWithdrawParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16939
|
+
/**
|
|
16940
|
+
* Creates a vault swap intent on the user's source spoke chain without submitting it to
|
|
16941
|
+
* the solver. Leverage-yield copy of the swap domain's `createIntent`, specialised for
|
|
16942
|
+
* vault flows — duplicated deliberately so the vault-specific execution modifiers
|
|
16943
|
+
* (`hubWalletSwap`, per-intent `partnerFee`) stay off the generic swap surface.
|
|
16944
|
+
*
|
|
16945
|
+
* Use {@link LeverageYieldService.vaultSwap} for the full end-to-end flow
|
|
16946
|
+
* (create → relay → notify solver); use this directly when you need the raw transaction
|
|
16947
|
+
* or drive the relay yourself (e.g. the backend submit-tx path). To complete a manual flow,
|
|
16948
|
+
* relay the returned `relayData` (the shared `relayTxAndWaitPacket` helper) and then call
|
|
16949
|
+
* {@link LeverageYieldService.notifySolver} with the hub-side intent tx hash.
|
|
16950
|
+
*
|
|
16951
|
+
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
16952
|
+
* and optional `skipSimulation` / `hubWalletSwap` / `partnerFee`.
|
|
16953
|
+
* @returns A `Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>`.
|
|
16954
|
+
* On success contains:
|
|
16955
|
+
* - `tx` — chain-specific tx hash (executed) or raw tx data (raw mode).
|
|
16956
|
+
* - `intent` — the fully constructed `Intent` object augmented with `feeAmount`.
|
|
16957
|
+
* - `relayData` — `{ address, payload }` needed to submit the intent to the relayer.
|
|
16958
|
+
*
|
|
16959
|
+
* On failure `result.error` is a SodaxError with `VALIDATION_FAILED` (invariant
|
|
16960
|
+
* precondition), `INTENT_CREATION_FAILED` (spoke-side creation/deposit failed) or
|
|
16961
|
+
* `UNKNOWN` (defensive fallback).
|
|
16962
|
+
*/
|
|
16963
|
+
createVaultIntent<K extends SpokeChainKey, Raw extends boolean>(_params: VaultSwapActionParams<K, Raw>): Promise<Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>>;
|
|
16964
|
+
/**
|
|
16965
|
+
* Executes a full end-to-end leverage-yield vault swap (deposit or withdraw).
|
|
16966
|
+
* Leverage-yield copy of the swap domain's `swap()` orchestrator:
|
|
16967
|
+
* 1. Calls {@link LeverageYieldService.createVaultIntent} to submit the intent
|
|
16968
|
+
* transaction on the source spoke chain.
|
|
16969
|
+
* 2. Verifies the spoke transaction landed on-chain.
|
|
16970
|
+
* 3. For non-hub source chains: submits the spoke tx to the relayer and waits for the
|
|
16971
|
+
* relay packet to land on the hub (Sonic). Skipped when `srcChainKey` is the hub.
|
|
16972
|
+
* 4. Notifies the solver, triggering it to fill the intent.
|
|
16973
|
+
*
|
|
16974
|
+
* Spread a {@link LeverageYieldSwapPayload} from `deposit` / `withdraw` into this method
|
|
16975
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16976
|
+
*
|
|
16977
|
+
* @returns A `Result<VaultSwapResponse, LeverageYieldSwapError>`. On success:
|
|
16978
|
+
* - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
|
|
16979
|
+
* - `intent` — the on-chain intent object that was created.
|
|
16980
|
+
* - `intentDeliveryInfo` — source/destination chain keys, tx hashes, and user addresses.
|
|
16981
|
+
*
|
|
16982
|
+
* On failure `result.error` carries one of the create-intent codes plus
|
|
16983
|
+
* `TX_VERIFICATION_FAILED`, `TX_SUBMIT_FAILED`, `RELAY_TIMEOUT`, `RELAY_FAILED`,
|
|
16984
|
+
* `EXECUTION_FAILED`, `EXTERNAL_API_ERROR` or `UNKNOWN`.
|
|
16985
|
+
*/
|
|
16986
|
+
vaultSwap<K extends SpokeChainKey>(_params: VaultSwapActionParams<K, false>): Promise<Result<VaultSwapResponse, LeverageYieldSwapError>>;
|
|
16987
|
+
/**
|
|
16988
|
+
* Notifies the solver that the vault intent landed on the hub, triggering it to fill.
|
|
16989
|
+
* Leverage-yield copy of the swap domain's `postExecution` — emits only
|
|
16990
|
+
* `EXECUTION_FAILED` / `EXTERNAL_API_ERROR` / `UNKNOWN` (relay/verify codes appear only
|
|
16991
|
+
* on {@link LeverageYieldService.vaultSwap}, which owns the verify + relay steps).
|
|
16992
|
+
*
|
|
16993
|
+
* Called automatically by {@link LeverageYieldService.vaultSwap} after the relay packet
|
|
16994
|
+
* lands on the hub. Public so callers who created the intent via
|
|
16995
|
+
* {@link LeverageYieldService.createVaultIntent} and relayed it themselves can finish the
|
|
16996
|
+
* flow manually.
|
|
16997
|
+
*
|
|
16998
|
+
* @param request - `{ intent_tx_hash }` — the hub-chain (Sonic) tx hash where the intent
|
|
16999
|
+
* was registered (the relay packet's `dst_tx_hash`, or the spoke tx hash for hub-sourced
|
|
17000
|
+
* intents).
|
|
17001
|
+
*/
|
|
17002
|
+
notifySolver(request: SolverExecutionRequest): Promise<Result<SolverExecutionResponse, LeverageYieldPostExecutionError>>;
|
|
17003
|
+
/**
|
|
17004
|
+
* Approves the vault's underlying asset to the leverage vault on Sonic. For callers
|
|
17005
|
+
* interacting with the vault directly on the hub — the swap-style {@link
|
|
17006
|
+
* LeverageYieldService.deposit} flow handles its own approvals.
|
|
17007
|
+
*/
|
|
17008
|
+
approve<R extends boolean = false>(params: LeverageYieldApproveParams<R>): Promise<Result<TxReturnType<HubChainKey, R>, LeverageYieldApproveError>>;
|
|
17009
|
+
/**
|
|
17010
|
+
* Reads on-chain allowance of the vault's underlying asset for `owner → vault`. Returns
|
|
17011
|
+
* `true` when the allowance covers `amount`. Use before a direct
|
|
17012
|
+
* {@link LeverageYieldService.deposit}.
|
|
17013
|
+
*/
|
|
17014
|
+
isAllowanceValid(params: LeverageYieldAllowanceParams): Promise<Result<boolean, LeverageYieldAllowanceCheckError>>;
|
|
17015
|
+
/** ERC-4626 `asset()` of the vault — the sodaWEETH-style underlying. */
|
|
17016
|
+
getAsset(vault: Address): Promise<Result<Address, LeverageYieldLookupError>>;
|
|
17017
|
+
/** Reads the vault's leveraged position snapshot via the non-standard `getPositionDetails`. */
|
|
17018
|
+
getPosition(vault: Address): Promise<Result<LeverageYieldPosition, LeverageYieldLookupError>>;
|
|
17019
|
+
/**
|
|
17020
|
+
* Computes the steady-state APR of a leverage-yield vault from the AAVE supply/borrow
|
|
17021
|
+
* rates of its asset and borrowToken, scaled by the vault's target leverage. Matches the
|
|
17022
|
+
* convention used by leveraged-LSD vaults (Origami, Gearbox, etc.) — assumes constant
|
|
17023
|
+
* LTV at `targetLTV` and constant AAVE rates.
|
|
17024
|
+
*
|
|
17025
|
+
* Returns raw fields in RAY (1e27, AAVE's native rate scale) plus the leverage multiplier
|
|
17026
|
+
* in WAD (1e18). See {@link LeverageYieldApr} for the formula and caveats.
|
|
17027
|
+
*/
|
|
17028
|
+
getApr(vault: Address): Promise<Result<LeverageYieldApr, LeverageYieldLookupError>>;
|
|
17029
|
+
/**
|
|
17030
|
+
* Off-chain LSD staking-APR for the vault's underlying asset. Looks the vault up in the
|
|
17031
|
+
* registry, hits DefiLlama's per-pool chart endpoint for the configured `poolId`, and on
|
|
17032
|
+
* any fetch failure returns the registry's hardcoded `fallbackAprPct` with `stale: true`.
|
|
17033
|
+
*
|
|
17034
|
+
* Always resolves to `{ ok: true, ... }` for a known vault — the fallback path replaces
|
|
17035
|
+
* the error, since a missing LSD APR shouldn't break the parent call. Returns
|
|
17036
|
+
* `{ aprRay: 0n, stale: true, label: 'no LSD source' }` for vaults without an
|
|
17037
|
+
* `lsdSource` configured (non-LSD strategies); callers can treat that as "skip LSD".
|
|
17038
|
+
*/
|
|
17039
|
+
getLsdApr(vault: Address): Promise<Result<LeverageYieldLsdApr, LeverageYieldLookupError>>;
|
|
17040
|
+
/**
|
|
17041
|
+
* Combined view of {@link getApr} + {@link getLsdApr}: re-applies the vault's leverage
|
|
17042
|
+
* formula with the LSD's native staking yield folded into the supply side, exposing the
|
|
17043
|
+
* **effective** net APR that LSD-backed strategies actually earn. The AAVE-only
|
|
17044
|
+
* `netAprRay` is preserved on the return value for callers who want to display both.
|
|
17045
|
+
*
|
|
17046
|
+
* effectiveSupply = supplyAprRay + lsdApr.aprRay
|
|
17047
|
+
* effectiveNet = effectiveSupply + leverage × (effectiveSupply − borrowAprRay)
|
|
17048
|
+
*
|
|
17049
|
+
* Fetches AAVE rates and the LSD APR in parallel for one round-trip's worth of latency.
|
|
17050
|
+
*/
|
|
17051
|
+
getEffectiveApr(vault: Address): Promise<Result<LeverageYieldEffectiveApr, LeverageYieldLookupError>>;
|
|
17052
|
+
/** Synchronously withdrawable assets for `owner` (clamped against leverage HF floor). */
|
|
17053
|
+
getMaxWithdraw(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17054
|
+
/** Total underlying assets currently held by the vault (vault-asset units, 18 decimals) — TVL. */
|
|
17055
|
+
getTotalAssets(vault: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17056
|
+
/** Shares minted for a given asset deposit. */
|
|
17057
|
+
previewDeposit(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17058
|
+
/** Shares burned for a given asset withdrawal. */
|
|
17059
|
+
previewWithdraw(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17060
|
+
/** Assets received for a given share redemption. */
|
|
17061
|
+
previewRedeem(vault: Address, shares: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17062
|
+
/** Vault shares held by `owner`. */
|
|
17063
|
+
getShareBalance(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17064
|
+
/**
|
|
17065
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
17066
|
+
* returns its on-chain `maxWithdraw`, less {@link MAX_WITHDRAW_DUST_BUFFER}. The trim
|
|
17067
|
+
* keeps the value safe for an asset-denominated ERC-4626 `withdraw` — the raw
|
|
17068
|
+
* `maxWithdraw` can trip the round-up that asks for one more share than the user holds.
|
|
17069
|
+
*/
|
|
17070
|
+
getMaxWithdrawForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17071
|
+
/**
|
|
17072
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
17073
|
+
* returns its on-chain share balance.
|
|
17074
|
+
*/
|
|
17075
|
+
getShareBalanceForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
17076
|
+
}
|
|
17077
|
+
|
|
17078
|
+
declare const sponsoringInvariant: FeatureInvariant;
|
|
17079
|
+
type SponsoringAction = 'activateStellarAccount';
|
|
17080
|
+
type SponsoringOrchestrationErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'LOOKUP_FAILED' | 'EXTERNAL_API_ERROR' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
17081
|
+
type SponsoringConfigErrorCode = Extract<SodaxErrorCode, 'EXTERNAL_API_ERROR' | 'VALIDATION_FAILED' | 'UNKNOWN'>;
|
|
17082
|
+
type SponsoringLookupErrorCode = LookupErrorCode;
|
|
17083
|
+
type SponsoringOrchestrationError = SodaxError<SponsoringOrchestrationErrorCode>;
|
|
17084
|
+
type SponsoringConfigError = SodaxError<SponsoringConfigErrorCode>;
|
|
17085
|
+
type SponsoringLookupError = SodaxError<SponsoringLookupErrorCode>;
|
|
17086
|
+
declare const isSponsoringOrchestrationError: (e: unknown) => e is SodaxError<SponsoringOrchestrationErrorCode>;
|
|
17087
|
+
declare const isSponsoringConfigError: (e: unknown) => e is SodaxError<SponsoringConfigErrorCode>;
|
|
17088
|
+
declare const isSponsoringLookupError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
17089
|
+
/**
|
|
17090
|
+
* Caller action derived from a sponsoring failure.
|
|
17091
|
+
*
|
|
17092
|
+
* `rebuildAndResign` requires a new signature; `retrySameRequest` reuses
|
|
17093
|
+
* the signed XDR; `backoff` waits before retrying.
|
|
17094
|
+
*/
|
|
17095
|
+
type SponsorFailureAction = 'fixIntegration' | 'checkApiKey' | 'rebuildAndResign' | 'retrySameRequest' | 'backoff' | 'contactOperator' | 'abort';
|
|
17096
|
+
interface SponsorFailureClass {
|
|
17097
|
+
action: SponsorFailureAction;
|
|
17098
|
+
retryable: boolean;
|
|
17099
|
+
requiresNewSignature: boolean;
|
|
17100
|
+
/** Absent for transport failures, timeouts, and schema failures. */
|
|
17101
|
+
status?: number;
|
|
17102
|
+
/** Present only for a recognized domain code. */
|
|
17103
|
+
code?: SponsoringApiErrorCode;
|
|
17104
|
+
/** Human-readable only; do not use for control flow. */
|
|
17105
|
+
message: string;
|
|
17106
|
+
/** Server-provided backoff in seconds. */
|
|
17107
|
+
retryAfterSeconds?: number;
|
|
17108
|
+
/** Advisory sponsor sequence supplied on a conflict. */
|
|
17109
|
+
sponsorSequence?: string;
|
|
17110
|
+
}
|
|
17111
|
+
/**
|
|
17112
|
+
* Classify a failed sponsoring request into the caller's next action.
|
|
17113
|
+
*
|
|
17114
|
+
* HTTP status is primary; recognized domain codes refine statuses whose handling
|
|
17115
|
+
* differs by cause.
|
|
17116
|
+
*/
|
|
17117
|
+
declare function classifySponsorError(error: SodaxError<'EXTERNAL_API_ERROR'>): SponsorFailureClass;
|
|
17118
|
+
|
|
17119
|
+
/**
|
|
17120
|
+
* Mirrors the server's config cache window so sponsor rotation propagates
|
|
17121
|
+
* within one minute.
|
|
17122
|
+
*/
|
|
17123
|
+
declare const SPONSOR_CONFIG_TTL_MS = 60000;
|
|
17124
|
+
/**
|
|
17125
|
+
* The base reserve only moves at a network upgrade, so one read per hour is
|
|
17126
|
+
* ample and keeps account-status polling to a single request.
|
|
17127
|
+
*/
|
|
17128
|
+
declare const STELLAR_BASE_RESERVE_TTL_MS = 3600000;
|
|
17129
|
+
/**
|
|
17130
|
+
* Spendable XLM required for one trustline at the base reserve Stellar has
|
|
17131
|
+
* published since protocol 12. It is the fallback only: the live requirement
|
|
17132
|
+
* is `StellarAccountStatus.trustlineMinXlmStroops`, computed from the network's
|
|
17133
|
+
* current base reserve, which validators can vote to change.
|
|
17134
|
+
*/
|
|
17135
|
+
declare const STELLAR_TRUSTLINE_MIN_XLM_STROOPS: bigint;
|
|
17136
|
+
type StellarAccountStatus = {
|
|
17137
|
+
exists: boolean;
|
|
17138
|
+
/** Total native XLM in stroops; `0n` when the account does not exist. */
|
|
17139
|
+
nativeBalanceStroops: bigint;
|
|
17140
|
+
/** Total minus locked reserves and selling liabilities. */
|
|
17141
|
+
availableBalanceStroops: bigint;
|
|
17142
|
+
/** Whether available balance can fund one additional trustline. */
|
|
17143
|
+
canAffordTrustline: boolean;
|
|
17144
|
+
/**
|
|
17145
|
+
* Spendable XLM one more trustline needs, at the network's current base
|
|
17146
|
+
* reserve. Render this rather than {@link STELLAR_TRUSTLINE_MIN_XLM_STROOPS}.
|
|
17147
|
+
*/
|
|
17148
|
+
trustlineMinXlmStroops: bigint;
|
|
17149
|
+
};
|
|
17150
|
+
type ActivateStellarAccountParams = {
|
|
17151
|
+
/** Stellar account to activate. Must be the account `walletProvider` signs with. */
|
|
17152
|
+
address: string;
|
|
17153
|
+
/**
|
|
17154
|
+
* Signs as the account being created. The SDK must not broadcast before the
|
|
17155
|
+
* server adds the sponsor signature.
|
|
17156
|
+
*/
|
|
17157
|
+
walletProvider: IStellarWalletProvider;
|
|
17158
|
+
/**
|
|
17159
|
+
* Allow one rebuild and new signature after a sequence conflict. Defaults to
|
|
17160
|
+
* `true`; disable for headless callers.
|
|
17161
|
+
*/
|
|
17162
|
+
allowSequenceRetry?: boolean;
|
|
17163
|
+
/**
|
|
17164
|
+
* Re-submit the same signed payload after `HORIZON_UNAVAILABLE`.
|
|
17165
|
+
* Defaults to 2; `0` disables.
|
|
17166
|
+
*/
|
|
17167
|
+
maxHorizonRetries?: number;
|
|
17168
|
+
/**
|
|
17169
|
+
* Fired before each wallet prompt so a UI can explain a required re-sign
|
|
17170
|
+
* before the extension takes focus.
|
|
17171
|
+
*/
|
|
17172
|
+
onSignatureRequired?: (info: {
|
|
17173
|
+
attempt: 1 | 2;
|
|
17174
|
+
reason: 'initial' | 'sequenceConflict';
|
|
17175
|
+
}) => void;
|
|
17176
|
+
forceConfigRefresh?: boolean;
|
|
17177
|
+
requestConfig?: RequestOverrideConfig;
|
|
17178
|
+
};
|
|
17179
|
+
type ActivateStellarAccountResult = {
|
|
17180
|
+
status: 'submitted';
|
|
17181
|
+
hash: string;
|
|
17182
|
+
/** Number of wallet signatures; `2` means a sequence conflict was retried. */
|
|
17183
|
+
attempts: 1 | 2;
|
|
17184
|
+
} | {
|
|
17185
|
+
/** No transaction was needed; `attempts: 0` means no wallet prompt. */
|
|
17186
|
+
status: 'alreadyActive';
|
|
17187
|
+
hash: null;
|
|
17188
|
+
attempts: 0 | 1 | 2;
|
|
17189
|
+
};
|
|
17190
|
+
/**
|
|
17191
|
+
* Orchestrates sponsored Stellar activation: config caching, Horizon reads,
|
|
17192
|
+
* account signing, sponsor submission, and bounded retries.
|
|
17193
|
+
*/
|
|
17194
|
+
declare class SponsoringService {
|
|
17195
|
+
private readonly config;
|
|
17196
|
+
private readonly spoke;
|
|
17197
|
+
private readonly api;
|
|
17198
|
+
/** Keyed by base URL to isolate deployment-specific sponsor config. */
|
|
17199
|
+
private readonly configCache;
|
|
17200
|
+
private readonly inflightConfig;
|
|
17201
|
+
private baseReserveCache;
|
|
17202
|
+
private inflightBaseReserve;
|
|
17203
|
+
constructor(deps: {
|
|
17204
|
+
config: ConfigService;
|
|
17205
|
+
spoke: SpokeService;
|
|
17206
|
+
api: BackendApiService;
|
|
17207
|
+
});
|
|
17208
|
+
private get horizon();
|
|
17209
|
+
/**
|
|
17210
|
+
* Whether an account exists. Read failures remain errors rather than being
|
|
17211
|
+
* misreported as inactive.
|
|
17212
|
+
*/
|
|
17213
|
+
isStellarAccountActive(params: {
|
|
17214
|
+
address: string;
|
|
17215
|
+
}): Promise<Result<boolean, SponsoringLookupError>>;
|
|
17216
|
+
/**
|
|
17217
|
+
* Return account existence and trustline affordability. Costs one Horizon
|
|
17218
|
+
* account read, plus a base-reserve read on the first call per hour.
|
|
17219
|
+
*/
|
|
17220
|
+
getStellarAccountStatus(params: {
|
|
17221
|
+
address: string;
|
|
17222
|
+
}): Promise<Result<StellarAccountStatus, SponsoringLookupError>>;
|
|
17223
|
+
/**
|
|
17224
|
+
* Shared account read. A 404 resolves to `undefined` because absence is a
|
|
17225
|
+
* legitimate answer; every other failure remains an error.
|
|
17226
|
+
*/
|
|
17227
|
+
private readAccount;
|
|
17228
|
+
/**
|
|
17229
|
+
* The base reserve is a validator-controlled network setting, so read it from
|
|
17230
|
+
* the latest ledger rather than assuming the published 0.5 XLM. A failed read
|
|
17231
|
+
* degrades to that value: this drives a UI hint, never a signed transaction.
|
|
17232
|
+
*/
|
|
17233
|
+
private resolveBaseReserveStroops;
|
|
17234
|
+
/**
|
|
17235
|
+
* Cache key for a config request: the resolved base URL plus any per-call
|
|
17236
|
+
* headers. Headers can select a different response from the same URL — an API
|
|
17237
|
+
* key scoped to another deployment, or a test harness's scenario header — so
|
|
17238
|
+
* folding them in stops one caller's override from being served to, or
|
|
17239
|
+
* overwriting, the default path. Kept in memory as a Map key only.
|
|
17240
|
+
*/
|
|
17241
|
+
private configCacheKey;
|
|
17242
|
+
/**
|
|
17243
|
+
* Fetch sponsor config with per-endpoint caching and in-flight deduplication.
|
|
17244
|
+
* Failures are never cached.
|
|
17245
|
+
*/
|
|
17246
|
+
getStellarSponsorConfig(params?: {
|
|
17247
|
+
forceRefresh?: boolean;
|
|
17248
|
+
requestConfig?: RequestOverrideConfig;
|
|
17249
|
+
}): Promise<Result<StellarSponsorConfig, SponsoringConfigError>>;
|
|
17250
|
+
/**
|
|
17251
|
+
* Activate an account with a sponsored base reserve. Config and existence are
|
|
17252
|
+
* checked before prompting; sponsor sequence is never cached.
|
|
17253
|
+
*/
|
|
17254
|
+
activateStellarAccount(params: ActivateStellarAccountParams): Promise<Result<ActivateStellarAccountResult, SponsoringOrchestrationError>>;
|
|
17255
|
+
/** One build, sign, and submit attempt. */
|
|
17256
|
+
private attemptActivation;
|
|
17257
|
+
/**
|
|
17258
|
+
* Re-submit identical signed bytes only for `retrySameRequest` failures.
|
|
17259
|
+
*/
|
|
17260
|
+
private submitWithHorizonRetry;
|
|
17261
|
+
/**
|
|
17262
|
+
* Best-effort existence pre-flight. Read failures continue to activation
|
|
17263
|
+
* because the server performs the authoritative check.
|
|
17264
|
+
*/
|
|
17265
|
+
private accountExistsBestEffort;
|
|
17266
|
+
}
|
|
17267
|
+
|
|
15887
17268
|
/**
|
|
15888
17269
|
* Sodax class is used to interact with the Sodax.
|
|
15889
17270
|
*
|
|
@@ -15895,15 +17276,18 @@ declare class Sodax {
|
|
|
15895
17276
|
readonly moneyMarket: MoneyMarketService;
|
|
15896
17277
|
readonly migration: MigrationService;
|
|
15897
17278
|
readonly backendApi: BackendApiService;
|
|
17279
|
+
readonly api: BackendApiService;
|
|
15898
17280
|
readonly bridge: BridgeService;
|
|
15899
17281
|
readonly staking: StakingService;
|
|
15900
17282
|
readonly partners: PartnerService;
|
|
15901
17283
|
readonly recovery: RecoveryService;
|
|
15902
17284
|
readonly dex: DexService;
|
|
17285
|
+
readonly sponsoring: SponsoringService;
|
|
17286
|
+
readonly leverageYield: LeverageYieldService;
|
|
15903
17287
|
readonly config: ConfigService;
|
|
15904
17288
|
readonly hubProvider: HubProvider;
|
|
15905
17289
|
readonly spoke: SpokeService;
|
|
15906
|
-
constructor(
|
|
17290
|
+
constructor(options?: SodaxOptions);
|
|
15907
17291
|
/**
|
|
15908
17292
|
* Initializes the Sodax instance with dynamic configuration.
|
|
15909
17293
|
* You should use this option if you do not want to update package versions when new chains and tokens are added.
|
|
@@ -16091,15 +17475,16 @@ declare class EvmSolverService {
|
|
|
16091
17475
|
/**
|
|
16092
17476
|
* Recovers the partner fee amount embedded in an intent's `data` field.
|
|
16093
17477
|
*
|
|
16094
|
-
*
|
|
16095
|
-
*
|
|
16096
|
-
*
|
|
17478
|
+
* Inverse of {@link createIntentFeeData}: returns the encoded fee, regardless of whether the `data`
|
|
17479
|
+
* is a bare fee envelope or a multi-entry envelope that also carries delivery data. The envelope
|
|
17480
|
+
* parsing lives in {@link IntentDataService.extractFeePayload}; this method just decodes the fee struct.
|
|
16097
17481
|
*
|
|
16098
17482
|
* @param data - The intent's `data` field (`'0x'` when no fee was configured).
|
|
16099
|
-
* @returns The fee amount in the input token's smallest unit (`0n` when no fee
|
|
16100
|
-
* when the leading type byte is not {@link IntentDataType.FEE} — in which case it logs and degrades to `0n`).
|
|
17483
|
+
* @returns The fee amount in the input token's smallest unit (`0n` when no fee is present).
|
|
16101
17484
|
*/
|
|
16102
17485
|
static decodeIntentFeeAmount(data: Hex): bigint;
|
|
17486
|
+
/** Decodes a raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) to its fee amount. */
|
|
17487
|
+
private static decodeFeePayload;
|
|
16103
17488
|
/**
|
|
16104
17489
|
* Re-derives the byte-identical relay payload that `createIntent` originally produced, from a
|
|
16105
17490
|
* fully-populated `Intent` alone.
|
|
@@ -16135,7 +17520,7 @@ declare class EvmSolverService {
|
|
|
16135
17520
|
* @throws If the transaction contains no matching `IntentCreated` event, or if the
|
|
16136
17521
|
* intent's chain IDs are not recognized.
|
|
16137
17522
|
*/
|
|
16138
|
-
static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient
|
|
17523
|
+
static getIntent(txHash: Hash$1, config: ConfigService, publicClient: PublicClient): Promise<Intent>;
|
|
16139
17524
|
/**
|
|
16140
17525
|
* Reads an `IntentState` struct from a hub-chain fill transaction receipt.
|
|
16141
17526
|
*
|
|
@@ -16148,7 +17533,7 @@ declare class EvmSolverService {
|
|
|
16148
17533
|
* @returns `IntentState`: `{ exists, remainingInput, receivedOutput, pendingPayment }`.
|
|
16149
17534
|
* @throws If the transaction contains no matching `IntentFilled` event.
|
|
16150
17535
|
*/
|
|
16151
|
-
static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient
|
|
17536
|
+
static getFilledIntent(txHash: Hash$1, solverConfig: SolverConfig, publicClient: PublicClient): Promise<IntentState>;
|
|
16152
17537
|
/**
|
|
16153
17538
|
* Computes the keccak256 hash of an intent struct, which serves as its unique ID on the hub chain.
|
|
16154
17539
|
*
|
|
@@ -16177,6 +17562,89 @@ declare class EvmSolverService {
|
|
|
16177
17562
|
static encodeCancelIntent(intent: Intent, intentsContract: Address$1): EvmContractCall;
|
|
16178
17563
|
}
|
|
16179
17564
|
|
|
17565
|
+
/**
|
|
17566
|
+
* Stateless utility for the SODAX solver's delivery hooks.
|
|
17567
|
+
*
|
|
17568
|
+
* A delivery hook lets an intent's output be handed to `ISpokeReceiver(dstAddress).hook(...)` on the
|
|
17569
|
+
* destination spoke instead of transferred straight to the recipient. Each hook is two coupled things:
|
|
17570
|
+
* its **deployed address** (the registry in `@sodax/types`) and its **`deliveryData` codec** (here).
|
|
17571
|
+
* This class fuses them so the address and payload can never drift, and exposes a single
|
|
17572
|
+
* type-differentiated {@link encodeDeliveryData} rather than one encoder per hook.
|
|
17573
|
+
*/
|
|
17574
|
+
declare class HookService {
|
|
17575
|
+
private constructor();
|
|
17576
|
+
/**
|
|
17577
|
+
* Encodes a hook's `deliveryData` payload. One common entry point for all hooks — the encoding is
|
|
17578
|
+
* selected by {@link HookRequest.kind} and uses that hook's schema from {@link HOOK_DELIVERY_ABI}.
|
|
17579
|
+
*
|
|
17580
|
+
* @param request - The hook selection (and any hook-specific params).
|
|
17581
|
+
* @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
|
|
17582
|
+
*/
|
|
17583
|
+
static encodeDeliveryData(request: HookRequest, recipient: string): Hex;
|
|
17584
|
+
/**
|
|
17585
|
+
* Resolves a high-level {@link HookRequest} to the on-chain delivery pair: the deployed hook address
|
|
17586
|
+
* (becomes the intent's `dstAddress`) and the encoded payload the hook expects (`deliveryData`).
|
|
17587
|
+
* Bundling lookup + codec here guarantees the address and its payload schema can never drift.
|
|
17588
|
+
*
|
|
17589
|
+
* @param chainKey - Destination spoke chain (must have the requested hook deployed).
|
|
17590
|
+
* @param request - The hook selection (and any hook-specific params).
|
|
17591
|
+
* @param recipient - The end recipient the hook should credit (the intent's `dstAddress`).
|
|
17592
|
+
*/
|
|
17593
|
+
static resolveDeliveryHook(chainKey: SpokeChainKey, request: HookRequest, recipient: string): {
|
|
17594
|
+
dstAddress: Address$1;
|
|
17595
|
+
deliveryData: Hex;
|
|
17596
|
+
};
|
|
17597
|
+
/**
|
|
17598
|
+
* Resolves the effective delivery target for an intent. When {@link CreateIntentParams.hook} is set,
|
|
17599
|
+
* routes the output through that registered hook (overriding `dstAddress` and deriving `deliveryData`);
|
|
17600
|
+
* otherwise returns the caller's `dstAddress` and low-level `deliveryData` unchanged. Centralised so
|
|
17601
|
+
* both the hub and Sonic intent constructors apply hooks identically.
|
|
17602
|
+
*
|
|
17603
|
+
* @returns `{ dstAddress, deliveryData }` — the address to deliver to and the payload to forward.
|
|
17604
|
+
*/
|
|
17605
|
+
static resolveDelivery(params: CreateIntentParams): {
|
|
17606
|
+
dstAddress: string;
|
|
17607
|
+
deliveryData: Hex | undefined;
|
|
17608
|
+
};
|
|
17609
|
+
}
|
|
17610
|
+
|
|
17611
|
+
/**
|
|
17612
|
+
* Stateless utility for the `Intent.data` envelope layer.
|
|
17613
|
+
*
|
|
17614
|
+
* `Intent.data` carries zero or more typed entries (a partner-fee payload, a delivery payload, …).
|
|
17615
|
+
* This class owns how those entries are packed into bytes the on-chain `IntentDataLib` decodes and
|
|
17616
|
+
* how they are recovered back out, keeping the `ArrayData` codec ({@link ARRAY_DATA_ABI}) in one
|
|
17617
|
+
* place. The delivery payloads themselves are produced by `HookService`; this layer is agnostic to
|
|
17618
|
+
* their contents and simply folds them in alongside the fee.
|
|
17619
|
+
*/
|
|
17620
|
+
declare class IntentDataService {
|
|
17621
|
+
private constructor();
|
|
17622
|
+
/**
|
|
17623
|
+
* Folds a partner-fee envelope and an optional delivery payload into the final `Intent.data`:
|
|
17624
|
+
* - Neither → `'0x'`.
|
|
17625
|
+
* - Exactly one → that single packed `[uint8 type, bytes payload]` envelope (byte-identical to a
|
|
17626
|
+
* bare fee envelope, so a fee-only intent's `data` is unchanged and stays decode-stable).
|
|
17627
|
+
* - Both → a `TYPE_ARRAY` envelope wrapping `[FEE, DELIVERY]` entries.
|
|
17628
|
+
*
|
|
17629
|
+
* @param feeEnvelope - The packed fee envelope from `EvmSolverService.createIntentFeeData` (`'0x'` if no fee).
|
|
17630
|
+
* @param deliveryData - Opaque delivery payload (e.g. from `HookService.encodeDeliveryData`), or `undefined`.
|
|
17631
|
+
*/
|
|
17632
|
+
static composeIntentData(feeEnvelope: Hex, deliveryData?: Hex): Hex;
|
|
17633
|
+
/**
|
|
17634
|
+
* Encodes a list of typed `IntentData` entries into the `Intent.data` bytes the contract decodes.
|
|
17635
|
+
* Empty → `'0x'`; single → a packed `[uint8 type, bytes payload]` envelope; multiple → a `TYPE_ARRAY`
|
|
17636
|
+
* envelope wrapping the entries as `ArrayData { DataEntry[] }`.
|
|
17637
|
+
*/
|
|
17638
|
+
static encodeIntentData(entries: IntentData[]): Hex;
|
|
17639
|
+
/**
|
|
17640
|
+
* Extracts the raw `FeeData` payload (`abi.encode(uint256 fee, address receiver)`) from an intent's
|
|
17641
|
+
* `data`, unwrapping whichever envelope shape it uses. Returns `undefined` when there is no fee:
|
|
17642
|
+
* empty `data`, a delivery-only envelope, or an unknown type byte (logged). Used by
|
|
17643
|
+
* `EvmSolverService.decodeIntentFeeAmount` to recover fees regardless of delivery data.
|
|
17644
|
+
*/
|
|
17645
|
+
static extractFeePayload(data: Hex): Hex | undefined;
|
|
17646
|
+
}
|
|
17647
|
+
|
|
16180
17648
|
/**
|
|
16181
17649
|
* Stateless HTTP client for the SODAX solver API.
|
|
16182
17650
|
*
|
|
@@ -16217,7 +17685,7 @@ declare class SolverApiService {
|
|
|
16217
17685
|
* @param config - Solver endpoint configuration.
|
|
16218
17686
|
* @returns A `Result` containing `{ answer: 'OK', intent_hash: Hex }` on success.
|
|
16219
17687
|
*/
|
|
16220
|
-
static postExecution(request: SolverExecutionRequest, config: SolverConfig): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
17688
|
+
static postExecution(request: SolverExecutionRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
16221
17689
|
/**
|
|
16222
17690
|
* Polls the solver API for the current execution status of an intent (`POST /status`).
|
|
16223
17691
|
*
|
|
@@ -16227,7 +17695,7 @@ declare class SolverApiService {
|
|
|
16227
17695
|
* `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
16228
17696
|
* @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
|
|
16229
17697
|
*/
|
|
16230
|
-
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
17698
|
+
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
16231
17699
|
}
|
|
16232
17700
|
|
|
16233
17701
|
/**
|
|
@@ -16250,7 +17718,7 @@ declare class StakingLogic {
|
|
|
16250
17718
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16251
17719
|
* @returns Array of `UserUnstakeInfo` records for all active unstake requests.
|
|
16252
17720
|
*/
|
|
16253
|
-
static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient
|
|
17721
|
+
static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient): Promise<readonly UserUnstakeInfo[]>;
|
|
16254
17722
|
/**
|
|
16255
17723
|
* Encodes the depositFor transaction data.
|
|
16256
17724
|
* @param stakedSoda - The address of the StakedSoda contract.
|
|
@@ -16302,7 +17770,7 @@ declare class StakingLogic {
|
|
|
16302
17770
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16303
17771
|
* @returns Total SODA deposited across all stakers.
|
|
16304
17772
|
*/
|
|
16305
|
-
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient
|
|
17773
|
+
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient): Promise<bigint>;
|
|
16306
17774
|
/**
|
|
16307
17775
|
* Calculates the number of xSoda shares equivalent to a given amount of SODA assets (`convertToShares`).
|
|
16308
17776
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16310,7 +17778,7 @@ declare class StakingLogic {
|
|
|
16310
17778
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16311
17779
|
* @returns The xSoda share count equivalent to `assets` at the current exchange rate.
|
|
16312
17780
|
*/
|
|
16313
|
-
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17781
|
+
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16314
17782
|
/**
|
|
16315
17783
|
* Calculates the SODA asset amount corresponding to a given number of xSoda shares (`convertToAssets`).
|
|
16316
17784
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16318,7 +17786,7 @@ declare class StakingLogic {
|
|
|
16318
17786
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16319
17787
|
* @returns The SODA asset amount equivalent to `shares` at the current exchange rate.
|
|
16320
17788
|
*/
|
|
16321
|
-
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17789
|
+
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16322
17790
|
/**
|
|
16323
17791
|
* Simulates a SODA deposit into the xSoda vault (`previewDeposit`) without executing it.
|
|
16324
17792
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16326,7 +17794,7 @@ declare class StakingLogic {
|
|
|
16326
17794
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16327
17795
|
* @returns The xSoda shares that would be minted for `assets`.
|
|
16328
17796
|
*/
|
|
16329
|
-
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17797
|
+
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16330
17798
|
/**
|
|
16331
17799
|
* Simulates minting a specific number of xSoda shares (`previewMint`) without executing it.
|
|
16332
17800
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16334,7 +17802,7 @@ declare class StakingLogic {
|
|
|
16334
17802
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16335
17803
|
* @returns The SODA assets that would need to be deposited to mint `shares`.
|
|
16336
17804
|
*/
|
|
16337
|
-
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17805
|
+
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16338
17806
|
/**
|
|
16339
17807
|
* Simulates withdrawing a specific SODA amount from the xSoda vault (`previewWithdraw`) without executing it.
|
|
16340
17808
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16342,7 +17810,7 @@ declare class StakingLogic {
|
|
|
16342
17810
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16343
17811
|
* @returns The xSoda shares that would be burned to withdraw `assets`.
|
|
16344
17812
|
*/
|
|
16345
|
-
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient
|
|
17813
|
+
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16346
17814
|
/**
|
|
16347
17815
|
* Simulates redeeming a specific number of xSoda shares (`previewRedeem`) without executing it.
|
|
16348
17816
|
* @param xSoda - The address of the xSoda ERC-4626 vault contract.
|
|
@@ -16350,7 +17818,7 @@ declare class StakingLogic {
|
|
|
16350
17818
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16351
17819
|
* @returns The SODA assets that would be withdrawn for `shares`.
|
|
16352
17820
|
*/
|
|
16353
|
-
static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient
|
|
17821
|
+
static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16354
17822
|
/**
|
|
16355
17823
|
* Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
|
|
16356
17824
|
* @param xSoda - The address of the xSoda token contract.
|
|
@@ -16416,7 +17884,7 @@ declare class StakingLogic {
|
|
|
16416
17884
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16417
17885
|
* @returns Tuple `[xSodaAmount, previewDepositAmount]` — estimated shares and vault preview figure.
|
|
16418
17886
|
*/
|
|
16419
|
-
static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient
|
|
17887
|
+
static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<readonly [bigint, bigint]>;
|
|
16420
17888
|
/**
|
|
16421
17889
|
* Estimates the SODA output for instantly unstaking a given xSoda amount.
|
|
16422
17890
|
*
|
|
@@ -16429,7 +17897,7 @@ declare class StakingLogic {
|
|
|
16429
17897
|
* @param publicClient - Viem public client connected to the hub chain.
|
|
16430
17898
|
* @returns The estimated SODA output for the instant unstake.
|
|
16431
17899
|
*/
|
|
16432
|
-
static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient
|
|
17900
|
+
static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient): Promise<bigint>;
|
|
16433
17901
|
}
|
|
16434
17902
|
|
|
16435
17903
|
declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
|
|
@@ -16441,7 +17909,7 @@ declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxC
|
|
|
16441
17909
|
|
|
16442
17910
|
declare const partnerInvariant: FeatureInvariant;
|
|
16443
17911
|
type PartnerAction = 'waitAutoSwap';
|
|
16444
|
-
type PartnerErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
17912
|
+
type PartnerErrorCode = Extract<SodaxErrorCode, 'USER_REJECTED' | 'VALIDATION_FAILED' | 'LOOKUP_FAILED' | 'APPROVE_FAILED' | 'EXECUTION_FAILED' | 'UNKNOWN'>;
|
|
16445
17913
|
type PartnerError = SodaxError<PartnerErrorCode>;
|
|
16446
17914
|
declare const isPartnerError: (e: unknown) => e is SodaxError<PartnerErrorCode>;
|
|
16447
17915
|
|
|
@@ -16459,5 +17927,13 @@ declare const dexInvariant: FeatureInvariant;
|
|
|
16459
17927
|
type DexErrorCode = LookupErrorCode;
|
|
16460
17928
|
type DexError = SodaxError<DexErrorCode>;
|
|
16461
17929
|
declare const isDexError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
17930
|
+
/** Codes any DEX `executeXxx` / intent-creation method can return. */
|
|
17931
|
+
type DexCreateIntentErrorCode = CreateIntentErrorCode;
|
|
17932
|
+
type DexCreateIntentError = SodaxError<DexCreateIntentErrorCode>;
|
|
17933
|
+
declare const isDexCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
|
|
17934
|
+
/** Codes the DEX `approve` method can return. */
|
|
17935
|
+
type DexApproveErrorCode = ApproveErrorCode;
|
|
17936
|
+
type DexApproveError = SodaxError<DexApproveErrorCode>;
|
|
17937
|
+
declare const isDexApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
|
|
16462
17938
|
|
|
16463
|
-
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, mergeSodaxConfig, 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 };
|
|
17939
|
+
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, type ActivateStellarAccountParams, type ActivateStellarAccountResult, 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, BackendHttpError, 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, SPONSOR_CONFIG_TTL_MS, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, 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, type SponsorFailureAction, type SponsorFailureClass, type SponsoringAction, SponsoringApiService, type SponsoringConfigError, type SponsoringConfigErrorCode, type SponsoringLookupError, type SponsoringLookupErrorCode, type SponsoringOrchestrationError, type SponsoringOrchestrationErrorCode, SponsoringService, StacksSpokeService, type StakeAction, type StakeOrchestrationError, type StakeOrchestrationErrorCode, type StakeParams, type StakingActionType, type StakingActionUnion, type StakingAllowanceCheckError, type StakingAllowanceCheckErrorCode, type StakingApproveError, type StakingApproveErrorCode, type StakingConfig, type StakingCreateIntentError, type StakingCreateIntentErrorCode, type StakingError, type StakingErrorCode, type StakingInfo, type StakingInfoFetchError, type StakingInfoFetchErrorCode, StakingLogic, type StakingOrchestrationError, type StakingOrchestrationErrorCode, type StakingParamsUnion, StakingService, type StakingServiceConstructorParams, type State, type StellarAccountStatus, 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, classifySponsorError, 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, isBackendHttpError, 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, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, 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, sponsoringInvariant, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, swapExactInSingleParamsAbi, swapInvariant, uiPoolDataAbi, universalRouterAbi, unknownFailed, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|