@sodax/sdk 2.0.0-rc.11 → 2.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1482 -282
- package/dist/index.d.cts +692 -95
- package/dist/index.d.ts +692 -95
- package/dist/index.mjs +1464 -284
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, DeepPartial, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey,
|
|
1
|
+
import { IConfigApi, ApiConfig, SodaxLogger, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, DeepPartial, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, HttpUrl, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, NearChainKey, FillData, NearRawTransaction, INearWalletProvider, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, 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, SodaxOptions } from '@sodax/types';
|
|
2
2
|
export * from '@sodax/types';
|
|
3
3
|
import * as viem from 'viem';
|
|
4
4
|
import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, HttpTransport, Hash, GetLogsReturnType } from 'viem';
|
|
@@ -62,7 +62,7 @@ type SodaxErrorCode = 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'EXECUTIO
|
|
|
62
62
|
* The producing feature of a SodaxError. Required at construction so consumers /
|
|
63
63
|
* loggers always have a feature tag.
|
|
64
64
|
*/
|
|
65
|
-
type SodaxFeature = 'swap' | 'moneyMarket' | 'bridge' | 'staking' | 'migration' | 'dex' | 'partner' | 'recovery';
|
|
65
|
+
type SodaxFeature = 'swap' | 'moneyMarket' | 'bridge' | 'staking' | 'migration' | 'dex' | 'partner' | 'recovery' | 'leverageYield';
|
|
66
66
|
/**
|
|
67
67
|
* Orchestration phase tag attached via `context.phase`. Canonical superset across all
|
|
68
68
|
* features — all features draw from this list rather than minting their own.
|
|
@@ -133,7 +133,7 @@ declare const LOOKUP_CODES: ReadonlySet<LookupErrorCode>;
|
|
|
133
133
|
/** Runtime list of all valid error codes — useful for membership checks and exhaustive switches. */
|
|
134
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"];
|
|
135
135
|
/** Runtime list of all valid feature tags. */
|
|
136
|
-
declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery"];
|
|
136
|
+
declare const SODAX_FEATURES: readonly ["swap", "moneyMarket", "bridge", "staking", "migration", "dex", "partner", "recovery", "leverageYield"];
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Canonical error type for the SODAX SDK.
|
|
@@ -7526,7 +7526,8 @@ interface MoneyMarketBorrowers {
|
|
|
7526
7526
|
declare class BackendApiService implements IConfigApi {
|
|
7527
7527
|
private readonly config;
|
|
7528
7528
|
private readonly headers;
|
|
7529
|
-
|
|
7529
|
+
private readonly logger;
|
|
7530
|
+
constructor(config: ApiConfig, logger?: SodaxLogger);
|
|
7530
7531
|
/**
|
|
7531
7532
|
* Execute a single HTTP request and return the parsed JSON body.
|
|
7532
7533
|
*
|
|
@@ -7817,6 +7818,11 @@ type ConfigServiceConstructorParams = {
|
|
|
7817
7818
|
* that a remote config fetch never clobbers explicit user overrides.
|
|
7818
7819
|
*/
|
|
7819
7820
|
userConfig?: DeepPartial<SodaxConfig>;
|
|
7821
|
+
/**
|
|
7822
|
+
* Pre-resolved SDK log sink. Held outside the swappable `SodaxConfig` so a dynamic config fetch
|
|
7823
|
+
* in {@link ConfigService.initialize} never replaces it. Defaults to the console logger when omitted.
|
|
7824
|
+
*/
|
|
7825
|
+
logger?: SodaxLogger;
|
|
7820
7826
|
};
|
|
7821
7827
|
/**
|
|
7822
7828
|
* ConfigApiService - Service for fetching configuration data from the backend API or fallbacking to default values
|
|
@@ -7825,6 +7831,11 @@ declare class ConfigService {
|
|
|
7825
7831
|
private sodax;
|
|
7826
7832
|
private readonly api;
|
|
7827
7833
|
private readonly userConfig?;
|
|
7834
|
+
/**
|
|
7835
|
+
* SDK log sink. Resolved once at construction and kept independent of {@link sodax} so that
|
|
7836
|
+
* {@link initialize}'s dynamic-config swap never clobbers it. Read by services via `config.logger`.
|
|
7837
|
+
*/
|
|
7838
|
+
readonly logger: SodaxLogger;
|
|
7828
7839
|
private initialized;
|
|
7829
7840
|
private supportedHubAssetsSet;
|
|
7830
7841
|
private supportedSodaVaultAssetsSet;
|
|
@@ -7835,7 +7846,7 @@ declare class ConfigService {
|
|
|
7835
7846
|
private stakedATokenAddressesSet;
|
|
7836
7847
|
private chainToSupportedTokenAddressMap;
|
|
7837
7848
|
private hubAssetToXTokenMap;
|
|
7838
|
-
constructor({ api, config, userConfig }: ConfigServiceConstructorParams);
|
|
7849
|
+
constructor({ api, config, userConfig, logger }: ConfigServiceConstructorParams);
|
|
7839
7850
|
initialize(): Promise<Result<void>>;
|
|
7840
7851
|
getChains(): GetChainsApiResponse;
|
|
7841
7852
|
getSwapTokens(): GetSwapTokensApiResponse;
|
|
@@ -8620,10 +8631,89 @@ declare class StacksSpokeService {
|
|
|
8620
8631
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<StacksChainKey>): Promise<Result<WaitForTxReceiptReturnType<StacksChainKey>>>;
|
|
8621
8632
|
}
|
|
8622
8633
|
|
|
8634
|
+
type RelayExtraData = {
|
|
8635
|
+
address: Hex;
|
|
8636
|
+
payload: Hex;
|
|
8637
|
+
};
|
|
8623
8638
|
/**
|
|
8624
|
-
*
|
|
8639
|
+
* Signed Bitcoin on-demand payload (money-market borrow/withdraw) carried in the relay submit
|
|
8640
|
+
* `data` as a JSON object — not a stringified JSON. There is no broadcast tx for these.
|
|
8641
|
+
* `public_key` is the signer's public key, required by the relay to verify a BIP-322 signature
|
|
8642
|
+
* (BIP-322 is not public-key-recoverable, unlike BIP-137).
|
|
8643
|
+
*/
|
|
8644
|
+
type OnDemandRelayData = {
|
|
8645
|
+
payload_hex: string;
|
|
8646
|
+
signature?: string;
|
|
8647
|
+
public_key?: string;
|
|
8648
|
+
};
|
|
8649
|
+
type IntentDeliveryInfo = {
|
|
8650
|
+
srcChainKey: SpokeChainKey;
|
|
8651
|
+
srcTxHash: string;
|
|
8652
|
+
srcAddress: string;
|
|
8653
|
+
dstChainKey: SpokeChainKey;
|
|
8654
|
+
dstTxHash: string;
|
|
8655
|
+
dstAddress: string;
|
|
8656
|
+
};
|
|
8657
|
+
type WaitUntilIntentExecutedPayload = {
|
|
8658
|
+
intentRelayChainId: string;
|
|
8659
|
+
srcTxHash: string;
|
|
8660
|
+
timeout?: number;
|
|
8661
|
+
apiUrl: HttpUrl;
|
|
8662
|
+
};
|
|
8663
|
+
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
8664
|
+
type IntentRelayRequest<T extends RelayAction> = {
|
|
8665
|
+
action: T;
|
|
8666
|
+
params: T extends 'submit' ? {
|
|
8667
|
+
chain_id: string;
|
|
8668
|
+
tx_hash: string;
|
|
8669
|
+
data?: RelayExtraData | OnDemandRelayData;
|
|
8670
|
+
} : T extends 'get_transaction_packets' ? {
|
|
8671
|
+
chain_id: string;
|
|
8672
|
+
tx_hash: string;
|
|
8673
|
+
} : T extends 'get_packet' ? {
|
|
8674
|
+
chain_id: string;
|
|
8675
|
+
tx_hash: string;
|
|
8676
|
+
conn_sn: string;
|
|
8677
|
+
} : never;
|
|
8678
|
+
};
|
|
8679
|
+
|
|
8680
|
+
/**
|
|
8681
|
+
* Types derived from Core SDK specific types
|
|
8682
|
+
* NOTE: common (non Core SDK specific) types should be put in @sodax/types package
|
|
8683
|
+
*/
|
|
8684
|
+
type HubProvider = EvmHubProvider;
|
|
8685
|
+
type RateLimitConfig = {
|
|
8686
|
+
maxAvailable: number;
|
|
8687
|
+
ratePerSecond: number;
|
|
8688
|
+
available: number;
|
|
8689
|
+
};
|
|
8690
|
+
/**
|
|
8691
|
+
* Structural types
|
|
8692
|
+
*/
|
|
8693
|
+
type OptionalRaw<R extends boolean> = {
|
|
8694
|
+
raw?: R;
|
|
8695
|
+
};
|
|
8696
|
+
type OptionalSkipSimulation = {
|
|
8697
|
+
skipSimulation?: boolean;
|
|
8698
|
+
};
|
|
8699
|
+
type OptionalTimeout = {
|
|
8700
|
+
timeout?: number;
|
|
8701
|
+
};
|
|
8702
|
+
type TxHashPair = {
|
|
8703
|
+
srcChainTxHash: string;
|
|
8704
|
+
dstChainTxHash: string;
|
|
8705
|
+
};
|
|
8706
|
+
type IntentTxResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
8707
|
+
tx: TxReturnType<K, Raw>;
|
|
8708
|
+
relayData: RelayExtraData;
|
|
8709
|
+
};
|
|
8710
|
+
|
|
8711
|
+
type DestinationParamsType = RawDestinationParams;
|
|
8712
|
+
|
|
8713
|
+
/**
|
|
8714
|
+
* Raw error body shape returned by the Bound Exchange HTTP API on non-2xx responses.
|
|
8625
8715
|
* The human-readable detail typically lives at `error.details` (nested), with
|
|
8626
|
-
* `code` carrying a
|
|
8716
|
+
* `code` carrying a Bound Exchange-specific identifier (e.g. "2002" insufficientBTCBalance,
|
|
8627
8717
|
* "4008" duplicatedPubKey) and `message` an i18n key.
|
|
8628
8718
|
*/
|
|
8629
8719
|
type RadfiErrorBody = {
|
|
@@ -8636,8 +8726,8 @@ type RadfiErrorBody = {
|
|
|
8636
8726
|
};
|
|
8637
8727
|
};
|
|
8638
8728
|
/**
|
|
8639
|
-
* Structured error from a
|
|
8640
|
-
* (
|
|
8729
|
+
* Structured error from a Bound Exchange HTTP request. Exposes `status` (HTTP), `code`
|
|
8730
|
+
* (Bound Exchange-specific identifier), and `details` (human-readable) so callers can
|
|
8641
8731
|
* discriminate without fragile string-matching on `message`. The raw response
|
|
8642
8732
|
* body is preserved on `cause` for structured logging.
|
|
8643
8733
|
*/
|
|
@@ -8712,7 +8802,7 @@ declare class RadfiProvider {
|
|
|
8712
8802
|
refreshToken: string;
|
|
8713
8803
|
constructor(config: RadfiConfig);
|
|
8714
8804
|
/**
|
|
8715
|
-
* Authenticate with
|
|
8805
|
+
* Authenticate with Bound Exchange: BIP322-sign a login message, then call the Bound Exchange API.
|
|
8716
8806
|
* Returns accessToken, refreshToken, and tradingAddress.
|
|
8717
8807
|
*/
|
|
8718
8808
|
authenticateWithWallet(walletProvider: IBitcoinWalletProvider, cachedPublicKey?: string): Promise<{
|
|
@@ -8722,8 +8812,8 @@ declare class RadfiProvider {
|
|
|
8722
8812
|
publicKey: string;
|
|
8723
8813
|
}>;
|
|
8724
8814
|
/**
|
|
8725
|
-
* Ensure a valid
|
|
8726
|
-
* If a token exists, validates it via the
|
|
8815
|
+
* Ensure a valid Bound Exchange access token is set on this provider.
|
|
8816
|
+
* If a token exists, validates it via the Bound Exchange API.
|
|
8727
8817
|
* If invalid, tries refreshing with the refresh token first.
|
|
8728
8818
|
* If refresh also fails, falls back to full re-authentication (BIP322 sign).
|
|
8729
8819
|
*/
|
|
@@ -8753,9 +8843,18 @@ declare class RadfiProvider {
|
|
|
8753
8843
|
userAddress: string;
|
|
8754
8844
|
data: string;
|
|
8755
8845
|
}, accessToken: string): Promise<RadfiDepositTxResponse>;
|
|
8846
|
+
/**
|
|
8847
|
+
* Co-sign and broadcast a `sodax-withdraw` deposit via the Bound Exchange API.
|
|
8848
|
+
*
|
|
8849
|
+
* `relayData` ({ address, payload }) is the same `RelayExtraData` the SDK returns from
|
|
8850
|
+
* `createIntent()` / money-market supply etc. It is optional and non-breaking: when supplied,
|
|
8851
|
+
* the Bound Exchange backend persists it so it can auto-resubmit the intent relay if the relay
|
|
8852
|
+
* gets stuck (otherwise a stuck relay eventually refunds instead of completing the swap).
|
|
8853
|
+
*/
|
|
8756
8854
|
requestRadfiSignature(params: {
|
|
8757
8855
|
userAddress: string;
|
|
8758
8856
|
signedBase64Tx: string;
|
|
8857
|
+
relayData?: RelayExtraData;
|
|
8759
8858
|
}, accessToken: string): Promise<string>;
|
|
8760
8859
|
/**
|
|
8761
8860
|
* Fetch expired (or near-expiry) UTXOs for a trading wallet address from UMS API.
|
|
@@ -8765,7 +8864,7 @@ declare class RadfiProvider {
|
|
|
8765
8864
|
pageSize?: number;
|
|
8766
8865
|
}): Promise<RadfiUtxoListResponse>;
|
|
8767
8866
|
/**
|
|
8768
|
-
* Build a renew-utxo transaction via the
|
|
8867
|
+
* Build a renew-utxo transaction via the Bound Exchange API.
|
|
8769
8868
|
* Returns a PSBT that needs to be signed by the user.
|
|
8770
8869
|
*/
|
|
8771
8870
|
buildRenewUtxoTransaction(params: {
|
|
@@ -8773,8 +8872,8 @@ declare class RadfiProvider {
|
|
|
8773
8872
|
txIdVouts: string[];
|
|
8774
8873
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8775
8874
|
/**
|
|
8776
|
-
* Sign and broadcast a renew-utxo transaction via the
|
|
8777
|
-
* The user signs the PSBT first, then
|
|
8875
|
+
* Sign and broadcast a renew-utxo transaction via the Bound Exchange API.
|
|
8876
|
+
* The user signs the PSBT first, then Bound Exchange co-signs and broadcasts.
|
|
8778
8877
|
*/
|
|
8779
8878
|
signAndBroadcastRenewUtxo(params: {
|
|
8780
8879
|
userAddress: string;
|
|
@@ -8791,7 +8890,7 @@ declare class RadfiProvider {
|
|
|
8791
8890
|
withdrawTo: string;
|
|
8792
8891
|
}, accessToken: string): Promise<RadfiBuildTxResponse>;
|
|
8793
8892
|
/**
|
|
8794
|
-
* Sign and broadcast a withdraw transaction via
|
|
8893
|
+
* Sign and broadcast a withdraw transaction via Bound Exchange.
|
|
8795
8894
|
*/
|
|
8796
8895
|
signAndBroadcastWithdraw(params: {
|
|
8797
8896
|
userAddress: string;
|
|
@@ -8819,20 +8918,33 @@ interface BtcPayload {
|
|
|
8819
8918
|
timestamp: number;
|
|
8820
8919
|
address_type: BtcAddressType;
|
|
8821
8920
|
}
|
|
8921
|
+
/**
|
|
8922
|
+
* Calculate the actual vbytes of an OP_RETURN output given the payload byte length.
|
|
8923
|
+
* Accounts for variable-length pushdata opcodes and script-length varints.
|
|
8924
|
+
*/
|
|
8925
|
+
declare function calcOpReturnOutputVbytes(payloadByteLength: number): number;
|
|
8822
8926
|
/**
|
|
8823
8927
|
* Estimate transaction size in vbytes.
|
|
8824
8928
|
* @param addressType — caller's address type for accurate per-input weight.
|
|
8825
8929
|
* P2PKH ≈ 148 vB, P2SH-P2WPKH ≈ 91 vB, P2WPKH ≈ 68 vB, P2TR ≈ 58 vB.
|
|
8826
8930
|
* Defaults to P2WPKH (68 vB) when omitted.
|
|
8931
|
+
* @param opReturnOutputVbytes — actual OP_RETURN output size in vbytes.
|
|
8932
|
+
* Use calcOpReturnOutputVbytes() when the payload size is known. Defaults to 44 vB (~33-byte payload).
|
|
8827
8933
|
*/
|
|
8828
|
-
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType): number;
|
|
8934
|
+
declare function estimateBitcoinTxSize(inputCount: number, outputCount: number, addressType?: BtcAddressType, opReturnOutputVbytes?: number): number;
|
|
8829
8935
|
declare function encodeBtcPayloadToBytes(payload: BtcPayload): string;
|
|
8830
8936
|
/**
|
|
8831
8937
|
* Normalize a signed PSBT to base64 format.
|
|
8832
8938
|
* Unisat/OKX wallets return hex, Xverse returns base64.
|
|
8833
|
-
*
|
|
8939
|
+
* Bound Exchange API expects base64.
|
|
8834
8940
|
*/
|
|
8835
8941
|
declare function normalizePsbtToBase64(signedPsbt: string): string;
|
|
8942
|
+
/**
|
|
8943
|
+
* Normalize a wallet message signature to base64. The intent relay requires the on-demand
|
|
8944
|
+
* withdrawal signature as base64. Browser wallets (UniSat/Xverse/OKX) already return base64; a hex
|
|
8945
|
+
* signature (e.g. a private-key wallet) is encoded. Mirrors `normalizePsbtToBase64`.
|
|
8946
|
+
*/
|
|
8947
|
+
declare function normalizeSignatureToBase64(signature: string): string;
|
|
8836
8948
|
|
|
8837
8949
|
type BitcoinUTXO = {
|
|
8838
8950
|
txid: string;
|
|
@@ -8854,6 +8966,7 @@ interface BitcoinTransactionResult {
|
|
|
8854
8966
|
interface OnDemandBtcPayload {
|
|
8855
8967
|
payload_hex: string;
|
|
8856
8968
|
signature?: string;
|
|
8969
|
+
public_key?: string;
|
|
8857
8970
|
}
|
|
8858
8971
|
declare class BitcoinSpokeService {
|
|
8859
8972
|
private readonly config;
|
|
@@ -8899,7 +9012,7 @@ declare class BitcoinSpokeService {
|
|
|
8899
9012
|
*/
|
|
8900
9013
|
getDeposit(params: GetDepositParams<BitcoinChainKey>): Promise<bigint>;
|
|
8901
9014
|
/**
|
|
8902
|
-
* Fund the
|
|
9015
|
+
* Fund the Bound Exchange trading wallet by sending BTC from the user's personal wallet
|
|
8903
9016
|
*
|
|
8904
9017
|
* @param {bigint} amount - Amount in satoshis to send
|
|
8905
9018
|
* @param {BitcoinSpokeProvider} spokeProvider - The Bitcoin spoke provider (must have signing capability)
|
|
@@ -8920,13 +9033,30 @@ declare class BitcoinSpokeService {
|
|
|
8920
9033
|
sendMessage<Raw extends boolean>(params: SendMessageParams<BitcoinChainKey, Raw> & {
|
|
8921
9034
|
walletMode?: WalletMode;
|
|
8922
9035
|
}): Promise<TxReturnType<BitcoinChainKey, Raw>>;
|
|
9036
|
+
/**
|
|
9037
|
+
* Build the relay submit/poll identity for an on-demand action (borrow/withdraw).
|
|
9038
|
+
*
|
|
9039
|
+
* Bitcoin borrow/withdraw are on-demand: there is no broadcast transaction — the spoke result is
|
|
9040
|
+
* the signed payload JSON produced by {@link encodeWithdrawalData}/{@link sendMessage}. The relay
|
|
9041
|
+
* accepts the submit under the literal `withdraw` tx_hash with the signed payload (as a JSON object)
|
|
9042
|
+
* in `data`, then tracks the resulting packet under a derived id: `od:` + keccak256 of the ASCII
|
|
9043
|
+
* `payload_hex` string (hash the hex characters, not the decoded bytes). Polling must use that
|
|
9044
|
+
* derived id (`pollTxHash`), not `withdraw`.
|
|
9045
|
+
*
|
|
9046
|
+
* @param tx - The JSON-stringified signed payload returned by `sendMessage` / `encodeWithdrawalData`.
|
|
9047
|
+
*/
|
|
9048
|
+
getOnDemandRelayIdentity(tx: string): {
|
|
9049
|
+
srcTxHash: string;
|
|
9050
|
+
data: OnDemandRelayData;
|
|
9051
|
+
pollTxHash: string;
|
|
9052
|
+
};
|
|
8923
9053
|
/**
|
|
8924
9054
|
* Build a priority Bitcoin transaction with proper fee calculation
|
|
8925
9055
|
*/
|
|
8926
9056
|
buildBitcoinTransaction(utxos: BitcoinUTXO[], outputs: Array<{
|
|
8927
9057
|
address: string;
|
|
8928
9058
|
value: number;
|
|
8929
|
-
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number): Promise<Psbt>;
|
|
9059
|
+
}>, changeAddress: string, chainId: BitcoinChainKey, walletProvider: IBitcoinWalletProvider, feeRate?: number, opReturnOutputVbytes?: number): Promise<Psbt>;
|
|
8930
9060
|
/**
|
|
8931
9061
|
* Deposit operation - transfer BTC to the asset manager
|
|
8932
9062
|
*/
|
|
@@ -8941,6 +9071,12 @@ declare class BitcoinSpokeService {
|
|
|
8941
9071
|
* Fetch UTXOs for an address
|
|
8942
9072
|
*/
|
|
8943
9073
|
fetchUTXOs(address: string): Promise<BitcoinUTXO[]>;
|
|
9074
|
+
/**
|
|
9075
|
+
* Returns the set of "txid:vout" outpoints currently being spent by
|
|
9076
|
+
* unconfirmed transactions in the mempool for the given address.
|
|
9077
|
+
* Used to prevent double-spend when building a new PSBT.
|
|
9078
|
+
*/
|
|
9079
|
+
private fetchMempoolSpentOutpoints;
|
|
8944
9080
|
/**
|
|
8945
9081
|
* Fetch raw transaction hex
|
|
8946
9082
|
*/
|
|
@@ -8959,77 +9095,11 @@ declare class BitcoinSpokeService {
|
|
|
8959
9095
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<BitcoinChainKey>): Promise<Result<WaitForTxReceiptReturnType<BitcoinChainKey>>>;
|
|
8960
9096
|
}
|
|
8961
9097
|
|
|
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
9098
|
type QueryResponse = string | number | boolean | object | undefined;
|
|
9031
9099
|
type CallResponse = string | number | object | bigint | boolean;
|
|
9032
9100
|
declare const NEAR_DEFAULT_GAS: bigint;
|
|
9101
|
+
/** NEP-141 default storage bond for a one-time `storage_deposit` registration (0.00125 NEAR). */
|
|
9102
|
+
declare const NEAR_STORAGE_DEPOSIT: bigint;
|
|
9033
9103
|
declare class NearSpokeService {
|
|
9034
9104
|
private readonly config;
|
|
9035
9105
|
readonly rpcProvider: JsonRpcProvider;
|
|
@@ -9060,6 +9130,34 @@ declare class NearSpokeService {
|
|
|
9060
9130
|
* @returns {Promise<bigint>} The balance of the token.
|
|
9061
9131
|
*/
|
|
9062
9132
|
getDeposit(params: GetDepositParams<NearChainKey>): Promise<bigint>;
|
|
9133
|
+
/**
|
|
9134
|
+
* Whether `accountId` is storage-registered on a NEP-141 `token` contract. NEP-141 requires an
|
|
9135
|
+
* account to pay a one-time storage bond before it can receive (hold a balance of) the token, so
|
|
9136
|
+
* this gates any leg that delivers a token to a user on NEAR (swap output on NEAR, bridge into
|
|
9137
|
+
* NEAR, money-market borrow/withdraw to NEAR).
|
|
9138
|
+
*
|
|
9139
|
+
* Native NEAR is not a NEP-141 token and has no storage registration, so this returns `true` for
|
|
9140
|
+
* the native token. The view goes through {@link queryContract}, i.e. the configurable RPC from
|
|
9141
|
+
* chain config — a custom `rpcUrl` passed to the SDK is honoured.
|
|
9142
|
+
*/
|
|
9143
|
+
isStorageRegistered(token: string, accountId: string): Promise<boolean>;
|
|
9144
|
+
/**
|
|
9145
|
+
* Build (and, unless `raw`, submit) a NEP-141 `storage_deposit` registration for `accountId` on
|
|
9146
|
+
* the `token` contract. Call this when {@link isStorageRegistered} is `false` before a token is
|
|
9147
|
+
* delivered to the account on NEAR.
|
|
9148
|
+
*
|
|
9149
|
+
* Native NEAR has no storage registration — passing the native token throws.
|
|
9150
|
+
*
|
|
9151
|
+
* @param params.deposit Storage bond to attach; defaults to {@link NEAR_STORAGE_DEPOSIT}
|
|
9152
|
+
* (0.00125 NEAR). Override per token if its `storage_balance_bounds.min` differs.
|
|
9153
|
+
*/
|
|
9154
|
+
registerStorage<Raw extends boolean = false>(params: {
|
|
9155
|
+
token: string;
|
|
9156
|
+
accountId: string;
|
|
9157
|
+
walletProvider: INearWalletProvider;
|
|
9158
|
+
deposit?: bigint;
|
|
9159
|
+
raw?: Raw;
|
|
9160
|
+
}): Promise<TxReturnType<NearChainKey, Raw>>;
|
|
9063
9161
|
/**
|
|
9064
9162
|
* Sends a message to the hub chain.
|
|
9065
9163
|
* @param {SendMessageParams} params - Includes dstChainKey, the chain key of the hub chain.
|
|
@@ -9634,10 +9732,11 @@ type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResp
|
|
|
9634
9732
|
type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
|
|
9635
9733
|
type RelayAndWaitParams = {
|
|
9636
9734
|
srcTxHash: string;
|
|
9637
|
-
data: RelayExtraData;
|
|
9735
|
+
data: RelayExtraData | OnDemandRelayData;
|
|
9638
9736
|
chainKey: SpokeChainKey;
|
|
9639
9737
|
relayerApiEndpoint: HttpUrl;
|
|
9640
9738
|
timeout: number | undefined;
|
|
9739
|
+
pollTxHash?: string;
|
|
9641
9740
|
};
|
|
9642
9741
|
/**
|
|
9643
9742
|
* Submits a transaction to the intent relay service.
|
|
@@ -11539,6 +11638,20 @@ declare function isOptionalStellarWalletProviderType(walletProvider: IWalletProv
|
|
|
11539
11638
|
declare function isUndefinedOrValidWalletProviderForChainKey<K extends SpokeChainKey>(chainKey: K, walletProvider: IWalletProvider | undefined): walletProvider is GetWalletProviderType<K> | undefined;
|
|
11540
11639
|
declare function isOptionalBitcoinWalletProviderType(walletProvider: IWalletProvider | undefined): walletProvider is IBitcoinWalletProvider | undefined;
|
|
11541
11640
|
|
|
11641
|
+
/**
|
|
11642
|
+
* Default logger. Mirrors the SDK's historical `console.*` behavior so existing consumers
|
|
11643
|
+
* see no change when they don't pass a `logger`. `data` is appended only when present to keep
|
|
11644
|
+
* single-arg log lines unchanged.
|
|
11645
|
+
*/
|
|
11646
|
+
declare const consoleLogger: SodaxLogger;
|
|
11647
|
+
/** No-op logger. Drops every SDK log line. Selected via `new Sodax({ logger: 'silent' })`. */
|
|
11648
|
+
declare const silentLogger: SodaxLogger;
|
|
11649
|
+
/**
|
|
11650
|
+
* Resolve a {@link SodaxLoggerOption} (a preset name, a custom logger, or `undefined`) into a
|
|
11651
|
+
* concrete {@link SodaxLogger}. Defaults to {@link consoleLogger} so logging is on unless opted out.
|
|
11652
|
+
*/
|
|
11653
|
+
declare function resolveLogger(option: SodaxLoggerOption | undefined): SodaxLogger;
|
|
11654
|
+
|
|
11542
11655
|
/** Swap-module narrow error types. */
|
|
11543
11656
|
|
|
11544
11657
|
declare const swapInvariant: FeatureInvariant;
|
|
@@ -11780,7 +11893,7 @@ declare class SwapService {
|
|
|
11780
11893
|
* - `raw: false` — broadcasts the transaction; `walletProvider` is required and must match `K`.
|
|
11781
11894
|
*
|
|
11782
11895
|
* Validates tokens and chain keys against the active `ConfigService` before constructing the
|
|
11783
|
-
* intent. Bitcoin source chains require an additional
|
|
11896
|
+
* intent. Bitcoin source chains require an additional Bound Exchange access token step.
|
|
11784
11897
|
*
|
|
11785
11898
|
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
11786
11899
|
* and optional `skipSimulation` flag.
|
|
@@ -12818,7 +12931,7 @@ declare class BridgeService {
|
|
|
12818
12931
|
* transaction simulation or batching). When `raw` is `false`, signs and submits the deposit
|
|
12819
12932
|
* transaction via the provided wallet provider.
|
|
12820
12933
|
*
|
|
12821
|
-
* Bitcoin is only supported with `raw: false` because it requires the
|
|
12934
|
+
* Bitcoin is only supported with `raw: false` because it requires the Bound Exchange trading wallet
|
|
12822
12935
|
* derivation flow.
|
|
12823
12936
|
*
|
|
12824
12937
|
* @param _params - Bridge parameters including source/destination chain keys, token addresses,
|
|
@@ -15309,6 +15422,15 @@ declare class MoneyMarketService {
|
|
|
15309
15422
|
* trigger the hub-side execution via {@link relayTxAndWaitPacket}.
|
|
15310
15423
|
*/
|
|
15311
15424
|
createSupplyIntent<K extends SpokeChainKey, Raw extends boolean>(_params: MoneyMarketSupplyActionParams<K, Raw>): Promise<Result<IntentTxResult<K, Raw>, MoneyMarketCreateIntentError>>;
|
|
15425
|
+
/**
|
|
15426
|
+
* Build the relay submit/poll identity for a money-market borrow/withdraw.
|
|
15427
|
+
*
|
|
15428
|
+
* Bitcoin borrow/withdraw are on-demand: the spoke result is a signed payload JSON that the relay
|
|
15429
|
+
* submits under the literal "withdraw" tx_hash and tracks under a derived `od:<hash>` poll id
|
|
15430
|
+
* (see {@link BitcoinSpokeService.getOnDemandRelayIdentity}). Every other chain relays and polls by
|
|
15431
|
+
* its real spoke tx hash, so `pollTxHash` is undefined and `srcChainTxHash` stays the spoke tx.
|
|
15432
|
+
*/
|
|
15433
|
+
private buildRelayIdentity;
|
|
15312
15434
|
/**
|
|
15313
15435
|
* Borrow tokens from the money market lending pool and wait for the cross-chain relay to
|
|
15314
15436
|
* deliver the funds to the destination address.
|
|
@@ -15889,6 +16011,480 @@ declare class RecoveryService {
|
|
|
15889
16011
|
withdrawHubAsset<K extends SpokeChainKey, Raw extends boolean>(_params: WithdrawHubAssetAction<K, Raw>): Promise<Result<TxReturnType<K, Raw>>>;
|
|
15890
16012
|
}
|
|
15891
16013
|
|
|
16014
|
+
/**
|
|
16015
|
+
* leverageYield module narrow error types.
|
|
16016
|
+
*
|
|
16017
|
+
* The service owns the full vault-swap lifecycle: `deposit` / `withdraw` build
|
|
16018
|
+
* `CreateIntentParams`, `createVaultIntent` submits the intent on the source spoke chain,
|
|
16019
|
+
* and `vaultSwap` orchestrates the end-to-end flow (create → verify → relay → notify
|
|
16020
|
+
* solver). `approve` / `isAllowanceValid` manage the underlying-asset allowance on Sonic,
|
|
16021
|
+
* and the read methods query on-chain state.
|
|
16022
|
+
*
|
|
16023
|
+
* User-facing actions discriminated by `context.action`: `'deposit' | 'withdraw' |
|
|
16024
|
+
* 'approve' | 'vaultSwap'`. Read-only methods emit `LOOKUP_FAILED` partitioned by
|
|
16025
|
+
* `context.method`. Relay/verify codes appear only on `vaultSwap` — `createVaultIntent`
|
|
16026
|
+
* alone emits the create-intent subset.
|
|
16027
|
+
*/
|
|
16028
|
+
|
|
16029
|
+
declare const leverageYieldInvariant: FeatureInvariant;
|
|
16030
|
+
type LeverageYieldAction = 'deposit' | 'withdraw' | 'approve' | 'allowanceCheck' | 'vaultSwap';
|
|
16031
|
+
type LeverageYieldCreateIntentErrorCode = CreateIntentErrorCode;
|
|
16032
|
+
type LeverageYieldApproveErrorCode = ApproveErrorCode;
|
|
16033
|
+
type LeverageYieldAllowanceCheckErrorCode = AllowanceCheckErrorCode;
|
|
16034
|
+
type LeverageYieldLookupErrorCode = LookupErrorCode;
|
|
16035
|
+
/**
|
|
16036
|
+
* Codes returnable by the solver-notify step inside `vaultSwap`. Mirrors the swap
|
|
16037
|
+
* domain's `PostExecutionErrorCode` — duplicated deliberately so the leverage-yield
|
|
16038
|
+
* error surface stands alone (see `vaultSwap`).
|
|
16039
|
+
*/
|
|
16040
|
+
type LeverageYieldPostExecutionErrorCode = Extract<SodaxErrorCode, 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
16041
|
+
/**
|
|
16042
|
+
* Codes returnable by the end-to-end `vaultSwap` orchestrator: the create-intent subset
|
|
16043
|
+
* plus verify, relay and solver-notify codes. Mirrors the swap domain's `SwapErrorCode`.
|
|
16044
|
+
*/
|
|
16045
|
+
type LeverageYieldSwapErrorCode = Extract<SodaxErrorCode, 'VALIDATION_FAILED' | 'INTENT_CREATION_FAILED' | 'TX_VERIFICATION_FAILED' | 'TX_SUBMIT_FAILED' | 'RELAY_TIMEOUT' | 'RELAY_FAILED' | 'EXECUTION_FAILED' | 'EXTERNAL_API_ERROR' | 'UNKNOWN'>;
|
|
16046
|
+
type LeverageYieldErrorCode = Extract<SodaxErrorCode, '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'>;
|
|
16047
|
+
type LeverageYieldCreateIntentError = SodaxError<LeverageYieldCreateIntentErrorCode>;
|
|
16048
|
+
type LeverageYieldApproveError = SodaxError<LeverageYieldApproveErrorCode>;
|
|
16049
|
+
type LeverageYieldAllowanceCheckError = SodaxError<LeverageYieldAllowanceCheckErrorCode>;
|
|
16050
|
+
type LeverageYieldLookupError = SodaxError<LeverageYieldLookupErrorCode>;
|
|
16051
|
+
type LeverageYieldPostExecutionError = SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16052
|
+
type LeverageYieldSwapError = SodaxError<LeverageYieldSwapErrorCode>;
|
|
16053
|
+
type LeverageYieldError = SodaxError<LeverageYieldErrorCode>;
|
|
16054
|
+
declare const isLeverageYieldCreateIntentError: (e: unknown) => e is SodaxError<CreateIntentErrorCode>;
|
|
16055
|
+
declare const isLeverageYieldApproveError: (e: unknown) => e is SodaxError<ApproveErrorCode>;
|
|
16056
|
+
declare const isLeverageYieldAllowanceCheckError: (e: unknown) => e is SodaxError<AllowanceCheckErrorCode>;
|
|
16057
|
+
declare const isLeverageYieldLookupError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
16058
|
+
declare const isLeverageYieldPostExecutionError: (e: unknown) => e is SodaxError<LeverageYieldPostExecutionErrorCode>;
|
|
16059
|
+
declare const isLeverageYieldSwapError: (e: unknown) => e is SodaxError<LeverageYieldSwapErrorCode>;
|
|
16060
|
+
declare const isLeverageYieldError: (e: unknown) => e is SodaxError<LeverageYieldErrorCode>;
|
|
16061
|
+
|
|
16062
|
+
/**
|
|
16063
|
+
* Leveraged-position snapshot from the vault's non-standard `getPositionDetails()`.
|
|
16064
|
+
* Field scales (mirroring the AAVE conventions the vault inherits):
|
|
16065
|
+
*/
|
|
16066
|
+
type LeverageYieldPosition = {
|
|
16067
|
+
/** Collateral supplied to the AAVE pool, in vault-asset units (18 decimals). */
|
|
16068
|
+
collateral: bigint;
|
|
16069
|
+
/** Variable debt borrowed against the collateral, in vault-asset units (18 decimals). */
|
|
16070
|
+
debt: bigint;
|
|
16071
|
+
/** Current loan-to-value in basis points (out of `10_000`; e.g. `8_500` = 85%). */
|
|
16072
|
+
ltv: bigint;
|
|
16073
|
+
/** AAVE health factor in WAD (1e18); below `1e18` implies liquidation risk, `type(uint256).max` = no debt. */
|
|
16074
|
+
healthFactor: bigint;
|
|
16075
|
+
/** Asset held by the vault but not yet supplied to the pool, in vault-asset units (18 decimals). */
|
|
16076
|
+
idleAsset: bigint;
|
|
16077
|
+
};
|
|
16078
|
+
/**
|
|
16079
|
+
* Output of {@link LeverageYieldService.getApr}. All rate fields are in RAY (1e27 = 100%)
|
|
16080
|
+
* matching the AAVE convention — divide by `RAY = 10n ** 27n` for the decimal form.
|
|
16081
|
+
*
|
|
16082
|
+
* `netAprRay` is the headline number a UI shows: net APR earned by a depositor at the
|
|
16083
|
+
* vault's `targetLTV`. It's a STEADY-STATE APR, not realised APY — assumes the AAVE rates
|
|
16084
|
+
* stay constant and the vault holds at `targetLTV` continuously. Realised APY in practice
|
|
16085
|
+
* depends on tick cadence, rate volatility, and the spread between supplyApr and borrowApr.
|
|
16086
|
+
*
|
|
16087
|
+
* The math:
|
|
16088
|
+
* ```
|
|
16089
|
+
* leverageMultiplier = targetLTV / (1 - targetLTV) // e.g. 0.85 / 0.15 = 5.667x
|
|
16090
|
+
* netAprRay = supplyAprRay + leverageMultiplier × (supplyAprRay - borrowAprRay)
|
|
16091
|
+
* ```
|
|
16092
|
+
* Equivalent to the geometric-series limit of recursive borrow → swap → supply at the
|
|
16093
|
+
* vault's target LTV. When `supplyApr > borrowApr` the leverage adds yield; when the
|
|
16094
|
+
* spread inverts the loop is a net cost and `netAprRay` goes negative.
|
|
16095
|
+
*/
|
|
16096
|
+
type LeverageYieldApr = {
|
|
16097
|
+
/** AAVE supply rate of the vault's `asset` (sodaWEETH-style), in RAY. */
|
|
16098
|
+
supplyAprRay: bigint;
|
|
16099
|
+
/** AAVE variable borrow rate of the vault's `borrowToken` (sodaETH-style), in RAY. */
|
|
16100
|
+
borrowAprRay: bigint;
|
|
16101
|
+
/** Target LTV in basis points, as read from `vault.targetLTV()`. */
|
|
16102
|
+
targetLtvBps: bigint;
|
|
16103
|
+
/**
|
|
16104
|
+
* Leverage multiplier ×1e18 (e.g. 5.667x is `5_666_666_666_666_666_667n`). Caller can
|
|
16105
|
+
* divide by `10n ** 18n` for the decimal form.
|
|
16106
|
+
*/
|
|
16107
|
+
leverageMultiplierWad: bigint;
|
|
16108
|
+
/** Net APR earned by a depositor at `targetLtvBps`, in RAY. Can be negative. */
|
|
16109
|
+
netAprRay: bigint;
|
|
16110
|
+
};
|
|
16111
|
+
/**
|
|
16112
|
+
* Off-chain LSD staking-APR snapshot for a leverage-yield vault's underlying asset.
|
|
16113
|
+
* Returned by {@link LeverageYieldService.getLsdApr} and embedded in
|
|
16114
|
+
* {@link LeverageYieldEffectiveApr}.
|
|
16115
|
+
*/
|
|
16116
|
+
type LeverageYieldLsdApr = {
|
|
16117
|
+
/** LSD staking APR in RAY (1e27 = 100%). Zero when the vault has no configured LSD source. */
|
|
16118
|
+
aprRay: bigint;
|
|
16119
|
+
/** Human-readable provider label, e.g. `'Lido (stETH)'` (suffixed with `(fallback)` on error). */
|
|
16120
|
+
label: string;
|
|
16121
|
+
/**
|
|
16122
|
+
* `true` when this value came from the hardcoded `fallbackAprPct` rather than a live
|
|
16123
|
+
* fetch — either because the provider has no live endpoint (`manual`), the network
|
|
16124
|
+
* call failed, or the vault has no LSD source configured. UIs should label the value
|
|
16125
|
+
* as an estimate in this state.
|
|
16126
|
+
*/
|
|
16127
|
+
stale: boolean;
|
|
16128
|
+
};
|
|
16129
|
+
/**
|
|
16130
|
+
* Combined AAVE + LSD APR view — extends {@link LeverageYieldApr} with the LSD staking
|
|
16131
|
+
* yield folded into the supply side. Returned by {@link LeverageYieldService.getEffectiveApr}.
|
|
16132
|
+
*
|
|
16133
|
+
* The `netAprRay` inherited from {@link LeverageYieldApr} is the **AAVE-only** number —
|
|
16134
|
+
* the negative-spread case the SDK historically reported. `effectiveNetAprRay` is the
|
|
16135
|
+
* honest one for LSD-backed strategies because it includes the LSD's native staking yield,
|
|
16136
|
+
* which is the dominant component for these vaults.
|
|
16137
|
+
*/
|
|
16138
|
+
type LeverageYieldEffectiveApr = LeverageYieldApr & {
|
|
16139
|
+
/** LSD staking APR snapshot used to compute the effective rates. */
|
|
16140
|
+
lsdApr: LeverageYieldLsdApr;
|
|
16141
|
+
/** `supplyAprRay + lsdApr.aprRay`, in RAY — the yield the supply side actually earns. */
|
|
16142
|
+
effectiveSupplyAprRay: bigint;
|
|
16143
|
+
/**
|
|
16144
|
+
* `effectiveSupplyAprRay + leverage × (effectiveSupplyAprRay − borrowAprRay)`, in RAY.
|
|
16145
|
+
* The headline number a UI should display.
|
|
16146
|
+
*/
|
|
16147
|
+
effectiveNetAprRay: bigint;
|
|
16148
|
+
};
|
|
16149
|
+
/**
|
|
16150
|
+
* Builds the swap payload for a swap-style leverage-yield deposit — swapping any
|
|
16151
|
+
* solver-supported `inputToken` on `srcChainKey` into the vault's lsoda* share token,
|
|
16152
|
+
* delivered to the user's hub wallet on Sonic. Spread the result into `swaps.swap()`.
|
|
16153
|
+
*/
|
|
16154
|
+
type LeverageYieldSwapDepositParams = {
|
|
16155
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16156
|
+
vault: Address;
|
|
16157
|
+
/** Spoke chain the user holds `inputToken` on and signs from. */
|
|
16158
|
+
srcChainKey: SpokeChainKey;
|
|
16159
|
+
/** User's EOA on `srcChainKey`. */
|
|
16160
|
+
srcAddress: string;
|
|
16161
|
+
/** Spoke-side token the user pays in. */
|
|
16162
|
+
inputToken: string;
|
|
16163
|
+
/** Amount of `inputToken` to swap (input-token decimals). */
|
|
16164
|
+
inputAmount: bigint;
|
|
16165
|
+
/** Minimum acceptable lsoda* output (18 decimals). Slippage already applied. */
|
|
16166
|
+
minOutputAmount: bigint;
|
|
16167
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16168
|
+
deadline?: bigint;
|
|
16169
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16170
|
+
solver?: Address;
|
|
16171
|
+
/**
|
|
16172
|
+
* Partner fee for this deposit, carried on the payload as the swap layer's per-intent
|
|
16173
|
+
* fee override. Defaults to the globally configured `config.swaps.partnerFee`.
|
|
16174
|
+
*/
|
|
16175
|
+
partnerFee?: PartnerFee;
|
|
16176
|
+
};
|
|
16177
|
+
/**
|
|
16178
|
+
* Builds the swap payload for a swap-style leverage-yield withdraw — swapping the vault's
|
|
16179
|
+
* lsoda* shares (held in the user's hub wallet) back into any solver-supported token on
|
|
16180
|
+
* any chain. The payload carries `hubWalletSwap: true`; spread it into `swaps.swap()`,
|
|
16181
|
+
* which authorises the hub wallet via `Connection.sendMessage`.
|
|
16182
|
+
*/
|
|
16183
|
+
type LeverageYieldSwapWithdrawParams = {
|
|
16184
|
+
/** Hub-side LeverageYieldVault proxy address — its address doubles as the lsoda* token. */
|
|
16185
|
+
vault: Address;
|
|
16186
|
+
/** Spoke chain the user signs the `sendMessage` from (drives hub-wallet derivation). */
|
|
16187
|
+
srcChainKey: SpokeChainKey;
|
|
16188
|
+
/** User's EOA on `srcChainKey`. */
|
|
16189
|
+
srcAddress: string;
|
|
16190
|
+
/** Output chain — where the solver delivers the swapped-back token. */
|
|
16191
|
+
dstChainKey: SpokeChainKey;
|
|
16192
|
+
/** Output spoke-side token address. */
|
|
16193
|
+
outputToken: string;
|
|
16194
|
+
/** Amount of lsoda* shares to swap (18 decimals). */
|
|
16195
|
+
inputAmount: bigint;
|
|
16196
|
+
/** Minimum acceptable output (output-token decimals). Slippage already applied. */
|
|
16197
|
+
minOutputAmount: bigint;
|
|
16198
|
+
/** Recipient on `dstChainKey`. Defaults to `srcAddress`. */
|
|
16199
|
+
recipient?: string;
|
|
16200
|
+
/** Deadline (unix seconds). Defaults to the hub block timestamp + 5 min. */
|
|
16201
|
+
deadline?: bigint;
|
|
16202
|
+
/** Optional specific solver. `0x0` = any solver. */
|
|
16203
|
+
solver?: Address;
|
|
16204
|
+
};
|
|
16205
|
+
/**
|
|
16206
|
+
* Action-shaped swap payload built by {@link LeverageYieldService.deposit} /
|
|
16207
|
+
* {@link LeverageYieldService.withdraw}. Spread it into
|
|
16208
|
+
* {@link LeverageYieldService.vaultSwap} (or {@link LeverageYieldService.createVaultIntent})
|
|
16209
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16210
|
+
* `withdraw` sets `hubWalletSwap: true` so the swap spends the lsoda* held in the
|
|
16211
|
+
* user's hub wallet.
|
|
16212
|
+
*/
|
|
16213
|
+
type LeverageYieldSwapPayload = {
|
|
16214
|
+
params: CreateIntentParams;
|
|
16215
|
+
hubWalletSwap?: true;
|
|
16216
|
+
/** Per-intent partner-fee override (deposit only). */
|
|
16217
|
+
partnerFee?: PartnerFee;
|
|
16218
|
+
};
|
|
16219
|
+
/**
|
|
16220
|
+
* Exec-mode params for {@link LeverageYieldService.createVaultIntent} /
|
|
16221
|
+
* {@link LeverageYieldService.vaultSwap}: `walletProvider` is required and K-narrowed
|
|
16222
|
+
* (`raw: true` returns unsigned tx data instead). The two vault-specific execution
|
|
16223
|
+
* modifiers live HERE — on the leverage-yield action wrapper, never on the generic swap
|
|
16224
|
+
* surface:
|
|
16225
|
+
* - `hubWalletSwap` marks `params.inputToken` as a hub-chain token already sitting in the
|
|
16226
|
+
* user's hub wallet — `srcChainKey` is then the chain the user *signs* on, and the
|
|
16227
|
+
* intent is created by authorising the hub wallet via a `Connection.sendMessage`
|
|
16228
|
+
* instead of a spoke-side AssetManager deposit.
|
|
16229
|
+
* - `partnerFee` overrides the globally configured `config.swaps.partnerFee` for this
|
|
16230
|
+
* intent only.
|
|
16231
|
+
*/
|
|
16232
|
+
type VaultSwapActionParams<K extends SpokeChainKey, Raw extends boolean = false> = SpokeExecActionParams<K, Raw, CreateIntentParams<K>> & {
|
|
16233
|
+
hubWalletSwap?: boolean;
|
|
16234
|
+
partnerFee?: PartnerFee;
|
|
16235
|
+
};
|
|
16236
|
+
/**
|
|
16237
|
+
* Success value of {@link LeverageYieldService.createVaultIntent}. Mirrors the swap
|
|
16238
|
+
* domain's `CreateIntentResult` — duplicated deliberately so the leverage-yield surface
|
|
16239
|
+
* stands alone.
|
|
16240
|
+
*/
|
|
16241
|
+
type CreateVaultIntentResult<K extends SpokeChainKey, Raw extends boolean> = {
|
|
16242
|
+
tx: TxReturnType<K, Raw>;
|
|
16243
|
+
intent: Intent & FeeAmount;
|
|
16244
|
+
relayData: RelayExtraData;
|
|
16245
|
+
};
|
|
16246
|
+
/**
|
|
16247
|
+
* Success value of {@link LeverageYieldService.vaultSwap}. Mirrors the swap domain's
|
|
16248
|
+
* `SwapResponse` — duplicated deliberately so the leverage-yield surface stands alone.
|
|
16249
|
+
*/
|
|
16250
|
+
type VaultSwapResponse = {
|
|
16251
|
+
solverExecutionResponse: SolverExecutionResponse;
|
|
16252
|
+
intent: Intent;
|
|
16253
|
+
intentDeliveryInfo: IntentDeliveryInfo;
|
|
16254
|
+
};
|
|
16255
|
+
type LeverageYieldApproveParams<R extends boolean> = {
|
|
16256
|
+
vault: Address;
|
|
16257
|
+
/** Amount of the vault's underlying asset to approve. */
|
|
16258
|
+
amount: bigint;
|
|
16259
|
+
walletProvider: IEvmWalletProvider;
|
|
16260
|
+
raw?: R;
|
|
16261
|
+
};
|
|
16262
|
+
type LeverageYieldAllowanceParams = {
|
|
16263
|
+
vault: Address;
|
|
16264
|
+
amount: bigint;
|
|
16265
|
+
owner: Address;
|
|
16266
|
+
};
|
|
16267
|
+
type LeverageYieldServiceConstructorParams = {
|
|
16268
|
+
hubProvider: HubProvider;
|
|
16269
|
+
config: ConfigService;
|
|
16270
|
+
spoke: SpokeService;
|
|
16271
|
+
};
|
|
16272
|
+
/**
|
|
16273
|
+
* Treats leverage-yield ERC-4626 vault shares (lsoda* tokens) as solver-tradeable tokens:
|
|
16274
|
+
* deposits and withdrawals are intent-based swaps the service executes itself via
|
|
16275
|
+
* `vaultSwap()` — the generic swap surface stays untouched by vault concerns.
|
|
16276
|
+
*
|
|
16277
|
+
* Methods:
|
|
16278
|
+
* - `deposit` / `withdraw` — build a {@link LeverageYieldSwapPayload} for a swap-style deposit
|
|
16279
|
+
* (any token → lsoda*) and withdraw (lsoda* → any token); spread the result into
|
|
16280
|
+
* `vaultSwap()`. `withdraw` sets `hubWalletSwap: true` so the vault swap spends the lsoda*
|
|
16281
|
+
* held in the user's hub wallet via a `Connection.sendMessage`.
|
|
16282
|
+
* - `createVaultIntent` / `vaultSwap` / `notifySolver` — leverage-yield copies of the swap
|
|
16283
|
+
* domain's `createIntent` / `swap()` / `postExecution` (duplicated deliberately — the vault
|
|
16284
|
+
* execution modifiers `hubWalletSwap` and per-intent `partnerFee` live here, not on the swap
|
|
16285
|
+
* domain). `createVaultIntent` submits the intent tx on the source spoke chain; `vaultSwap`
|
|
16286
|
+
* orchestrates the full create → verify → relay → notify-solver lifecycle; `notifySolver` is
|
|
16287
|
+
* the standalone notify step, public so callers driving the relay themselves (after a
|
|
16288
|
+
* `createVaultIntent`) can complete the flow.
|
|
16289
|
+
* - `approve` / `isAllowanceValid` — Sonic-direct allowance management for the vault's
|
|
16290
|
+
* underlying asset (sodaWEETH-style).
|
|
16291
|
+
* - `getPosition` / `getApr` / `getEffectiveApr` / `getLsdApr` / `getMaxWithdraw` /
|
|
16292
|
+
* `getMaxWithdrawForUser` / `getShareBalance` / `getShareBalanceForUser` /
|
|
16293
|
+
* `getTotalAssets` / `previewDeposit` / `previewWithdraw` / `previewRedeem` — reads.
|
|
16294
|
+
* Use `getEffectiveApr` for the honest LSD-aware APR; `getApr` reports the AAVE-only
|
|
16295
|
+
* spread and goes negative when the LSD's native staking yield is the alpha source.
|
|
16296
|
+
* - `listVaults` / `getVault` / `getVaultByAddress` — registry lookups.
|
|
16297
|
+
*/
|
|
16298
|
+
declare class LeverageYieldService {
|
|
16299
|
+
private readonly hubProvider;
|
|
16300
|
+
private readonly config;
|
|
16301
|
+
private readonly spoke;
|
|
16302
|
+
constructor({ hubProvider, config, spoke }: LeverageYieldServiceConstructorParams);
|
|
16303
|
+
/** Returns the static registry of known leverage-yield vaults. */
|
|
16304
|
+
listVaults(): readonly LeverageYieldVault[];
|
|
16305
|
+
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
16306
|
+
getVault(name: string): LeverageYieldVault | undefined;
|
|
16307
|
+
/**
|
|
16308
|
+
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
16309
|
+
* Returns `undefined` when the address isn't in the registry.
|
|
16310
|
+
*/
|
|
16311
|
+
getVaultByAddress(address: Address): LeverageYieldVault | undefined;
|
|
16312
|
+
/**
|
|
16313
|
+
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
16314
|
+
* derives a default from the hub-chain (Sonic) block timestamp plus
|
|
16315
|
+
* {@link INTENT_DEADLINE_BUFFER_SECONDS}. The deadline is enforced on-chain against the hub
|
|
16316
|
+
* block time, so the default is anchored to that block — never the client clock, which can
|
|
16317
|
+
* drift and produce an already-expired or over-extended deadline.
|
|
16318
|
+
*
|
|
16319
|
+
* Returns a {@link Result}: a `getBlock` RPC outage is a read failure, surfaced as
|
|
16320
|
+
* `LOOKUP_FAILED` (`method: 'resolveDeadline'`) rather than masquerading as an intent-build
|
|
16321
|
+
* failure. The `deposit` / `withdraw` callers forward it verbatim.
|
|
16322
|
+
*/
|
|
16323
|
+
private resolveDeadline;
|
|
16324
|
+
/**
|
|
16325
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield deposit (any token → lsoda*).
|
|
16326
|
+
* The lsoda* output is delivered to the user's hub wallet on Sonic so a later
|
|
16327
|
+
* {@link LeverageYieldService.withdraw} can swap it back. Spread the result into
|
|
16328
|
+
* {@link LeverageYieldService.vaultSwap}: `vaultSwap({ ...payload, walletProvider })`.
|
|
16329
|
+
* An optional `partnerFee` is forwarded on the payload as the per-intent fee override.
|
|
16330
|
+
*
|
|
16331
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16332
|
+
* destination token (`token_dst`) — vault shares are solver-tradeable, so the generic swap
|
|
16333
|
+
* quote applies; then subtract your slippage tolerance.
|
|
16334
|
+
*/
|
|
16335
|
+
deposit(params: LeverageYieldSwapDepositParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16336
|
+
/**
|
|
16337
|
+
* Builds the {@link LeverageYieldSwapPayload} for a leverage-yield withdraw (lsoda* → any
|
|
16338
|
+
* token). The payload carries `hubWalletSwap: true` — {@link LeverageYieldService.vaultSwap}
|
|
16339
|
+
* then spends the lsoda* held in the user's hub wallet by authorising it via a
|
|
16340
|
+
* `Connection.sendMessage` the user signs on `srcChainKey`. Wrapped in a {@link Result} for
|
|
16341
|
+
* a call shape uniform with {@link LeverageYieldService.deposit}; async because the default
|
|
16342
|
+
* `deadline` is read from the hub block timestamp.
|
|
16343
|
+
*
|
|
16344
|
+
* For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
|
|
16345
|
+
* source token (`token_src`) — vault shares are solver-tradeable, so the generic swap quote
|
|
16346
|
+
* applies; then subtract your slippage tolerance.
|
|
16347
|
+
*/
|
|
16348
|
+
withdraw(params: LeverageYieldSwapWithdrawParams): Promise<Result<LeverageYieldSwapPayload, LeverageYieldCreateIntentError | LeverageYieldLookupError>>;
|
|
16349
|
+
/**
|
|
16350
|
+
* Creates a vault swap intent on the user's source spoke chain without submitting it to
|
|
16351
|
+
* the solver. Leverage-yield copy of the swap domain's `createIntent`, specialised for
|
|
16352
|
+
* vault flows — duplicated deliberately so the vault-specific execution modifiers
|
|
16353
|
+
* (`hubWalletSwap`, per-intent `partnerFee`) stay off the generic swap surface.
|
|
16354
|
+
*
|
|
16355
|
+
* Use {@link LeverageYieldService.vaultSwap} for the full end-to-end flow
|
|
16356
|
+
* (create → relay → notify solver); use this directly when you need the raw transaction
|
|
16357
|
+
* or drive the relay yourself (e.g. the backend submit-tx path). To complete a manual flow,
|
|
16358
|
+
* relay the returned `relayData` (the shared `relayTxAndWaitPacket` helper) and then call
|
|
16359
|
+
* {@link LeverageYieldService.notifySolver} with the hub-side intent tx hash.
|
|
16360
|
+
*
|
|
16361
|
+
* @param _params - Intent parameters, source chain key, wallet provider (when `raw: false`),
|
|
16362
|
+
* and optional `skipSimulation` / `hubWalletSwap` / `partnerFee`.
|
|
16363
|
+
* @returns A `Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>`.
|
|
16364
|
+
* On success contains:
|
|
16365
|
+
* - `tx` — chain-specific tx hash (executed) or raw tx data (raw mode).
|
|
16366
|
+
* - `intent` — the fully constructed `Intent` object augmented with `feeAmount`.
|
|
16367
|
+
* - `relayData` — `{ address, payload }` needed to submit the intent to the relayer.
|
|
16368
|
+
*
|
|
16369
|
+
* On failure `result.error` is a SodaxError with `VALIDATION_FAILED` (invariant
|
|
16370
|
+
* precondition), `INTENT_CREATION_FAILED` (spoke-side creation/deposit failed) or
|
|
16371
|
+
* `UNKNOWN` (defensive fallback).
|
|
16372
|
+
*/
|
|
16373
|
+
createVaultIntent<K extends SpokeChainKey, Raw extends boolean>(_params: VaultSwapActionParams<K, Raw>): Promise<Result<CreateVaultIntentResult<K, Raw>, LeverageYieldCreateIntentError>>;
|
|
16374
|
+
/**
|
|
16375
|
+
* Executes a full end-to-end leverage-yield vault swap (deposit or withdraw).
|
|
16376
|
+
* Leverage-yield copy of the swap domain's `swap()` orchestrator:
|
|
16377
|
+
* 1. Calls {@link LeverageYieldService.createVaultIntent} to submit the intent
|
|
16378
|
+
* transaction on the source spoke chain.
|
|
16379
|
+
* 2. Verifies the spoke transaction landed on-chain.
|
|
16380
|
+
* 3. For non-hub source chains: submits the spoke tx to the relayer and waits for the
|
|
16381
|
+
* relay packet to land on the hub (Sonic). Skipped when `srcChainKey` is the hub.
|
|
16382
|
+
* 4. Notifies the solver, triggering it to fill the intent.
|
|
16383
|
+
*
|
|
16384
|
+
* Spread a {@link LeverageYieldSwapPayload} from `deposit` / `withdraw` into this method
|
|
16385
|
+
* alongside the wallet provider: `vaultSwap({ ...payload, walletProvider })`.
|
|
16386
|
+
*
|
|
16387
|
+
* @returns A `Result<VaultSwapResponse, LeverageYieldSwapError>`. On success:
|
|
16388
|
+
* - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
|
|
16389
|
+
* - `intent` — the on-chain intent object that was created.
|
|
16390
|
+
* - `intentDeliveryInfo` — source/destination chain keys, tx hashes, and user addresses.
|
|
16391
|
+
*
|
|
16392
|
+
* On failure `result.error` carries one of the create-intent codes plus
|
|
16393
|
+
* `TX_VERIFICATION_FAILED`, `TX_SUBMIT_FAILED`, `RELAY_TIMEOUT`, `RELAY_FAILED`,
|
|
16394
|
+
* `EXECUTION_FAILED`, `EXTERNAL_API_ERROR` or `UNKNOWN`.
|
|
16395
|
+
*/
|
|
16396
|
+
vaultSwap<K extends SpokeChainKey>(_params: VaultSwapActionParams<K, false>): Promise<Result<VaultSwapResponse, LeverageYieldSwapError>>;
|
|
16397
|
+
/**
|
|
16398
|
+
* Notifies the solver that the vault intent landed on the hub, triggering it to fill.
|
|
16399
|
+
* Leverage-yield copy of the swap domain's `postExecution` — emits only
|
|
16400
|
+
* `EXECUTION_FAILED` / `EXTERNAL_API_ERROR` / `UNKNOWN` (relay/verify codes appear only
|
|
16401
|
+
* on {@link LeverageYieldService.vaultSwap}, which owns the verify + relay steps).
|
|
16402
|
+
*
|
|
16403
|
+
* Called automatically by {@link LeverageYieldService.vaultSwap} after the relay packet
|
|
16404
|
+
* lands on the hub. Public so callers who created the intent via
|
|
16405
|
+
* {@link LeverageYieldService.createVaultIntent} and relayed it themselves can finish the
|
|
16406
|
+
* flow manually.
|
|
16407
|
+
*
|
|
16408
|
+
* @param request - `{ intent_tx_hash }` — the hub-chain (Sonic) tx hash where the intent
|
|
16409
|
+
* was registered (the relay packet's `dst_tx_hash`, or the spoke tx hash for hub-sourced
|
|
16410
|
+
* intents).
|
|
16411
|
+
*/
|
|
16412
|
+
notifySolver(request: SolverExecutionRequest): Promise<Result<SolverExecutionResponse, LeverageYieldPostExecutionError>>;
|
|
16413
|
+
/**
|
|
16414
|
+
* Approves the vault's underlying asset to the leverage vault on Sonic. For callers
|
|
16415
|
+
* interacting with the vault directly on the hub — the swap-style {@link
|
|
16416
|
+
* LeverageYieldService.deposit} flow handles its own approvals.
|
|
16417
|
+
*/
|
|
16418
|
+
approve<R extends boolean = false>(params: LeverageYieldApproveParams<R>): Promise<Result<TxReturnType<HubChainKey, R>, LeverageYieldApproveError>>;
|
|
16419
|
+
/**
|
|
16420
|
+
* Reads on-chain allowance of the vault's underlying asset for `owner → vault`. Returns
|
|
16421
|
+
* `true` when the allowance covers `amount`. Use before a direct
|
|
16422
|
+
* {@link LeverageYieldService.deposit}.
|
|
16423
|
+
*/
|
|
16424
|
+
isAllowanceValid(params: LeverageYieldAllowanceParams): Promise<Result<boolean, LeverageYieldAllowanceCheckError>>;
|
|
16425
|
+
/** ERC-4626 `asset()` of the vault — the sodaWEETH-style underlying. */
|
|
16426
|
+
getAsset(vault: Address): Promise<Result<Address, LeverageYieldLookupError>>;
|
|
16427
|
+
/** Reads the vault's leveraged position snapshot via the non-standard `getPositionDetails`. */
|
|
16428
|
+
getPosition(vault: Address): Promise<Result<LeverageYieldPosition, LeverageYieldLookupError>>;
|
|
16429
|
+
/**
|
|
16430
|
+
* Computes the steady-state APR of a leverage-yield vault from the AAVE supply/borrow
|
|
16431
|
+
* rates of its asset and borrowToken, scaled by the vault's target leverage. Matches the
|
|
16432
|
+
* convention used by leveraged-LSD vaults (Origami, Gearbox, etc.) — assumes constant
|
|
16433
|
+
* LTV at `targetLTV` and constant AAVE rates.
|
|
16434
|
+
*
|
|
16435
|
+
* Returns raw fields in RAY (1e27, AAVE's native rate scale) plus the leverage multiplier
|
|
16436
|
+
* in WAD (1e18). See {@link LeverageYieldApr} for the formula and caveats.
|
|
16437
|
+
*/
|
|
16438
|
+
getApr(vault: Address): Promise<Result<LeverageYieldApr, LeverageYieldLookupError>>;
|
|
16439
|
+
/**
|
|
16440
|
+
* Off-chain LSD staking-APR for the vault's underlying asset. Looks the vault up in the
|
|
16441
|
+
* registry, hits DefiLlama's per-pool chart endpoint for the configured `poolId`, and on
|
|
16442
|
+
* any fetch failure returns the registry's hardcoded `fallbackAprPct` with `stale: true`.
|
|
16443
|
+
*
|
|
16444
|
+
* Always resolves to `{ ok: true, ... }` for a known vault — the fallback path replaces
|
|
16445
|
+
* the error, since a missing LSD APR shouldn't break the parent call. Returns
|
|
16446
|
+
* `{ aprRay: 0n, stale: true, label: 'no LSD source' }` for vaults without an
|
|
16447
|
+
* `lsdSource` configured (non-LSD strategies); callers can treat that as "skip LSD".
|
|
16448
|
+
*/
|
|
16449
|
+
getLsdApr(vault: Address): Promise<Result<LeverageYieldLsdApr, LeverageYieldLookupError>>;
|
|
16450
|
+
/**
|
|
16451
|
+
* Combined view of {@link getApr} + {@link getLsdApr}: re-applies the vault's leverage
|
|
16452
|
+
* formula with the LSD's native staking yield folded into the supply side, exposing the
|
|
16453
|
+
* **effective** net APR that LSD-backed strategies actually earn. The AAVE-only
|
|
16454
|
+
* `netAprRay` is preserved on the return value for callers who want to display both.
|
|
16455
|
+
*
|
|
16456
|
+
* effectiveSupply = supplyAprRay + lsdApr.aprRay
|
|
16457
|
+
* effectiveNet = effectiveSupply + leverage × (effectiveSupply − borrowAprRay)
|
|
16458
|
+
*
|
|
16459
|
+
* Fetches AAVE rates and the LSD APR in parallel for one round-trip's worth of latency.
|
|
16460
|
+
*/
|
|
16461
|
+
getEffectiveApr(vault: Address): Promise<Result<LeverageYieldEffectiveApr, LeverageYieldLookupError>>;
|
|
16462
|
+
/** Synchronously withdrawable assets for `owner` (clamped against leverage HF floor). */
|
|
16463
|
+
getMaxWithdraw(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16464
|
+
/** Total underlying assets currently held by the vault (vault-asset units, 18 decimals) — TVL. */
|
|
16465
|
+
getTotalAssets(vault: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16466
|
+
/** Shares minted for a given asset deposit. */
|
|
16467
|
+
previewDeposit(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16468
|
+
/** Shares burned for a given asset withdrawal. */
|
|
16469
|
+
previewWithdraw(vault: Address, assets: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16470
|
+
/** Assets received for a given share redemption. */
|
|
16471
|
+
previewRedeem(vault: Address, shares: bigint): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16472
|
+
/** Vault shares held by `owner`. */
|
|
16473
|
+
getShareBalance(vault: Address, owner: Address): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16474
|
+
/**
|
|
16475
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
16476
|
+
* returns its on-chain `maxWithdraw`, less {@link MAX_WITHDRAW_DUST_BUFFER}. The trim
|
|
16477
|
+
* keeps the value safe for an asset-denominated ERC-4626 `withdraw` — the raw
|
|
16478
|
+
* `maxWithdraw` can trip the round-up that asks for one more share than the user holds.
|
|
16479
|
+
*/
|
|
16480
|
+
getMaxWithdrawForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16481
|
+
/**
|
|
16482
|
+
* Convenience: resolves the user's hub wallet from `(srcChainKey, srcAddress)` and
|
|
16483
|
+
* returns its on-chain share balance.
|
|
16484
|
+
*/
|
|
16485
|
+
getShareBalanceForUser<K extends SpokeChainKey>(vault: Address, srcChainKey: K, srcAddress: string): Promise<Result<bigint, LeverageYieldLookupError>>;
|
|
16486
|
+
}
|
|
16487
|
+
|
|
15892
16488
|
/**
|
|
15893
16489
|
* Sodax class is used to interact with the Sodax.
|
|
15894
16490
|
*
|
|
@@ -15905,10 +16501,11 @@ declare class Sodax {
|
|
|
15905
16501
|
readonly partners: PartnerService;
|
|
15906
16502
|
readonly recovery: RecoveryService;
|
|
15907
16503
|
readonly dex: DexService;
|
|
16504
|
+
readonly leverageYield: LeverageYieldService;
|
|
15908
16505
|
readonly config: ConfigService;
|
|
15909
16506
|
readonly hubProvider: HubProvider;
|
|
15910
16507
|
readonly spoke: SpokeService;
|
|
15911
|
-
constructor(config?:
|
|
16508
|
+
constructor(config?: SodaxOptions);
|
|
15912
16509
|
/**
|
|
15913
16510
|
* Initializes the Sodax instance with dynamic configuration.
|
|
15914
16511
|
* You should use this option if you do not want to update package versions when new chains and tokens are added.
|
|
@@ -16222,7 +16819,7 @@ declare class SolverApiService {
|
|
|
16222
16819
|
* @param config - Solver endpoint configuration.
|
|
16223
16820
|
* @returns A `Result` containing `{ answer: 'OK', intent_hash: Hex }` on success.
|
|
16224
16821
|
*/
|
|
16225
|
-
static postExecution(request: SolverExecutionRequest, config: SolverConfig): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
16822
|
+
static postExecution(request: SolverExecutionRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverExecutionResponse, SolverErrorResponse>>;
|
|
16226
16823
|
/**
|
|
16227
16824
|
* Polls the solver API for the current execution status of an intent (`POST /status`).
|
|
16228
16825
|
*
|
|
@@ -16232,7 +16829,7 @@ declare class SolverApiService {
|
|
|
16232
16829
|
* `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
|
|
16233
16830
|
* @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
|
|
16234
16831
|
*/
|
|
16235
|
-
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
16832
|
+
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig, logger?: SodaxLogger): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
16236
16833
|
}
|
|
16237
16834
|
|
|
16238
16835
|
/**
|
|
@@ -16465,4 +17062,4 @@ type DexErrorCode = LookupErrorCode;
|
|
|
16465
17062
|
type DexError = SodaxError<DexErrorCode>;
|
|
16466
17063
|
declare const isDexError: (e: unknown) => e is SodaxError<LookupErrorCode>;
|
|
16467
17064
|
|
|
16468
|
-
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 };
|
|
17065
|
+
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 CreateVaultIntentResult, 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 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, 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 VaultSwapActionParams, type VaultSwapResponse, type VerifySimulationParams, type VerifyTxHashParams, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitForTxReceiptParams, type WaitForTxReceiptReturnType, type WaitUntilIntentExecutedPayload, type WalletMode, type WalletSimulationParams, type WithdrawHubAssetAction, type WithdrawHubAssetParams, type WithdrawInfo, adjustAmountByFee, allowanceCheckFailed, approveFailed, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bridgeInvariant, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, dexInvariant, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getCompoundedBalance, getConnectionIdl, getConnectionProgram, getEvmViemChain, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hyper, intentCreationFailed, isBalnMigrateParams, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexError, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isHubChainKeyType, isIconAddress, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNearChainKeyType, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKeyType, isStellarWalletProviderType, isSubmitSwapTxResponse, isSubmitSwapTxStatusResponse, isSuiChainKeyType, isSwapCreateIntentError, isSwapError, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, leverageYieldInvariant, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, nativeToUSD, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveLogger, retry, reverseEncodeAddress, serializeAddressData, silentLogger, sleep, sodaxInvariant, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, submitTransaction, swapExactInSingleParamsAbi, swapInvariant, uiPoolDataAbi, universalRouterAbi, unknownFailed, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|