@sodax/dapp-kit 1.3.1-beta-rc3 → 1.3.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/index.d.mts +581 -11
- package/dist/index.d.ts +581 -11
- package/dist/index.js +691 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +672 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/bitcoin/index.ts +1 -0
- package/src/hooks/bitcoin/useRadfiAuth.ts +7 -25
- package/src/hooks/bitcoin/useRadfiSession.ts +25 -47
- package/src/hooks/bitcoin/useRadfiWithdraw.ts +85 -0
- package/src/hooks/bitcoin/useRenewUtxos.ts +1 -1
- package/src/hooks/dex/index.ts +16 -0
- package/src/hooks/dex/useClaimRewards.ts +68 -0
- package/src/hooks/dex/useCreateDecreaseLiquidityParams.ts +41 -0
- package/src/hooks/dex/useCreateDepositParams.ts +43 -0
- package/src/hooks/dex/useCreateSupplyLiquidityParams.ts +84 -0
- package/src/hooks/dex/useCreateWithdrawParams.ts +44 -0
- package/src/hooks/dex/useDecreaseLiquidity.ts +78 -0
- package/src/hooks/dex/useDexAllowance.ts +87 -0
- package/src/hooks/dex/useDexApprove.ts +55 -0
- package/src/hooks/dex/useDexDeposit.ts +64 -0
- package/src/hooks/dex/useDexWithdraw.ts +54 -0
- package/src/hooks/dex/useLiquidityAmounts.ts +187 -0
- package/src/hooks/dex/usePoolBalances.ts +90 -0
- package/src/hooks/dex/usePoolData.ts +57 -0
- package/src/hooks/dex/usePools.ts +48 -0
- package/src/hooks/dex/usePositionInfo.ts +88 -0
- package/src/hooks/dex/useSupplyLiquidity.ts +91 -0
- package/src/hooks/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/utils/dex-utils.ts +177 -0
- package/src/utils/index.ts +1 -0
- package/src/hooks/bitcoin/radfiConstants.ts +0 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, RequestOverrideConfig, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
1
|
+
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, RequestOverrideConfig, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, PoolKey, PoolData, ClPositionInfo, CreateAssetDepositParams, CreateAssetWithdrawParams, ConcentratedLiquiditySupplyParams, ConcentratedLiquidityIncreaseLiquidityParams, ConcentratedLiquidityDecreaseLiquidityParams, PoolSpokeAssets, DestinationParamsType, ConcentratedLiquidityClaimRewardsParams, ConcentratedLiquidityError, ConcentratedLiquidityErrorCode, SodaxConfig } from '@sodax/sdk';
|
|
2
2
|
import { RpcConfig, SpokeChainId as SpokeChainId$1, SubmitSwapTxResponse, SubmitSwapTxRequest, SubmitSwapTxStatusResponse, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
-
import { UseMutationResult, UseQueryResult, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
import { UseMutationResult, UseQueryResult, UseQueryOptions, UseMutationOptions, QueryObserverOptions } from '@tanstack/react-query';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
6
|
|
|
@@ -184,8 +184,6 @@ type RadfiSession = {
|
|
|
184
184
|
refreshToken: string;
|
|
185
185
|
tradingAddress: string;
|
|
186
186
|
publicKey: string;
|
|
187
|
-
accessTokenExpiry: number;
|
|
188
|
-
refreshTokenExpiry: number;
|
|
189
187
|
};
|
|
190
188
|
type RadfiAuthResult = {
|
|
191
189
|
accessToken: string;
|
|
@@ -195,11 +193,9 @@ type RadfiAuthResult = {
|
|
|
195
193
|
declare function saveRadfiSession(address: string, session: RadfiSession): void;
|
|
196
194
|
declare function loadRadfiSession(address: string): RadfiSession | null;
|
|
197
195
|
declare function clearRadfiSession(address: string): void;
|
|
198
|
-
declare function isAccessTokenExpired(address: string): boolean;
|
|
199
|
-
declare function isRefreshTokenExpired(address: string): boolean;
|
|
200
196
|
/**
|
|
201
197
|
* Hook to authenticate with Radfi using BIP322 message signing.
|
|
202
|
-
* Saves
|
|
198
|
+
* Saves session (accessToken, refreshToken, tradingAddress, publicKey) to localStorage.
|
|
203
199
|
*/
|
|
204
200
|
declare function useRadfiAuth(spokeProvider: BitcoinSpokeProvider | undefined): UseMutationResult<RadfiAuthResult, Error, void>;
|
|
205
201
|
|
|
@@ -212,8 +208,9 @@ type UseRadfiSessionReturn = {
|
|
|
212
208
|
};
|
|
213
209
|
/**
|
|
214
210
|
* Manages the full Radfi session lifecycle:
|
|
215
|
-
* -
|
|
216
|
-
* -
|
|
211
|
+
* - On mount / wallet switch: refreshes token to validate session
|
|
212
|
+
* - Single interval (~5 min): refreshes access token. If refresh fails → clears session, isAuthed=false
|
|
213
|
+
* - ensureRadfiAccessToken (SDK layer) acts as safety net before swap/bridge
|
|
217
214
|
* - Exposes login() and isAuthed for UI
|
|
218
215
|
*/
|
|
219
216
|
declare function useRadfiSession(spokeProvider: BitcoinSpokeProvider | undefined): UseRadfiSessionReturn;
|
|
@@ -274,7 +271,7 @@ type RenewUtxosParams = {
|
|
|
274
271
|
* const { mutateAsync: renewUtxos, isPending } = useRenewUtxos(spokeProvider);
|
|
275
272
|
*
|
|
276
273
|
* const handleRenew = async (expiredUtxos: RadfiUtxo[]) => {
|
|
277
|
-
* const txIdVouts = expiredUtxos.map(u =>
|
|
274
|
+
* const txIdVouts = expiredUtxos.map(u => u.txidVout);
|
|
278
275
|
* const txId = await renewUtxos({ txIdVouts });
|
|
279
276
|
* console.log('Renewed:', txId);
|
|
280
277
|
* };
|
|
@@ -282,6 +279,39 @@ type RenewUtxosParams = {
|
|
|
282
279
|
*/
|
|
283
280
|
declare function useRenewUtxos(spokeProvider: BitcoinSpokeProvider | undefined): UseMutationResult<string, Error, RenewUtxosParams>;
|
|
284
281
|
|
|
282
|
+
type WithdrawToUserParams = {
|
|
283
|
+
amount: string;
|
|
284
|
+
tokenId: string;
|
|
285
|
+
withdrawTo: string;
|
|
286
|
+
};
|
|
287
|
+
type WithdrawResult = {
|
|
288
|
+
txId: string;
|
|
289
|
+
fee: number;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Hook to withdraw BTC from Radfi trading wallet to user's personal wallet.
|
|
293
|
+
*
|
|
294
|
+
* Flow:
|
|
295
|
+
* 1. Build withdraw transaction via Radfi API (returns unsigned PSBT)
|
|
296
|
+
* 2. User signs the PSBT with their wallet
|
|
297
|
+
* 3. Submit signed PSBT back to Radfi for co-signing and broadcasting
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```tsx
|
|
301
|
+
* const { mutateAsync: withdraw, isPending } = useRadfiWithdraw(spokeProvider);
|
|
302
|
+
*
|
|
303
|
+
* const handleWithdraw = async () => {
|
|
304
|
+
* const result = await withdraw({
|
|
305
|
+
* amount: '10000',
|
|
306
|
+
* tokenId: '0:0',
|
|
307
|
+
* withdrawTo: 'bc1q...', // user's segwit address
|
|
308
|
+
* });
|
|
309
|
+
* console.log('Withdrawn:', result.txId);
|
|
310
|
+
* };
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
declare function useRadfiWithdraw(spokeProvider: BitcoinSpokeProvider | undefined): UseMutationResult<WithdrawResult, Error, WithdrawToUserParams>;
|
|
314
|
+
|
|
285
315
|
interface BorrowResponse {
|
|
286
316
|
ok: true;
|
|
287
317
|
value: [string, string];
|
|
@@ -2000,6 +2030,541 @@ interface UseApproveReturn {
|
|
|
2000
2030
|
*/
|
|
2001
2031
|
declare function useMigrationApprove(params: MigrationIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn;
|
|
2002
2032
|
|
|
2033
|
+
type UsePoolsProps = {
|
|
2034
|
+
/**
|
|
2035
|
+
* Optional react-query QueryObserverOptions for customizing query behavior such as
|
|
2036
|
+
* staleTime, refetchInterval, cacheTime, etc. These are merged with sensible defaults.
|
|
2037
|
+
*/
|
|
2038
|
+
queryOptions?: QueryObserverOptions<PoolKey[], Error>;
|
|
2039
|
+
};
|
|
2040
|
+
/**
|
|
2041
|
+
* Loads and caches the available list of pools from the DEX service's ConcentratedLiquidityService.
|
|
2042
|
+
*
|
|
2043
|
+
* By default, the query result is cached indefinitely (with `staleTime` set to Infinity), reflecting the
|
|
2044
|
+
* assumption that the pools list is mostly static.
|
|
2045
|
+
*
|
|
2046
|
+
* @param params
|
|
2047
|
+
* Optional configuration object:
|
|
2048
|
+
* - queryOptions: Partial QueryObserverOptions for react-query (merged with built-in defaults).
|
|
2049
|
+
*
|
|
2050
|
+
* @returns
|
|
2051
|
+
* A UseQueryResult object from @tanstack/react-query containing:
|
|
2052
|
+
* - `data`: Array of PoolKey objects or undefined if not loaded or errored.
|
|
2053
|
+
* - Status fields: `isLoading`, `isError`, `error`, etc.
|
|
2054
|
+
*
|
|
2055
|
+
* @example
|
|
2056
|
+
* const { data: pools, isLoading, error } = usePools();
|
|
2057
|
+
* if (isLoading) return <div>Loading pools...</div>;
|
|
2058
|
+
* if (error) return <div>Error: {error.message}</div>;
|
|
2059
|
+
* if (pools) pools.forEach((pool, idx) => console.log(pool.id, pool.fee));
|
|
2060
|
+
*/
|
|
2061
|
+
declare function usePools(params?: UsePoolsProps): UseQueryResult<PoolKey[], Error>;
|
|
2062
|
+
|
|
2063
|
+
type UsePoolDataProps = {
|
|
2064
|
+
poolKey: PoolKey | null;
|
|
2065
|
+
enabled?: boolean;
|
|
2066
|
+
queryOptions?: QueryObserverOptions<PoolData, Error>;
|
|
2067
|
+
};
|
|
2068
|
+
/**
|
|
2069
|
+
* React hook to fetch on-chain data for a given DEX pool.
|
|
2070
|
+
*
|
|
2071
|
+
* @param {UsePoolDataProps} props - The props object:
|
|
2072
|
+
* - `poolKey`: PoolKey | null — The unique identifier for the pool to fetch data for. If null, disables the query.
|
|
2073
|
+
* - `enabled`: boolean (optional) — Whether the query is enabled. Defaults to enabled if a poolKey is provided, otherwise false.
|
|
2074
|
+
* - `queryOptions`: QueryObserverOptions<PoolData, Error> (optional) — Additional React Query options (e.g., staleTime, refetchInterval).
|
|
2075
|
+
*
|
|
2076
|
+
* @returns {UseQueryResult<PoolData, Error>} React Query result containing pool data (`data`), loading state (`isLoading`), error (`error`), and status fields.
|
|
2077
|
+
*
|
|
2078
|
+
* @example
|
|
2079
|
+
* ```typescript
|
|
2080
|
+
* const { data: poolData, isLoading, error } = usePoolData({ poolKey });
|
|
2081
|
+
* if (isLoading) return <div>Loading…</div>;
|
|
2082
|
+
* if (error) return <div>Error!</div>;
|
|
2083
|
+
* if (poolData) {
|
|
2084
|
+
* // poolData is available
|
|
2085
|
+
* }
|
|
2086
|
+
* ```
|
|
2087
|
+
*
|
|
2088
|
+
* @remarks
|
|
2089
|
+
* - Refetches pool data every 30 seconds by default, and may be configured via `queryOptions`.
|
|
2090
|
+
* - If `poolKey` is `null`, the query is disabled and no network request is performed.
|
|
2091
|
+
* - Throws an error if `poolKey` is missing when the query is enabled.
|
|
2092
|
+
*/
|
|
2093
|
+
declare function usePoolData({ poolKey, queryOptions, }: UsePoolDataProps): UseQueryResult<PoolData, Error>;
|
|
2094
|
+
|
|
2095
|
+
interface UsePoolBalancesResponse {
|
|
2096
|
+
token0Balance: bigint;
|
|
2097
|
+
token1Balance: bigint;
|
|
2098
|
+
}
|
|
2099
|
+
interface UsePoolBalancesProps {
|
|
2100
|
+
poolData: PoolData | null;
|
|
2101
|
+
poolKey: PoolKey | null;
|
|
2102
|
+
spokeProvider: SpokeProvider | null;
|
|
2103
|
+
enabled?: boolean;
|
|
2104
|
+
queryOptions?: QueryObserverOptions<UsePoolBalancesResponse, Error>;
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* React hook to query a user's token balances for a DEX pool.
|
|
2108
|
+
*
|
|
2109
|
+
* Given the pool data (with token addresses), the pool's key, and a SpokeProvider,
|
|
2110
|
+
* fetches the user's protocol balances for both token0 and token1 for the specified pool.
|
|
2111
|
+
* Queries are auto-refreshed; advanced options can be customized via `queryOptions`.
|
|
2112
|
+
*
|
|
2113
|
+
* @param {UsePoolBalancesProps} props
|
|
2114
|
+
* Object containing:
|
|
2115
|
+
* - `poolData`: {PoolData | null} - Pool info (must include token0 and token1 addresses). Required unless disabling.
|
|
2116
|
+
* - `poolKey`: {PoolKey | null} - Unique key for the DEX pool. Required unless disabling.
|
|
2117
|
+
* - `spokeProvider`: {SpokeProvider | null} - Provider instance for the chain. Required unless disabling.
|
|
2118
|
+
* - `enabled`: {boolean} (optional) - Whether to enable the query. Defaults to `true` if all other arguments are provided.
|
|
2119
|
+
* - `queryOptions`: {QueryObserverOptions<UsePoolBalancesResponse, Error>} (optional) - Advanced react-query options.
|
|
2120
|
+
*
|
|
2121
|
+
* @returns {UseQueryResult<UsePoolBalancesResponse, Error>}
|
|
2122
|
+
* React Query result object:
|
|
2123
|
+
* - `data`: `{ token0Balance: bigint, token1Balance: bigint }` if loaded, undefined otherwise.
|
|
2124
|
+
* - `isLoading`, `isError`, etc. for status handling.
|
|
2125
|
+
*
|
|
2126
|
+
* @remarks
|
|
2127
|
+
* - Throws an error if any of `poolData`, `poolKey`, or `spokeProvider` is missing when enabled.
|
|
2128
|
+
* - Suitable for tracking current protocol/wallet balances for both pool tokens.
|
|
2129
|
+
* - The hook is designed for use within a React component tree that provides the Sodax context.
|
|
2130
|
+
* - Data are automatically refreshed at the provided or default polling interval (default: refetch every 10s).
|
|
2131
|
+
*
|
|
2132
|
+
* @example
|
|
2133
|
+
* ```typescript
|
|
2134
|
+
* const { data, isLoading } = usePoolBalances({ poolData, poolKey, spokeProvider });
|
|
2135
|
+
* if (data) {
|
|
2136
|
+
* console.log('Balances:', data.token0Balance, data.token1Balance);
|
|
2137
|
+
* }
|
|
2138
|
+
* ```
|
|
2139
|
+
*/
|
|
2140
|
+
declare function usePoolBalances({ poolData, poolKey, spokeProvider, enabled, queryOptions, }: UsePoolBalancesProps): UseQueryResult<UsePoolBalancesResponse, Error>;
|
|
2141
|
+
|
|
2142
|
+
interface UsePositionInfoResponse {
|
|
2143
|
+
positionInfo: ClPositionInfo;
|
|
2144
|
+
isValid: boolean;
|
|
2145
|
+
}
|
|
2146
|
+
interface UsePositionInfoProps {
|
|
2147
|
+
tokenId: string | null;
|
|
2148
|
+
poolKey: PoolKey | null;
|
|
2149
|
+
queryOptions?: QueryObserverOptions<UsePositionInfoResponse, Error>;
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* React hook to fetch and validate CL position details by position NFT token ID.
|
|
2153
|
+
*
|
|
2154
|
+
* Fetches position data on-chain for a given tokenId, and checks if it matches the expected PoolKey.
|
|
2155
|
+
* This is commonly used in DEX dashboards to show or pre-validate user positions by ID.
|
|
2156
|
+
*
|
|
2157
|
+
* @param {string | null} tokenId
|
|
2158
|
+
* Position NFT token ID to query, as a string. Pass `null` or empty string to disable.
|
|
2159
|
+
* @param {PoolKey | null} poolKey
|
|
2160
|
+
* PoolKey to match against the position's underlying pool. Pass `null` to disable.
|
|
2161
|
+
* @param {QueryObserverOptions<UsePositionInfoResponse, Error>} [queryOptions]
|
|
2162
|
+
* Optional react-query options for polling/refresh and config. Merged with sensible defaults.
|
|
2163
|
+
*
|
|
2164
|
+
* @returns {UseQueryResult<UsePositionInfoResponse, Error>}
|
|
2165
|
+
* Standard React Query result object:
|
|
2166
|
+
* - `data`: { positionInfo, isValid } if loaded, or undefined if not loaded/error
|
|
2167
|
+
* - `isLoading`: boolean (query active)
|
|
2168
|
+
* - `isError`: boolean (query failed)
|
|
2169
|
+
* - ...other react-query helpers (refetch, status, etc)
|
|
2170
|
+
*
|
|
2171
|
+
* @example
|
|
2172
|
+
* ```typescript
|
|
2173
|
+
* const { data, isLoading, error } = usePositionInfo({ tokenId, poolKey });
|
|
2174
|
+
* if (isLoading) return <div>Loading position...</div>;
|
|
2175
|
+
* if (error) return <div>Error: {error.message}</div>;
|
|
2176
|
+
* if (data) {
|
|
2177
|
+
* console.log('Valid for pool:', data.isValid);
|
|
2178
|
+
* console.log('Liquidity:', data.positionInfo.liquidity);
|
|
2179
|
+
* }
|
|
2180
|
+
* ```
|
|
2181
|
+
*
|
|
2182
|
+
* @remarks
|
|
2183
|
+
* - Validates the underlying position's pool definition (currency0, currency1, fee) with the supplied PoolKey.
|
|
2184
|
+
* - Returns `isValid: false` if any field mismatches.
|
|
2185
|
+
* - Pass `null` as tokenId or poolKey to disable the query.
|
|
2186
|
+
* - Defaults: 10s stale, not enabled if missing arguments. Customizable via `queryOptions`.
|
|
2187
|
+
* - Throws error if called with invalid/null tokenId or poolKey when enabled.
|
|
2188
|
+
*/
|
|
2189
|
+
declare function usePositionInfo({ tokenId, poolKey, queryOptions, }: UsePositionInfoProps): UseQueryResult<UsePositionInfoResponse, Error>;
|
|
2190
|
+
|
|
2191
|
+
type UseDexDepositParams = {
|
|
2192
|
+
params: CreateAssetDepositParams;
|
|
2193
|
+
spokeProvider: SpokeProvider;
|
|
2194
|
+
};
|
|
2195
|
+
/**
|
|
2196
|
+
/**
|
|
2197
|
+
* React hook that provides a mutation to perform a deposit into a DEX pool using the provided parameters and SpokeProvider.
|
|
2198
|
+
*
|
|
2199
|
+
* The hook returns a mutation object for executing the deposit (`mutateAsync`), tracking its state (`isPending`), and any resulting error (`error`).
|
|
2200
|
+
* On successful deposit, all queries matching ['dex', 'poolBalances'] are invalidated and refetched.
|
|
2201
|
+
*
|
|
2202
|
+
* @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDexDepositParams>}
|
|
2203
|
+
* React Query mutation result:
|
|
2204
|
+
* - `mutateAsync({ params, spokeProvider })`: Triggers the deposit with {@link CreateDepositParams} and the target SpokeProvider.
|
|
2205
|
+
* - `isPending`: True while the deposit transaction is pending.
|
|
2206
|
+
* - `error`: Error if the mutation fails.
|
|
2207
|
+
*
|
|
2208
|
+
* @example
|
|
2209
|
+
* ```typescript
|
|
2210
|
+
* const { mutateAsync: deposit, isPending, error } = useDexDeposit();
|
|
2211
|
+
* await deposit({ params: { asset, amount, poolToken }, spokeProvider });
|
|
2212
|
+
* ```
|
|
2213
|
+
*
|
|
2214
|
+
* @remarks
|
|
2215
|
+
* - Throws if called with missing `spokeProvider` or `params`.
|
|
2216
|
+
* - Upon success, automatically refetches up-to-date pool balances.
|
|
2217
|
+
*/
|
|
2218
|
+
declare function useDexDeposit(): UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDexDepositParams>;
|
|
2219
|
+
|
|
2220
|
+
type UseDexWithdrawParams = {
|
|
2221
|
+
params: CreateAssetWithdrawParams;
|
|
2222
|
+
spokeProvider: SpokeProvider;
|
|
2223
|
+
};
|
|
2224
|
+
/**
|
|
2225
|
+
* React hook to provide a mutation for withdrawing assets from a DEX pool.
|
|
2226
|
+
*
|
|
2227
|
+
* This hook returns a mutation result object valid for use with React Query.
|
|
2228
|
+
* The mutation function expects an object with the withdrawal parameters and a SpokeProvider,
|
|
2229
|
+
* and triggers the withdrawal operation on the DEX. On success, it invalidates the relevant
|
|
2230
|
+
* ['dex', 'poolBalances'] query to fetch the updated balances.
|
|
2231
|
+
*
|
|
2232
|
+
* @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDexWithdrawParams>}
|
|
2233
|
+
* Mutation result object. Use its properties to:
|
|
2234
|
+
* - Call `mutateAsync({ params, spokeProvider })` to perform the withdrawal.
|
|
2235
|
+
* - Track progress with `isPending`.
|
|
2236
|
+
* - Access any `error` encountered during the mutation.
|
|
2237
|
+
*
|
|
2238
|
+
* @example
|
|
2239
|
+
* const { mutateAsync: withdraw, isPending, error } = useDexWithdraw();
|
|
2240
|
+
* await withdraw({ params, spokeProvider });
|
|
2241
|
+
*/
|
|
2242
|
+
declare function useDexWithdraw(): UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDexWithdrawParams>;
|
|
2243
|
+
|
|
2244
|
+
type UseDexAllowanceProps = {
|
|
2245
|
+
params: CreateAssetDepositParams | undefined;
|
|
2246
|
+
spokeProvider: SpokeProvider | null;
|
|
2247
|
+
enabled?: boolean;
|
|
2248
|
+
queryOptions?: QueryObserverOptions<boolean, Error>;
|
|
2249
|
+
};
|
|
2250
|
+
/**
|
|
2251
|
+
* Hook to check if the user has approved sufficient token allowance for DEX deposits.
|
|
2252
|
+
*
|
|
2253
|
+
* This hook automatically queries and tracks the allowance status, indicating whether
|
|
2254
|
+
* the user has granted enough allowance to allow a specific deposit to the DEX. It leverages
|
|
2255
|
+
* React Query for status, caching, and background refetching.
|
|
2256
|
+
*
|
|
2257
|
+
* @param {CreateAssetDepositParams | undefined} params
|
|
2258
|
+
* The deposit parameters: asset address, poolToken, and raw amount (BigInt), or undefined to disable.
|
|
2259
|
+
* @param {SpokeProvider | undefined} spokeProvider
|
|
2260
|
+
* The provider interface for the selected chain. When undefined, the query is disabled.
|
|
2261
|
+
* @param {boolean} [enabled]
|
|
2262
|
+
* Whether the allowance status check is enabled. Defaults to true if both params and spokeProvider are truthy.
|
|
2263
|
+
* @param {QueryObserverOptions<boolean, Error>} [queryOptions]
|
|
2264
|
+
* Optional react-query options. Any override here (e.g. staleTime, refetchInterval) will merge with defaults.
|
|
2265
|
+
*
|
|
2266
|
+
* @returns {UseQueryResult<boolean, Error>}
|
|
2267
|
+
* React Query result object: `data` is boolean (true if allowance is sufficient), plus `isLoading`, `error`, etc.
|
|
2268
|
+
*
|
|
2269
|
+
* @example
|
|
2270
|
+
* ```typescript
|
|
2271
|
+
* const { data: isAllowed, isLoading, error } = useDexAllowance({
|
|
2272
|
+
* params: { asset, amount: parseUnits('100', 18), poolToken },
|
|
2273
|
+
* spokeProvider,
|
|
2274
|
+
* });
|
|
2275
|
+
* if (isLoading) return <Spinner />;
|
|
2276
|
+
* if (error) return <div>Error: {error.message}</div>;
|
|
2277
|
+
* if (isAllowed) { ... }
|
|
2278
|
+
* ```
|
|
2279
|
+
*
|
|
2280
|
+
* @remarks
|
|
2281
|
+
* - The allowance is checked every 5 seconds as long as enabled, params, and spokeProvider are all defined.
|
|
2282
|
+
* - Returns `false` if allowance cannot be determined or any error occurs in isAllowanceValid.
|
|
2283
|
+
* - Suitable for gating UI actions that require token approval before depositing in the DEX.
|
|
2284
|
+
*/
|
|
2285
|
+
declare function useDexAllowance({ params, spokeProvider, queryOptions, }: UseDexAllowanceProps): UseQueryResult<boolean, Error>;
|
|
2286
|
+
|
|
2287
|
+
type UseDexApproveParams = {
|
|
2288
|
+
params: CreateAssetDepositParams;
|
|
2289
|
+
spokeProvider: SpokeProvider;
|
|
2290
|
+
};
|
|
2291
|
+
/**
|
|
2292
|
+
* React hook for performing a DEX token allowance approval transaction.
|
|
2293
|
+
*
|
|
2294
|
+
* Returns a mutation object that allows explicitly triggering a token approval
|
|
2295
|
+
* for a DEX deposit, using the specified approval parameters and spoke provider.
|
|
2296
|
+
* On successful approval, the related allowance query is invalidated and refetched
|
|
2297
|
+
* for consistent UI state.
|
|
2298
|
+
*
|
|
2299
|
+
* @returns {UseMutationResult<SpokeTxHash, Error, UseDexApproveParams>}
|
|
2300
|
+
* React Query mutation result for the approval operation. Use `mutateAsync` with
|
|
2301
|
+
* an object of shape `{ params, spokeProvider }` to initiate approval.
|
|
2302
|
+
*
|
|
2303
|
+
* @example
|
|
2304
|
+
* ```typescript
|
|
2305
|
+
* const { mutateAsync: approve, isPending, error } = useDexApprove();
|
|
2306
|
+
* await approve({ params: { asset, amount, poolToken }, spokeProvider });
|
|
2307
|
+
* ```
|
|
2308
|
+
*
|
|
2309
|
+
* @remarks
|
|
2310
|
+
* - Throws if called without both a valid `params` and `spokeProvider`.
|
|
2311
|
+
* - On approval success, the query for ['dex', 'allowance'] is invalidated/refetched.
|
|
2312
|
+
*/
|
|
2313
|
+
declare function useDexApprove(): UseMutationResult<SpokeTxHash, Error, UseDexApproveParams>;
|
|
2314
|
+
|
|
2315
|
+
interface UseLiquidityAmountsResult {
|
|
2316
|
+
liquidityToken0Amount: string;
|
|
2317
|
+
liquidityToken1Amount: string;
|
|
2318
|
+
lastEditedToken: 'token0' | 'token1' | null;
|
|
2319
|
+
setLiquidityToken0Amount: (value: string) => void;
|
|
2320
|
+
setLiquidityToken1Amount: (value: string) => void;
|
|
2321
|
+
handleToken0AmountChange: (value: string) => void;
|
|
2322
|
+
handleToken1AmountChange: (value: string) => void;
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Hook for calculating liquidity amounts based on price range.
|
|
2326
|
+
*
|
|
2327
|
+
* This hook manages the state and calculations for liquidity token amounts.
|
|
2328
|
+
* It automatically calculates the corresponding token amount when one is changed,
|
|
2329
|
+
* based on the current price range and pool data.
|
|
2330
|
+
*
|
|
2331
|
+
* @param {string} minPrice - Minimum price for the liquidity range
|
|
2332
|
+
* @param {string} maxPrice - Maximum price for the liquidity range
|
|
2333
|
+
* @param {PoolData | null} poolData - The pool data containing token information
|
|
2334
|
+
* @returns {UseLiquidityAmountsResult} Object containing amounts, state, and handlers
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* ```typescript
|
|
2338
|
+
* const {
|
|
2339
|
+
* liquidityToken0Amount,
|
|
2340
|
+
* liquidityToken1Amount,
|
|
2341
|
+
* handleToken0AmountChange,
|
|
2342
|
+
* handleToken1AmountChange,
|
|
2343
|
+
* } = useLiquidityAmounts(minPrice, maxPrice, poolData);
|
|
2344
|
+
*
|
|
2345
|
+
* <Input
|
|
2346
|
+
* value={liquidityToken0Amount}
|
|
2347
|
+
* onChange={(e) => handleToken0AmountChange(e.target.value)}
|
|
2348
|
+
* />
|
|
2349
|
+
* ```
|
|
2350
|
+
*/
|
|
2351
|
+
declare function useLiquidityAmounts(minPrice: string, maxPrice: string, poolData: PoolData | null): UseLiquidityAmountsResult;
|
|
2352
|
+
|
|
2353
|
+
type UseCreateSupplyLiquidityParamsProps = {
|
|
2354
|
+
poolData: PoolData;
|
|
2355
|
+
poolKey: PoolKey;
|
|
2356
|
+
minPrice: string;
|
|
2357
|
+
maxPrice: string;
|
|
2358
|
+
liquidityToken0Amount: string;
|
|
2359
|
+
liquidityToken1Amount: string;
|
|
2360
|
+
slippageTolerance: string | number;
|
|
2361
|
+
positionId?: string | null;
|
|
2362
|
+
isValidPosition?: boolean;
|
|
2363
|
+
};
|
|
2364
|
+
type UseCreateSupplyLiquidityParamsResult = ConcentratedLiquiditySupplyParams & Omit<ConcentratedLiquidityIncreaseLiquidityParams, 'tokenId'> & {
|
|
2365
|
+
tokenId?: string | bigint;
|
|
2366
|
+
positionId?: string | null;
|
|
2367
|
+
isValidPosition?: boolean;
|
|
2368
|
+
};
|
|
2369
|
+
/**
|
|
2370
|
+
* React hook to create the supply liquidity parameters for a given pool.
|
|
2371
|
+
*
|
|
2372
|
+
* Purpose:
|
|
2373
|
+
* - Provides a hook which memoizes the supply liquidity parameters for a given pool.
|
|
2374
|
+
*
|
|
2375
|
+
* Usage:
|
|
2376
|
+
* - Call the function with the pool data, pool key, minimum price, maximum price, liquidity token0 amount, liquidity token1 amount, slippage tolerance, position id, and validity of the position to create the supply liquidity parameters.
|
|
2377
|
+
*
|
|
2378
|
+
* Params:
|
|
2379
|
+
* @param poolData - The pool data of the pool to supply liquidity to.
|
|
2380
|
+
* @param poolKey - The pool key of the pool to supply liquidity to.
|
|
2381
|
+
* @param minPrice - The minimum price of the liquidity to supply.
|
|
2382
|
+
* @param maxPrice - The maximum price of the liquidity to supply.
|
|
2383
|
+
* @param liquidityToken0Amount - The amount of the token0 to supply.
|
|
2384
|
+
* @param liquidityToken1Amount - The amount of the token1 to supply.
|
|
2385
|
+
* @param slippageTolerance - The slippage tolerance to use for the supply.
|
|
2386
|
+
* @param positionId - The position id of the position to supply liquidity to.
|
|
2387
|
+
* @param isValidPosition - Whether the position is valid.
|
|
2388
|
+
* @returns The supply liquidity parameters.
|
|
2389
|
+
*/
|
|
2390
|
+
declare function useCreateSupplyLiquidityParams({ poolData, poolKey, minPrice, maxPrice, liquidityToken0Amount, liquidityToken1Amount, slippageTolerance, positionId, isValidPosition, }: UseCreateSupplyLiquidityParamsProps): UseCreateSupplyLiquidityParamsResult;
|
|
2391
|
+
|
|
2392
|
+
type UseSupplyLiquidityProps = {
|
|
2393
|
+
params: UseCreateSupplyLiquidityParamsResult;
|
|
2394
|
+
spokeProvider: SpokeProvider;
|
|
2395
|
+
};
|
|
2396
|
+
/**
|
|
2397
|
+
* Hook for supplying liquidity to a pool.
|
|
2398
|
+
*
|
|
2399
|
+
* This hook handles both minting new positions and increasing liquidity in existing positions.
|
|
2400
|
+
* It applies slippage tolerance before calculating liquidity and handles the complete transaction flow.
|
|
2401
|
+
*
|
|
2402
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider for the chain
|
|
2403
|
+
* @returns {UseMutationResult<void, Error, SupplyLiquidityParams>} Mutation result with supply function
|
|
2404
|
+
*
|
|
2405
|
+
* @example
|
|
2406
|
+
* ```typescript
|
|
2407
|
+
* const { mutateAsync: supplyLiquidity, isPending, error } = useSupplyLiquidity(spokeProvider);
|
|
2408
|
+
*
|
|
2409
|
+
* await supplyLiquidity({
|
|
2410
|
+
* poolData,
|
|
2411
|
+
* poolKey,
|
|
2412
|
+
* minPrice: '100',
|
|
2413
|
+
* maxPrice: '200',
|
|
2414
|
+
* liquidityToken0Amount: '10',
|
|
2415
|
+
* liquidityToken1Amount: '20',
|
|
2416
|
+
* slippageTolerance: '0.5',
|
|
2417
|
+
* });
|
|
2418
|
+
* ```
|
|
2419
|
+
*/
|
|
2420
|
+
declare function useSupplyLiquidity(): UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseSupplyLiquidityProps>;
|
|
2421
|
+
|
|
2422
|
+
type UseDecreaseLiquidityParams = {
|
|
2423
|
+
params: ConcentratedLiquidityDecreaseLiquidityParams;
|
|
2424
|
+
spokeProvider: SpokeProvider;
|
|
2425
|
+
};
|
|
2426
|
+
/**
|
|
2427
|
+
* React hook that provides a mutation for decreasing liquidity in a concentrated liquidity position.
|
|
2428
|
+
*
|
|
2429
|
+
* This hook returns a mutation for removing liquidity from a position using the provided
|
|
2430
|
+
* `ConcentratedLiquidityDecreaseLiquidityParams` and `SpokeProvider`. The mutation returns a tuple of
|
|
2431
|
+
* the spoke transaction hash and the hub transaction hash upon success.
|
|
2432
|
+
*
|
|
2433
|
+
* @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDecreaseLiquidityParams>}
|
|
2434
|
+
* React Query mutation result:
|
|
2435
|
+
* - `mutateAsync({ params, spokeProvider })`: Triggers the decrease liquidity mutation.
|
|
2436
|
+
* - On success, returns `[spokeTxHash, hubTxHash]`.
|
|
2437
|
+
* - On failure, throws an error.
|
|
2438
|
+
*
|
|
2439
|
+
* @example
|
|
2440
|
+
* ```typescript
|
|
2441
|
+
* const { mutateAsync: decreaseLiquidity, isPending, error } = useDecreaseLiquidity();
|
|
2442
|
+
*
|
|
2443
|
+
* await decreaseLiquidity({
|
|
2444
|
+
* params: {
|
|
2445
|
+
* poolKey,
|
|
2446
|
+
* tokenId: 123n,
|
|
2447
|
+
* liquidity: 100000n,
|
|
2448
|
+
* amount0Min: 0n,
|
|
2449
|
+
* amount1Min: 0n,
|
|
2450
|
+
* },
|
|
2451
|
+
* spokeProvider,
|
|
2452
|
+
* });
|
|
2453
|
+
* ```
|
|
2454
|
+
*
|
|
2455
|
+
* @param {UseDecreaseLiquidityParams} variables
|
|
2456
|
+
* - `params`: Parameters for the decrease liquidity operation, matching `ConcentratedLiquidityDecreaseLiquidityParams`.
|
|
2457
|
+
* - `spokeProvider`: The provider instance for the target spoke chain.
|
|
2458
|
+
*
|
|
2459
|
+
* @remarks
|
|
2460
|
+
* - After a successful liquidity decrease, the hook will invalidate DEX pool balances and position info queries.
|
|
2461
|
+
*/
|
|
2462
|
+
declare function useDecreaseLiquidity(): UseMutationResult<[SpokeTxHash, HubTxHash], Error, UseDecreaseLiquidityParams>;
|
|
2463
|
+
|
|
2464
|
+
type UseCreateDepositParamsProps = {
|
|
2465
|
+
tokenIndex: 0 | 1;
|
|
2466
|
+
amount: string | number;
|
|
2467
|
+
poolData: PoolData;
|
|
2468
|
+
poolSpokeAssets: PoolSpokeAssets;
|
|
2469
|
+
};
|
|
2470
|
+
/**
|
|
2471
|
+
* React hook to create the deposit parameters for a given pool and token.
|
|
2472
|
+
*
|
|
2473
|
+
* Purpose:
|
|
2474
|
+
* - Provides a hook which memoizes the deposit parameters for a given pool and token.
|
|
2475
|
+
*
|
|
2476
|
+
* Usage:
|
|
2477
|
+
* - Call the function with the token index, amount, pool data, pool key, and spoke provider to create the deposit parameters.
|
|
2478
|
+
*
|
|
2479
|
+
* Params:
|
|
2480
|
+
* @param tokenIndex - The index of the token to deposit.
|
|
2481
|
+
* @param amount - The amount of the token to deposit.
|
|
2482
|
+
* @param poolData - The pool data of the pool to deposit to.
|
|
2483
|
+
* @param poolKey - The pool key of the pool to deposit to.
|
|
2484
|
+
* @param spokeProvider - The spoke provider to use for the deposit.
|
|
2485
|
+
* @returns The deposit parameters or undefined if the pool key, spoke provider, or amount is not set.
|
|
2486
|
+
*/
|
|
2487
|
+
declare function useCreateDepositParams({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): CreateAssetDepositParams | undefined;
|
|
2488
|
+
|
|
2489
|
+
type UseCreateDecreaseLiquidityParamsProps = {
|
|
2490
|
+
poolKey: PoolKey;
|
|
2491
|
+
tokenId: string | bigint;
|
|
2492
|
+
percentage: string | number;
|
|
2493
|
+
positionInfo: ClPositionInfo;
|
|
2494
|
+
slippageTolerance: string | number;
|
|
2495
|
+
};
|
|
2496
|
+
/**
|
|
2497
|
+
* React hook to create the decrease liquidity parameters for a given pool and position.
|
|
2498
|
+
*
|
|
2499
|
+
* Purpose:
|
|
2500
|
+
* - Provides a hook which memoizes the decrease liquidity parameters for a given pool and position.
|
|
2501
|
+
*
|
|
2502
|
+
* Usage:
|
|
2503
|
+
* - Call the function with the pool key, token ID, percentage, position info, and slippage tolerance to create the decrease liquidity parameters.
|
|
2504
|
+
*
|
|
2505
|
+
* Params:
|
|
2506
|
+
* @param poolKey - The pool key of the pool to decrease the liquidity from.
|
|
2507
|
+
* @param tokenId - The token ID of the position to decrease the liquidity from.
|
|
2508
|
+
* @param percentage - The percentage of liquidity to decrease.
|
|
2509
|
+
* @param positionInfo - The position info of the position to decrease the liquidity from.
|
|
2510
|
+
* @param slippageTolerance - The slippage tolerance to use for the decrease.
|
|
2511
|
+
* @returns The decrease liquidity parameters.
|
|
2512
|
+
*/
|
|
2513
|
+
declare function useCreateDecreaseLiquidityParams({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): ConcentratedLiquidityDecreaseLiquidityParams;
|
|
2514
|
+
|
|
2515
|
+
type UseCreateWithdrawParamsProps = {
|
|
2516
|
+
tokenIndex: 0 | 1;
|
|
2517
|
+
amount: string | number;
|
|
2518
|
+
poolData: PoolData;
|
|
2519
|
+
poolSpokeAssets: PoolSpokeAssets;
|
|
2520
|
+
dst?: DestinationParamsType;
|
|
2521
|
+
};
|
|
2522
|
+
/**
|
|
2523
|
+
* React hook to create the withdrawal parameters for a given pool and token.
|
|
2524
|
+
*
|
|
2525
|
+
* Purpose:
|
|
2526
|
+
* - Provides a hook which memoizes the withdrawal parameters for a given pool and token.
|
|
2527
|
+
*
|
|
2528
|
+
* Usage:
|
|
2529
|
+
* - Call the function with the token index, amount, pool data, pool spoke assets, and destination parameters to create the withdrawal parameters.
|
|
2530
|
+
*
|
|
2531
|
+
* Params:
|
|
2532
|
+
* @param tokenIndex - The index of the token to withdraw.
|
|
2533
|
+
* @param amount - The amount of the token to withdraw.
|
|
2534
|
+
* @param poolData - The pool data of the pool to withdraw from.
|
|
2535
|
+
* @param poolSpokeAssets - The pool spoke assets of the pool to withdraw from.
|
|
2536
|
+
* @param dst - The destination parameters for the withdrawal.
|
|
2537
|
+
* @returns The withdrawal parameters or undefined if the amount is not set.
|
|
2538
|
+
*/
|
|
2539
|
+
declare function useCreateWithdrawParams({ tokenIndex, amount, poolData, poolSpokeAssets, dst, }: UseCreateWithdrawParamsProps): CreateAssetWithdrawParams | undefined;
|
|
2540
|
+
|
|
2541
|
+
type UseClaimRewardsParams = {
|
|
2542
|
+
params: ConcentratedLiquidityClaimRewardsParams;
|
|
2543
|
+
spokeProvider: SpokeProvider;
|
|
2544
|
+
};
|
|
2545
|
+
/**
|
|
2546
|
+
* React hook for creating a mutation to claim DEX rewards for a concentrated liquidity position.
|
|
2547
|
+
*
|
|
2548
|
+
* @returns {UseMutationResult<[SpokeTxHash, HubTxHash], ConcentratedLiquidityError<ConcentratedLiquidityErrorCode>, UseClaimRewardsParams>}
|
|
2549
|
+
* Returns a react-query mutation result object:
|
|
2550
|
+
* - On success: resolves to a tuple `[SpokeTxHash, HubTxHash]`.
|
|
2551
|
+
* - On error: the error is of type `ConcentratedLiquidityError<ConcentratedLiquidityErrorCode>`.
|
|
2552
|
+
* - The mutation function expects an argument of type {@link UseClaimRewardsParams}
|
|
2553
|
+
* containing `params` (the claim parameters) and `spokeProvider` (the target provider).
|
|
2554
|
+
* - On mutation success, invalidates the queries `'dex/poolBalances'` and `'dex/positionInfo'`.
|
|
2555
|
+
*
|
|
2556
|
+
* @example
|
|
2557
|
+
* const claimRewardsMutation = useClaimRewards();
|
|
2558
|
+
* claimRewardsMutation.mutateAsync({
|
|
2559
|
+
* params: { poolKey, tokenId, tickLower, tickUpper },
|
|
2560
|
+
* spokeProvider,
|
|
2561
|
+
* });
|
|
2562
|
+
*/
|
|
2563
|
+
declare function useClaimRewards(): UseMutationResult<[
|
|
2564
|
+
SpokeTxHash,
|
|
2565
|
+
HubTxHash
|
|
2566
|
+
], ConcentratedLiquidityError<ConcentratedLiquidityErrorCode>, UseClaimRewardsParams>;
|
|
2567
|
+
|
|
2003
2568
|
interface SodaxProviderProps {
|
|
2004
2569
|
children: ReactNode;
|
|
2005
2570
|
testnet?: boolean;
|
|
@@ -2008,4 +2573,9 @@ interface SodaxProviderProps {
|
|
|
2008
2573
|
}
|
|
2009
2574
|
declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
|
|
2010
2575
|
|
|
2011
|
-
|
|
2576
|
+
declare function createDecreaseLiquidityParamsProps({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): ConcentratedLiquidityDecreaseLiquidityParams;
|
|
2577
|
+
declare function createDepositParamsProps({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): CreateAssetDepositParams;
|
|
2578
|
+
declare function createSupplyLiquidityParamsProps({ poolData, poolKey, minPrice, maxPrice, liquidityToken0Amount, liquidityToken1Amount, slippageTolerance, positionId, isValidPosition, }: UseCreateSupplyLiquidityParamsProps): UseCreateSupplyLiquidityParamsResult;
|
|
2579
|
+
declare function createWithdrawParamsProps({ tokenIndex, amount, poolData, poolSpokeAssets, dst, }: UseCreateWithdrawParamsProps): CreateAssetWithdrawParams;
|
|
2580
|
+
|
|
2581
|
+
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, type RadfiSession, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseBorrowParams, type UseClaimRewardsParams, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityParams, type UseDexAllowanceProps, type UseDexApproveParams, type UseDexDepositParams, type UseDexWithdrawParams, type UseMMAllowanceParams, type UseMMApproveParams, type UsePoolBalancesProps, type UsePoolBalancesResponse, type UsePoolDataProps, type UsePoolsProps, type UsePositionInfoProps, type UsePositionInfoResponse, type UseRadfiSessionReturn, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyLiquidityProps, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSupplyLiquidityParamsProps, createWithdrawParamsProps, loadRadfiSession, saveRadfiSession, useAToken, useATokensBalances, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendSubmitSwapTx, useBackendSubmitSwapTxStatus, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEstimateGas, useExpiredUtxos, useFundTradingWallet, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprove, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw };
|