@sodax/dapp-kit 0.0.1-rc.29 → 0.0.1-rc.30
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 +37 -37
- package/dist/index.d.mts +1425 -0
- package/dist/index.d.ts +1425 -5
- package/dist/index.js +364 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/contexts/index.ts +1 -1
- package/src/hooks/bridge/useGetBridgeableAmount.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/shared/useDeriveUserWalletAddress.ts +1 -1
- package/src/hooks/staking/index.ts +19 -0
- package/src/hooks/staking/useCancelUnstake.ts +52 -0
- package/src/hooks/staking/useClaim.ts +46 -0
- package/src/hooks/staking/useConvertedAssets.ts +47 -0
- package/src/hooks/staking/useInstantUnstake.ts +50 -0
- package/src/hooks/staking/useInstantUnstakeAllowance.ts +59 -0
- package/src/hooks/staking/useInstantUnstakeApprove.ts +52 -0
- package/src/hooks/staking/useInstantUnstakeRatio.ts +54 -0
- package/src/hooks/staking/useStake.ts +47 -0
- package/src/hooks/staking/useStakeAllowance.ts +57 -0
- package/src/hooks/staking/useStakeApprove.ts +50 -0
- package/src/hooks/staking/useStakeRatio.ts +53 -0
- package/src/hooks/staking/useStakingConfig.ts +40 -0
- package/src/hooks/staking/useStakingInfo.ts +50 -0
- package/src/hooks/staking/useUnstake.ts +54 -0
- package/src/hooks/staking/useUnstakeAllowance.ts +58 -0
- package/src/hooks/staking/useUnstakeApprove.ts +52 -0
- package/src/hooks/staking/useUnstakingInfo.ts +53 -0
- package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +59 -0
- package/src/index.ts +0 -1
- package/src/providers/SodaxProvider.tsx +1 -1
- package/dist/contexts/index.d.ts +0 -9
- package/dist/contexts/index.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.d.ts.map +0 -1
- package/dist/hooks/backend/index.d.ts +0 -17
- package/dist/hooks/backend/index.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts +0 -37
- package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts +0 -45
- package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendIntentByHash.d.ts +0 -36
- package/dist/hooks/backend/useBackendIntentByHash.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendIntentByTxHash.d.ts +0 -35
- package/dist/hooks/backend/useBackendIntentByTxHash.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts +0 -38
- package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts +0 -47
- package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts +0 -47
- package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts +0 -37
- package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts.map +0 -1
- package/dist/hooks/backend/useBackendOrderbook.d.ts +0 -46
- package/dist/hooks/backend/useBackendOrderbook.d.ts.map +0 -1
- package/dist/hooks/bridge/index.d.ts +0 -6
- package/dist/hooks/bridge/index.d.ts.map +0 -1
- package/dist/hooks/bridge/useBridge.d.ts +0 -33
- package/dist/hooks/bridge/useBridge.d.ts.map +0 -1
- package/dist/hooks/bridge/useBridgeAllowance.d.ts +0 -23
- package/dist/hooks/bridge/useBridgeAllowance.d.ts.map +0 -1
- package/dist/hooks/bridge/useBridgeApprove.d.ts +0 -29
- package/dist/hooks/bridge/useBridgeApprove.d.ts.map +0 -1
- package/dist/hooks/bridge/useGetBridgeableAmount.d.ts +0 -26
- package/dist/hooks/bridge/useGetBridgeableAmount.d.ts.map +0 -1
- package/dist/hooks/bridge/useGetBridgeableTokens.d.ts +0 -37
- package/dist/hooks/bridge/useGetBridgeableTokens.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/mm/index.d.ts +0 -9
- package/dist/hooks/mm/index.d.ts.map +0 -1
- package/dist/hooks/mm/useBorrow.d.ts +0 -35
- package/dist/hooks/mm/useBorrow.d.ts.map +0 -1
- package/dist/hooks/mm/useMMAllowance.d.ts +0 -26
- package/dist/hooks/mm/useMMAllowance.d.ts.map +0 -1
- package/dist/hooks/mm/useMMApprove.d.ts +0 -27
- package/dist/hooks/mm/useMMApprove.d.ts.map +0 -1
- package/dist/hooks/mm/useRepay.d.ts +0 -35
- package/dist/hooks/mm/useRepay.d.ts.map +0 -1
- package/dist/hooks/mm/useReservesData.d.ts +0 -19
- package/dist/hooks/mm/useReservesData.d.ts.map +0 -1
- package/dist/hooks/mm/useReservesHumanized.d.ts +0 -21
- package/dist/hooks/mm/useReservesHumanized.d.ts.map +0 -1
- package/dist/hooks/mm/useReservesList.d.ts +0 -18
- package/dist/hooks/mm/useReservesList.d.ts.map +0 -1
- package/dist/hooks/mm/useReservesUsdFormat.d.ts +0 -23
- package/dist/hooks/mm/useReservesUsdFormat.d.ts.map +0 -1
- package/dist/hooks/mm/useSupply.d.ts +0 -34
- package/dist/hooks/mm/useSupply.d.ts.map +0 -1
- package/dist/hooks/mm/useUserFormattedSummary.d.ts +0 -21
- package/dist/hooks/mm/useUserFormattedSummary.d.ts.map +0 -1
- package/dist/hooks/mm/useUserReservesData.d.ts +0 -20
- package/dist/hooks/mm/useUserReservesData.d.ts.map +0 -1
- package/dist/hooks/mm/useWithdraw.d.ts +0 -33
- package/dist/hooks/mm/useWithdraw.d.ts.map +0 -1
- package/dist/hooks/provider/index.d.ts +0 -3
- package/dist/hooks/provider/index.d.ts.map +0 -1
- package/dist/hooks/provider/useHubProvider.d.ts +0 -3
- package/dist/hooks/provider/useHubProvider.d.ts.map +0 -1
- package/dist/hooks/provider/useSpokeProvider.d.ts +0 -18
- package/dist/hooks/provider/useSpokeProvider.d.ts.map +0 -1
- package/dist/hooks/shared/index.d.ts +0 -6
- package/dist/hooks/shared/index.d.ts.map +0 -1
- package/dist/hooks/shared/useDeriveUserWalletAddress.d.ts +0 -24
- package/dist/hooks/shared/useDeriveUserWalletAddress.d.ts.map +0 -1
- package/dist/hooks/shared/useEstimateGas.d.ts +0 -4
- package/dist/hooks/shared/useEstimateGas.d.ts.map +0 -1
- package/dist/hooks/shared/useRequestTrustline.d.ts +0 -44
- package/dist/hooks/shared/useRequestTrustline.d.ts.map +0 -1
- package/dist/hooks/shared/useSodaxContext.d.ts +0 -8
- package/dist/hooks/shared/useSodaxContext.d.ts.map +0 -1
- package/dist/hooks/shared/useStellarTrustlineCheck.d.ts +0 -40
- package/dist/hooks/shared/useStellarTrustlineCheck.d.ts.map +0 -1
- package/dist/hooks/swap/index.d.ts +0 -7
- package/dist/hooks/swap/index.d.ts.map +0 -1
- package/dist/hooks/swap/useCancelSwap.d.ts +0 -29
- package/dist/hooks/swap/useCancelSwap.d.ts.map +0 -1
- package/dist/hooks/swap/useQuote.d.ts +0 -39
- package/dist/hooks/swap/useQuote.d.ts.map +0 -1
- package/dist/hooks/swap/useStatus.d.ts +0 -31
- package/dist/hooks/swap/useStatus.d.ts.map +0 -1
- package/dist/hooks/swap/useSwap.d.ts +0 -29
- package/dist/hooks/swap/useSwap.d.ts.map +0 -1
- package/dist/hooks/swap/useSwapAllowance.d.ts +0 -23
- package/dist/hooks/swap/useSwapAllowance.d.ts.map +0 -1
- package/dist/hooks/swap/useSwapApprove.d.ts +0 -25
- package/dist/hooks/swap/useSwapApprove.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/SodaxProvider.d.ts +0 -12
- package/dist/providers/SodaxProvider.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -17
- package/dist/types.d.ts.map +0 -1
- package/src/types.ts +0 -22
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { MoneyMarketAssetBorrowers } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for fetching borrowers for a specific money market asset from the backend API.
|
|
5
|
-
*
|
|
6
|
-
* This hook provides access to the list of borrowers for a specific money market asset,
|
|
7
|
-
* with pagination support. The data is automatically fetched and cached using React Query.
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} params - Parameters for fetching asset borrowers
|
|
10
|
-
* @param {string | undefined} params.reserveAddress - The reserve contract address. If undefined, the query will be disabled.
|
|
11
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
12
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseQueryResult<MoneyMarketAssetBorrowers | undefined>} A query result object containing:
|
|
15
|
-
* - data: The asset borrowers data when available
|
|
16
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
17
|
-
* - error: Error object if the request failed
|
|
18
|
-
* - refetch: Function to manually trigger a data refresh
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* const { data: borrowers, isLoading, error } = useMoneyMarketAssetBorrowers({
|
|
23
|
-
* reserveAddress: '0xabc...',
|
|
24
|
-
* offset: '0',
|
|
25
|
-
* limit: '20'
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* if (isLoading) return <div>Loading borrowers...</div>;
|
|
29
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
30
|
-
* if (borrowers) {
|
|
31
|
-
* console.log('Total borrowers:', borrowers.total);
|
|
32
|
-
* console.log('Borrowers:', borrowers.borrowers);
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* - The query is disabled when reserveAddress is undefined or empty
|
|
38
|
-
* - Uses React Query for efficient caching and state management
|
|
39
|
-
* - Automatically handles error states and loading indicators
|
|
40
|
-
* - Supports pagination through offset and limit parameters
|
|
41
|
-
*/
|
|
42
|
-
export declare const useBackendMoneyMarketAssetBorrowers: (params: {
|
|
43
|
-
reserveAddress: string | undefined;
|
|
44
|
-
offset: string;
|
|
45
|
-
limit: string;
|
|
46
|
-
}) => UseQueryResult<MoneyMarketAssetBorrowers | undefined>;
|
|
47
|
-
//# sourceMappingURL=useBackendMoneyMarketAssetBorrowers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBackendMoneyMarketAssetBorrowers.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mCAAmC,WAAY;IAC1D,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,cAAc,CAAC,yBAAyB,GAAG,SAAS,CAkBvD,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { MoneyMarketAssetSuppliers } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for fetching suppliers for a specific money market asset from the backend API.
|
|
5
|
-
*
|
|
6
|
-
* This hook provides access to the list of suppliers for a specific money market asset,
|
|
7
|
-
* with pagination support. The data is automatically fetched and cached using React Query.
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} params - Parameters for fetching asset suppliers
|
|
10
|
-
* @param {string | undefined} params.reserveAddress - The reserve contract address. If undefined, the query will be disabled.
|
|
11
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
12
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseQueryResult<MoneyMarketAssetSuppliers | undefined>} A query result object containing:
|
|
15
|
-
* - data: The asset suppliers data when available
|
|
16
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
17
|
-
* - error: Error object if the request failed
|
|
18
|
-
* - refetch: Function to manually trigger a data refresh
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* const { data: suppliers, isLoading, error } = useMoneyMarketAssetSuppliers({
|
|
23
|
-
* reserveAddress: '0xabc...',
|
|
24
|
-
* offset: '0',
|
|
25
|
-
* limit: '20'
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* if (isLoading) return <div>Loading suppliers...</div>;
|
|
29
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
30
|
-
* if (suppliers) {
|
|
31
|
-
* console.log('Total suppliers:', suppliers.total);
|
|
32
|
-
* console.log('Suppliers:', suppliers.suppliers);
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* - The query is disabled when reserveAddress is undefined or empty
|
|
38
|
-
* - Uses React Query for efficient caching and state management
|
|
39
|
-
* - Automatically handles error states and loading indicators
|
|
40
|
-
* - Supports pagination through offset and limit parameters
|
|
41
|
-
*/
|
|
42
|
-
export declare const useBackendMoneyMarketAssetSuppliers: (params: {
|
|
43
|
-
reserveAddress: string | undefined;
|
|
44
|
-
offset: string;
|
|
45
|
-
limit: string;
|
|
46
|
-
}) => UseQueryResult<MoneyMarketAssetSuppliers | undefined>;
|
|
47
|
-
//# sourceMappingURL=useBackendMoneyMarketAssetSuppliers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBackendMoneyMarketAssetSuppliers.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mCAAmC,WAAY;IAC1D,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,cAAc,CAAC,yBAAyB,GAAG,SAAS,CAkBvD,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { MoneyMarketPosition } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for fetching money market position for a specific user from the backend API.
|
|
5
|
-
*
|
|
6
|
-
* This hook provides access to a user's money market positions, including their
|
|
7
|
-
* aToken balances, variable debt token balances, and associated reserve information.
|
|
8
|
-
* The data is automatically fetched and cached using React Query.
|
|
9
|
-
*
|
|
10
|
-
* @param {string | undefined} userAddress - The user's wallet address. If undefined, the query will be disabled.
|
|
11
|
-
*
|
|
12
|
-
* @returns {UseQueryResult<MoneyMarketPosition | undefined>} A query result object containing:
|
|
13
|
-
* - data: The money market position data when available
|
|
14
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
15
|
-
* - error: Error object if the request failed
|
|
16
|
-
* - refetch: Function to manually trigger a data refresh
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const { data: position, isLoading, error } = useMoneyMarketPosition('0x123...');
|
|
21
|
-
*
|
|
22
|
-
* if (isLoading) return <div>Loading position...</div>;
|
|
23
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
24
|
-
* if (position) {
|
|
25
|
-
* console.log('User address:', position.userAddress);
|
|
26
|
-
* console.log('Positions:', position.positions);
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* - The query is disabled when userAddress is undefined or empty
|
|
32
|
-
* - Uses React Query for efficient caching and state management
|
|
33
|
-
* - Automatically handles error states and loading indicators
|
|
34
|
-
* - Includes user's aToken and debt token balances across all reserves
|
|
35
|
-
*/
|
|
36
|
-
export declare const useBackendMoneyMarketPosition: (userAddress: string | undefined) => UseQueryResult<MoneyMarketPosition | undefined>;
|
|
37
|
-
//# sourceMappingURL=useBackendMoneyMarketPosition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBackendMoneyMarketPosition.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendMoneyMarketPosition.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,6BAA6B,gBAC3B,MAAM,GAAG,SAAS,KAC9B,cAAc,CAAC,mBAAmB,GAAG,SAAS,CAehD,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { OrderbookResponse } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for fetching the solver orderbook from the backend API.
|
|
5
|
-
*
|
|
6
|
-
* This hook provides access to the solver orderbook data, including intent states
|
|
7
|
-
* and intent data for all available intents. The data is automatically fetched
|
|
8
|
-
* and cached using React Query with pagination support.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} params - Pagination parameters for the orderbook
|
|
11
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
12
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseQueryResult<OrderbookResponse | undefined>} A query result object containing:
|
|
15
|
-
* - data: The orderbook response data when available
|
|
16
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
17
|
-
* - error: Error object if the request failed
|
|
18
|
-
* - refetch: Function to manually trigger a data refresh
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* const { data: orderbook, isLoading, error } = useOrderbook({
|
|
23
|
-
* offset: '0',
|
|
24
|
-
* limit: '10'
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* if (isLoading) return <div>Loading orderbook...</div>;
|
|
28
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
29
|
-
* if (orderbook) {
|
|
30
|
-
* console.log('Total intents:', orderbook.total);
|
|
31
|
-
* console.log('Intents:', orderbook.data);
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* - The query is disabled when params are undefined or invalid
|
|
37
|
-
* - Uses React Query for efficient caching and state management
|
|
38
|
-
* - Automatically handles error states and loading indicators
|
|
39
|
-
* - Stale time of 30 seconds for real-time orderbook data
|
|
40
|
-
* - Supports pagination through offset and limit parameters
|
|
41
|
-
*/
|
|
42
|
-
export declare const useBackendOrderbook: (params: {
|
|
43
|
-
offset: string;
|
|
44
|
-
limit: string;
|
|
45
|
-
} | undefined) => UseQueryResult<OrderbookResponse | undefined>;
|
|
46
|
-
//# sourceMappingURL=useBackendOrderbook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBackendOrderbook.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendOrderbook.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mBAAmB,WACtB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,KACpD,cAAc,CAAC,iBAAiB,GAAG,SAAS,CAgB9C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { BridgeError, BridgeErrorCode, SpokeTxHash, HubTxHash, Result, CreateBridgeIntentParams } from '@sodax/sdk';
|
|
2
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
import type { SpokeProvider } from '@sodax/sdk';
|
|
4
|
-
/**
|
|
5
|
-
* Hook for executing bridge transactions to transfer tokens between chains.
|
|
6
|
-
* Uses React Query's useMutation for better state management and caching.
|
|
7
|
-
*
|
|
8
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the bridge
|
|
9
|
-
* @returns {UseMutationResult} Mutation result object containing mutation function and state
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const { mutateAsync: bridge, isPending } = useBridge(spokeProvider);
|
|
14
|
-
*
|
|
15
|
-
* const handleBridge = async () => {
|
|
16
|
-
* const result = await bridge({
|
|
17
|
-
* srcChainId: '0x2105.base',
|
|
18
|
-
* srcAsset: '0x...',
|
|
19
|
-
* amount: 1000n,
|
|
20
|
-
* dstChainId: '0x89.polygon',
|
|
21
|
-
* dstAsset: '0x...',
|
|
22
|
-
* recipient: '0x...'
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* console.log('Bridge transaction hashes:', {
|
|
26
|
-
* spokeTxHash: result.spokeTxHash,
|
|
27
|
-
* hubTxHash: result.hubTxHash
|
|
28
|
-
* });
|
|
29
|
-
* };
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function useBridge(spokeProvider: SpokeProvider | undefined): UseMutationResult<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>, Error, CreateBridgeIntentParams>;
|
|
33
|
-
//# sourceMappingURL=useBridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBridge.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/useBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACzH,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,SAAS,CACvB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAqBpH"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { SpokeProvider, CreateBridgeIntentParams } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for checking token allowance for bridge operations.
|
|
5
|
-
*
|
|
6
|
-
* This hook verifies if the user has approved enough tokens for a specific bridge action.
|
|
7
|
-
* It automatically queries and tracks the allowance status.
|
|
8
|
-
*
|
|
9
|
-
* @param {BridgeParams} params - The parameters for the bridge to check allowance for.
|
|
10
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
|
|
11
|
-
*
|
|
12
|
-
* @returns {UseQueryResult<boolean, Error>} A React Query result containing:
|
|
13
|
-
* - data: Boolean indicating if allowance is sufficient
|
|
14
|
-
* - isLoading: Loading state indicator
|
|
15
|
-
* - error: Any error that occurred during the check
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const { data: hasAllowed, isLoading } = useBridgeAllowance(params, spokeProvider);
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function useBridgeAllowance(params: CreateBridgeIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
|
|
23
|
-
//# sourceMappingURL=useBridgeAllowance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBridgeAllowance.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/useBridgeAllowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,wBAAwB,GAAG,SAAS,EAC5C,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAsBhC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CreateBridgeIntentParams, SpokeProvider } from '@sodax/sdk';
|
|
2
|
-
interface UseBridgeApproveReturn {
|
|
3
|
-
approve: (params: CreateBridgeIntentParams) => Promise<boolean>;
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
error: Error | null;
|
|
6
|
-
resetError: () => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Hook for approving token spending for bridge actions
|
|
10
|
-
* @param spokeProvider The spoke provider instance for the chain
|
|
11
|
-
* @returns Object containing approve function, loading state, error state and reset function
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* const { approve, isLoading, error } = useBridgeApprove(spokeProvider);
|
|
15
|
-
*
|
|
16
|
-
* // Approve tokens for bridge action
|
|
17
|
-
* await approve({
|
|
18
|
-
* srcChainId: '0x2105.base',
|
|
19
|
-
* srcAsset: '0x...',
|
|
20
|
-
* amount: 1000n,
|
|
21
|
-
* dstChainId: '0x89.polygon',
|
|
22
|
-
* dstAsset: '0x...',
|
|
23
|
-
* recipient: '0x...'
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function useBridgeApprove(spokeProvider: SpokeProvider | undefined): UseBridgeApproveReturn;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=useBridgeApprove.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBridgeApprove.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/useBridgeApprove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG1E,UAAU,sBAAsB;IAC9B,OAAO,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,sBAAsB,CAqCjG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { XToken } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for getting the amount available to be bridged.
|
|
5
|
-
*
|
|
6
|
-
* This hook is used to check if a target chain has enough balance to bridge when bridging.
|
|
7
|
-
* It automatically queries and tracks the available amount to be bridged.
|
|
8
|
-
*
|
|
9
|
-
* @param {SpokeChainId | undefined} chainId - The chain ID to get the balance for
|
|
10
|
-
* @param {string | undefined} token - The token address to get the balance for
|
|
11
|
-
*
|
|
12
|
-
* @returns {UseQueryResult<bigint, Error>} A React Query result containing:
|
|
13
|
-
* - data: The available amount to be bridged (bigint)
|
|
14
|
-
* - error: Any error that occurred during the check
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const { data: balance, isLoading } = useSpokeAssetManagerTokenBalance(chainId, tokenAddress);
|
|
19
|
-
*
|
|
20
|
-
* if (balance) {
|
|
21
|
-
* console.log('Asset manager token balance:', balance.toString());
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function useGetBridgeableAmount(from: XToken | undefined, to: XToken | undefined): UseQueryResult<bigint, Error>;
|
|
26
|
-
//# sourceMappingURL=useGetBridgeableAmount.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetBridgeableAmount.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/useGetBridgeableAmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,EAAE,EAAE,MAAM,GAAG,SAAS,GACrB,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAoB/B"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { XToken, SpokeChainId } from '@sodax/sdk';
|
|
3
|
-
/**
|
|
4
|
-
/**
|
|
5
|
-
* Hook for retrieving all bridgeable tokens from a source token on one chain to a destination chain.
|
|
6
|
-
*
|
|
7
|
-
* This hook queries and tracks the set of tokens on the destination chain that can be bridged to,
|
|
8
|
-
* given a source chain, destination chain, and source token address.
|
|
9
|
-
*
|
|
10
|
-
* @param {SpokeChainId | undefined} from - The source chain ID
|
|
11
|
-
* @param {SpokeChainId | undefined} to - The destination chain ID
|
|
12
|
-
* @param {string | undefined} token - The source token address
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseQueryResult<XToken[], Error>} A React Query result containing:
|
|
15
|
-
* - data: Array of bridgeable tokens (XToken[]) on the destination chain
|
|
16
|
-
* - error: Any error that occurred during the query
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const { data: bridgeableTokens, isLoading } = useGetBridgeableTokens(
|
|
22
|
-
* fromChainId,
|
|
23
|
-
* toChainId,
|
|
24
|
-
* fromTokenAddress
|
|
25
|
-
* );
|
|
26
|
-
*
|
|
27
|
-
* if (bridgeableTokens && bridgeableTokens.length > 0) {
|
|
28
|
-
* bridgeableTokens.forEach(token => {
|
|
29
|
-
* console.log(`Bridgeable token: ${token.symbol} (${token.address}) on chain ${token.xChainId}`);
|
|
30
|
-
* });
|
|
31
|
-
* } else {
|
|
32
|
-
* console.log('No bridgeable tokens found for the selected route.');
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare function useGetBridgeableTokens(from: SpokeChainId | undefined, to: SpokeChainId | undefined, token: string | undefined): UseQueryResult<XToken[], Error>;
|
|
37
|
-
//# sourceMappingURL=useGetBridgeableTokens.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetBridgeableTokens.d.ts","sourceRoot":"","sources":["../../../src/hooks/bridge/useGetBridgeableTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,YAAY,GAAG,SAAS,EAC9B,EAAE,EAAE,YAAY,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,cAAc,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAoBjC"}
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
package/dist/hooks/mm/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './useBorrow';
|
|
2
|
-
export * from './useRepay';
|
|
3
|
-
export * from './useSupply';
|
|
4
|
-
export * from './useWithdraw';
|
|
5
|
-
export * from './useUserReservesData';
|
|
6
|
-
export * from './useReservesData';
|
|
7
|
-
export * from './useMMAllowance';
|
|
8
|
-
export * from './useMMApprove';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { XToken } from '@sodax/types';
|
|
2
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
import type { SpokeProvider } from '@sodax/sdk';
|
|
4
|
-
interface BorrowResponse {
|
|
5
|
-
ok: true;
|
|
6
|
-
value: [string, string];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Hook for borrowing tokens from the Sodax money market.
|
|
10
|
-
*
|
|
11
|
-
* This hook provides functionality to borrow tokens from the money market protocol,
|
|
12
|
-
* handling the entire borrow process including transaction creation, submission,
|
|
13
|
-
* and cross-chain communication.
|
|
14
|
-
*
|
|
15
|
-
* @param {XToken} spokeToken - The token to borrow from the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the borrow transaction. Must be a valid SpokeProvider instance.
|
|
17
|
-
*
|
|
18
|
-
* @returns {UseMutationResult<BorrowResponse, Error, string>} A mutation result object with the following properties:
|
|
19
|
-
* - mutateAsync: Function to execute the borrow transaction
|
|
20
|
-
* - isPending: Boolean indicating if a transaction is in progress
|
|
21
|
-
* - error: Error object if the last transaction failed, null otherwise
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const { mutateAsync: borrow, isPending, error } = useBorrow(spokeToken);
|
|
26
|
-
* await borrow('100');
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @throws {Error} When:
|
|
30
|
-
* - spokeProvider is not available
|
|
31
|
-
* - Transaction execution fails
|
|
32
|
-
*/
|
|
33
|
-
export declare function useBorrow(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<BorrowResponse, Error, string>;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=useBorrow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBorrow.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useBorrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,UAAU,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BlD"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
3
|
-
import type { MoneyMarketAction, SpokeProvider } from '@sodax/sdk';
|
|
4
|
-
/**
|
|
5
|
-
* Hook for checking token allowance for money market operations.
|
|
6
|
-
*
|
|
7
|
-
* This hook verifies if the user has approved enough tokens for a specific money market action
|
|
8
|
-
* (borrow/repay). It automatically queries and tracks the allowance status.
|
|
9
|
-
*
|
|
10
|
-
* @param {XToken} token - The token to check allowance for. Must be an XToken with valid address and chain information.
|
|
11
|
-
* @param {string} amount - The amount to check allowance for, as a decimal string
|
|
12
|
-
* @param {MoneyMarketAction} action - The money market action to check allowance for ('borrow' or 'repay')
|
|
13
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
|
|
14
|
-
*
|
|
15
|
-
* @returns {UseQueryResult<boolean, Error>} A React Query result containing:
|
|
16
|
-
* - data: Boolean indicating if allowance is sufficient
|
|
17
|
-
* - isLoading: Loading state indicator
|
|
18
|
-
* - error: Any error that occurred during the check
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* const { data: hasAllowed, isLoading } = useMMAllowance(token, "100", "repay", provider);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function useMMAllowance(token: XToken, amount: string, action: MoneyMarketAction, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
|
|
26
|
-
//# sourceMappingURL=useMMAllowance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMMAllowance.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useMMAllowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAsBhC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { XToken } from '@sodax/types';
|
|
2
|
-
import type { MoneyMarketAction, SpokeProvider } from '@sodax/sdk';
|
|
3
|
-
interface UseApproveReturn {
|
|
4
|
-
approve: ({ amount, action }: {
|
|
5
|
-
amount: string;
|
|
6
|
-
action: MoneyMarketAction;
|
|
7
|
-
}) => Promise<boolean>;
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
error: Error | null;
|
|
10
|
-
resetError: () => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Hook for approving token spending for money market actions
|
|
14
|
-
* @param token The token to approve spending for
|
|
15
|
-
* @param spokeProvider The spoke provider instance for the chain
|
|
16
|
-
* @returns Object containing approve function, loading state, error state and reset function
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* const { approve, isLoading, error } = useMMApprove(token, spokeProvider);
|
|
20
|
-
*
|
|
21
|
-
* // Approve tokens for supply action
|
|
22
|
-
* await approve({ amount: "100", action: "supply" });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function useMMApprove(token: XToken, spokeProvider: SpokeProvider | undefined): UseApproveReturn;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=useMMApprove.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMMApprove.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useMMApprove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,iBAAiB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjG,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,gBAAgB,CAuCtG"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { SpokeProvider } from '@sodax/sdk';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
3
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
4
|
-
interface RepayResponse {
|
|
5
|
-
ok: true;
|
|
6
|
-
value: [string, string];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Hook for repaying borrowed tokens to the Sodax money market.
|
|
10
|
-
*
|
|
11
|
-
* This hook provides functionality to repay borrowed tokens back to the money market protocol,
|
|
12
|
-
* handling the entire repayment process including transaction creation, submission,
|
|
13
|
-
* and cross-chain communication.
|
|
14
|
-
*
|
|
15
|
-
* @param {XToken} spokeToken - The token to repay on the spoke chain. Must be an XToken with valid address and chain information.
|
|
16
|
-
* @param {SpokeProvider} spokeProvider - The spoke provider to use for the repay transaction. Must be a valid SpokeProvider instance.
|
|
17
|
-
*
|
|
18
|
-
* @returns {UseMutationResult<RepayResponse, Error, string>} A mutation result object with the following properties:
|
|
19
|
-
* - mutateAsync: Function to execute the repay transaction
|
|
20
|
-
* - isPending: Boolean indicating if a transaction is in progress
|
|
21
|
-
* - error: Error object if the last transaction failed, null otherwise
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const { mutateAsync: repay, isPending, error } = useRepay(spokeToken);
|
|
26
|
-
* await repay('100');
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @throws {Error} When:
|
|
30
|
-
* - spokeProvider is not available
|
|
31
|
-
* - Transaction execution fails
|
|
32
|
-
*/
|
|
33
|
-
export declare function useRepay(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<RepayResponse, Error, string>;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=useRepay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRepay.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useRepay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5E,UAAU,aAAa;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BjD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook for fetching reserves data from the Sodax money market.
|
|
3
|
-
*
|
|
4
|
-
* This hook provides access to the current state of all reserves in the money market protocol,
|
|
5
|
-
* including liquidity, interest rates, and other key metrics. The data is automatically
|
|
6
|
-
* fetched and cached using React Query.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const { data: reservesData, isLoading, error } = useReservesData();
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @returns A React Query result object containing:
|
|
14
|
-
* - data: The reserves data when available
|
|
15
|
-
* - isLoading: Loading state indicator
|
|
16
|
-
* - error: Any error that occurred during data fetching
|
|
17
|
-
*/
|
|
18
|
-
export declare function useReservesData(): import("@tanstack/react-query").UseQueryResult<readonly [readonly import("@sodax/sdk").AggregatedReserveData[], import("@sodax/sdk").BaseCurrencyInfo], Error>;
|
|
19
|
-
//# sourceMappingURL=useReservesData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesData.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAgB,eAAe,mKAS9B"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ReservesDataHumanized } from '@sodax/sdk';
|
|
2
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for fetching humanized reserves data from the Sodax money market.
|
|
5
|
-
*
|
|
6
|
-
* This hook provides access to the current state of all reserves (humanized format) in the money market protocol,
|
|
7
|
-
* including liquidity, interest rates, and other key metrics. The data is automatically
|
|
8
|
-
* fetched and cached using React Query.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const { data: reservesHumanized, isLoading, error } = useReservesHumanized();
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @returns A React Query result object containing:
|
|
16
|
-
* - data: The reserves humanized data when available
|
|
17
|
-
* - isLoading: Loading state indicator
|
|
18
|
-
* - error: Any error that occurred during data fetching
|
|
19
|
-
*/
|
|
20
|
-
export declare function useReservesHumanized(): UseQueryResult<ReservesDataHumanized, Error>;
|
|
21
|
-
//# sourceMappingURL=useReservesHumanized.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReservesHumanized.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesHumanized.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAAC,qBAAqB,EAAE,KAAK,CAAC,CASnF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook for fetching list of reserves from the Sodax money market.
|
|
3
|
-
*
|
|
4
|
-
* This hook provides access to the list of addresses of all reserves in the money market protocol.
|
|
5
|
-
* The data is automatically fetched and cached using React Query.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const { data: reservesList, isLoading, error } = useReservesList();
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* @returns A React Query result object containing:
|
|
13
|
-
* - data: The reserves list when available
|
|
14
|
-
* - isLoading: Loading state indicator
|
|
15
|
-
* - error: Any error that occurred during data fetching
|
|
16
|
-
*/
|
|
17
|
-
export declare function useReservesList(): import("@tanstack/react-query").UseQueryResult<readonly `0x${string}`[], Error>;
|
|
18
|
-
//# sourceMappingURL=useReservesList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReservesList.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesList.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,oFAS9B"}
|