@sodax/dapp-kit 0.0.1-rc.22 → 0.0.1-rc.23

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.
Files changed (42) hide show
  1. package/dist/hooks/backend/index.d.ts +17 -0
  2. package/dist/hooks/backend/index.d.ts.map +1 -0
  3. package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts +37 -0
  4. package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts.map +1 -0
  5. package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts +45 -0
  6. package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts.map +1 -0
  7. package/dist/hooks/backend/useBackendIntentByHash.d.ts +36 -0
  8. package/dist/hooks/backend/useBackendIntentByHash.d.ts.map +1 -0
  9. package/dist/hooks/backend/useBackendIntentByTxHash.d.ts +35 -0
  10. package/dist/hooks/backend/useBackendIntentByTxHash.d.ts.map +1 -0
  11. package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts +38 -0
  12. package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts.map +1 -0
  13. package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts +47 -0
  14. package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts.map +1 -0
  15. package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts +47 -0
  16. package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts.map +1 -0
  17. package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts +37 -0
  18. package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts.map +1 -0
  19. package/dist/hooks/backend/useBackendOrderbook.d.ts +46 -0
  20. package/dist/hooks/backend/useBackendOrderbook.d.ts.map +1 -0
  21. package/dist/hooks/bridge/useGetBridgeableTokens.d.ts +1 -1
  22. package/dist/hooks/bridge/useGetBridgeableTokens.d.ts.map +1 -1
  23. package/dist/hooks/index.d.ts +1 -0
  24. package/dist/hooks/index.d.ts.map +1 -1
  25. package/dist/index.js +139 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +131 -1
  28. package/dist/index.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/src/hooks/backend/README.md +135 -0
  31. package/src/hooks/backend/index.ts +23 -0
  32. package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +49 -0
  33. package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +61 -0
  34. package/src/hooks/backend/useBackendIntentByHash.ts +53 -0
  35. package/src/hooks/backend/useBackendIntentByTxHash.ts +52 -0
  36. package/src/hooks/backend/useBackendMoneyMarketAsset.ts +57 -0
  37. package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +67 -0
  38. package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +67 -0
  39. package/src/hooks/backend/useBackendMoneyMarketPosition.ts +56 -0
  40. package/src/hooks/backend/useBackendOrderbook.ts +63 -0
  41. package/src/hooks/bridge/useGetBridgeableTokens.ts +1 -1
  42. package/src/hooks/index.ts +1 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Backend API Hooks
3
+ *
4
+ * This module exports all hooks for interacting with the BackendApiService.
5
+ * These hooks provide a React-friendly interface to the Sodax Backend API,
6
+ * including intent management, solver orderbook, and money market operations.
7
+ */
8
+ export { useBackendIntentByTxHash } from './useBackendIntentByTxHash';
9
+ export { useBackendIntentByHash } from './useBackendIntentByHash';
10
+ export { useBackendOrderbook } from './useBackendOrderbook';
11
+ export { useBackendMoneyMarketPosition } from './useBackendMoneyMarketPosition';
12
+ export { useBackendAllMoneyMarketAssets } from './useBackendAllMoneyMarketAssets';
13
+ export { useBackendMoneyMarketAsset } from './useBackendMoneyMarketAsset';
14
+ export { useBackendMoneyMarketAssetBorrowers } from './useBackendMoneyMarketAssetBorrowers';
15
+ export { useBackendMoneyMarketAssetSuppliers } from './useBackendMoneyMarketAssetSuppliers';
16
+ export { useBackendAllMoneyMarketBorrowers } from './useBackendAllMoneyMarketBorrowers';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/index.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { MoneyMarketAsset } from '@sodax/sdk';
3
+ /**
4
+ * Hook for fetching all money market assets from the backend API.
5
+ *
6
+ * This hook provides access to all available money market assets, including
7
+ * their reserve information, liquidity rates, borrow rates, and market statistics.
8
+ * The data is automatically fetched and cached using React Query.
9
+ *
10
+ * @returns {UseQueryResult<MoneyMarketAsset[]>} A query result object containing:
11
+ * - data: Array of money market asset data when available
12
+ * - isLoading: Boolean indicating if the request is in progress
13
+ * - error: Error object if the request failed
14
+ * - refetch: Function to manually trigger a data refresh
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const { data: assets, isLoading, error } = useAllMoneyMarketAssets();
19
+ *
20
+ * if (isLoading) return <div>Loading assets...</div>;
21
+ * if (error) return <div>Error: {error.message}</div>;
22
+ * if (assets) {
23
+ * console.log('Total assets:', assets.length);
24
+ * assets.forEach(asset => {
25
+ * console.log(`${asset.symbol}: ${asset.liquidityRate} liquidity rate`);
26
+ * });
27
+ * }
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * - Uses React Query for efficient caching and state management
32
+ * - Automatically handles error states and loading indicators
33
+ * - Returns comprehensive asset information including rates and statistics
34
+ * - No parameters required - fetches all available assets
35
+ */
36
+ export declare const useBackendAllMoneyMarketAssets: () => UseQueryResult<MoneyMarketAsset[]>;
37
+ //# sourceMappingURL=useBackendAllMoneyMarketAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBackendAllMoneyMarketAssets.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendAllMoneyMarketAssets.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,8BAA8B,QAAO,cAAc,CAAC,gBAAgB,EAAE,CAUlF,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { MoneyMarketBorrowers } from '@sodax/sdk';
3
+ /**
4
+ * Hook for fetching all money market borrowers from the backend API.
5
+ *
6
+ * This hook provides access to the list of all borrowers across all money market assets,
7
+ * with pagination support. The data is automatically fetched and cached using React Query.
8
+ *
9
+ * @param {Object} params - Pagination parameters for fetching all borrowers
10
+ * @param {string} params.offset - The offset for pagination (number as string)
11
+ * @param {string} params.limit - The limit for pagination (number as string)
12
+ *
13
+ * @returns {UseQueryResult<MoneyMarketBorrowers | undefined>} A query result object containing:
14
+ * - data: The all borrowers data when available
15
+ * - isLoading: Boolean indicating if the request is in progress
16
+ * - error: Error object if the request failed
17
+ * - refetch: Function to manually trigger a data refresh
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const { data: borrowers, isLoading, error } = useAllMoneyMarketBorrowers({
22
+ * offset: '0',
23
+ * limit: '50'
24
+ * });
25
+ *
26
+ * if (isLoading) return <div>Loading borrowers...</div>;
27
+ * if (error) return <div>Error: {error.message}</div>;
28
+ * if (borrowers) {
29
+ * console.log('Total borrowers:', borrowers.total);
30
+ * console.log('Borrowers:', borrowers.borrowers);
31
+ * }
32
+ * ```
33
+ *
34
+ * @remarks
35
+ * - The query is disabled when params are undefined or invalid
36
+ * - Uses React Query for efficient caching and state management
37
+ * - Automatically handles error states and loading indicators
38
+ * - Supports pagination through offset and limit parameters
39
+ * - Returns borrowers across all money market assets
40
+ */
41
+ export declare const useBackendAllMoneyMarketBorrowers: (params: {
42
+ offset: string;
43
+ limit: string;
44
+ } | undefined) => UseQueryResult<MoneyMarketBorrowers | undefined>;
45
+ //# sourceMappingURL=useBackendAllMoneyMarketBorrowers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBackendAllMoneyMarketBorrowers.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,iCAAiC,WACpC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,KACpD,cAAc,CAAC,oBAAoB,GAAG,SAAS,CAejD,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { IntentResponse } from '@sodax/sdk';
3
+ /**
4
+ * Hook for fetching intent details by intent hash from the backend API.
5
+ *
6
+ * This hook provides access to intent data using the intent hash directly,
7
+ * including intent details, events, and transaction information. The data is automatically
8
+ * fetched and cached using React Query.
9
+ *
10
+ * @param {string | undefined} intentHash - The intent hash to fetch intent for. If undefined, the query will be disabled.
11
+ *
12
+ * @returns {UseQueryResult<IntentResponse | undefined>} A query result object containing:
13
+ * - data: The intent response 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: intent, isLoading, error } = useIntentByHash('0xabc...');
21
+ *
22
+ * if (isLoading) return <div>Loading intent...</div>;
23
+ * if (error) return <div>Error: {error.message}</div>;
24
+ * if (intent) {
25
+ * console.log('Intent found:', intent.intentHash);
26
+ * console.log('Open status:', intent.open);
27
+ * }
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * - The query is disabled when intentHash is undefined or empty
32
+ * - Uses React Query for efficient caching and state management
33
+ * - Automatically handles error states and loading indicators
34
+ */
35
+ export declare const useBackendIntentByHash: (intentHash: string | undefined) => UseQueryResult<IntentResponse | undefined>;
36
+ //# sourceMappingURL=useBackendIntentByHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBackendIntentByHash.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendIntentByHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,sBAAsB,eAAgB,MAAM,GAAG,SAAS,KAAG,cAAc,CAAC,cAAc,GAAG,SAAS,CAehH,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { IntentResponse } from '@sodax/sdk';
3
+ /**
4
+ * Hook for fetching intent details by transaction hash from the backend API.
5
+ *
6
+ * This hook provides access to intent data associated with a specific transaction hash,
7
+ * including intent details, events, and transaction information. The data is automatically
8
+ * fetched and cached using React Query.
9
+ *
10
+ * @param {string | undefined} txHash - The transaction hash to fetch intent for. If undefined, the query will be disabled.
11
+ *
12
+ * @returns {UseQueryResult<IntentResponse | undefined>} A query result object containing:
13
+ * - data: The intent response 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: intent, isLoading, error } = useIntentByTxHash('0x123...');
21
+ *
22
+ * if (isLoading) return <div>Loading intent...</div>;
23
+ * if (error) return <div>Error: {error.message}</div>;
24
+ * if (intent) {
25
+ * console.log('Intent found:', intent.intentHash);
26
+ * }
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * - The query is disabled when txHash is undefined or empty
31
+ * - Uses React Query for efficient caching and state management
32
+ * - Automatically handles error states and loading indicators
33
+ */
34
+ export declare const useBackendIntentByTxHash: (txHash: string | undefined) => UseQueryResult<IntentResponse | undefined>;
35
+ //# sourceMappingURL=useBackendIntentByTxHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBackendIntentByTxHash.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendIntentByTxHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,wBAAwB,WAAY,MAAM,GAAG,SAAS,KAAG,cAAc,CAAC,cAAc,GAAG,SAAS,CAe9G,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { MoneyMarketAsset } from '@sodax/sdk';
3
+ /**
4
+ * Hook for fetching specific money market asset details from the backend API.
5
+ *
6
+ * This hook provides access to detailed information for a specific money market asset,
7
+ * including reserve information, liquidity rates, borrow rates, and market statistics.
8
+ * The data is automatically fetched and cached using React Query.
9
+ *
10
+ * @param {string | undefined} reserveAddress - The reserve contract address. If undefined, the query will be disabled.
11
+ *
12
+ * @returns {UseQueryResult<MoneyMarketAsset | undefined>} A query result object containing:
13
+ * - data: The money market asset 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: asset, isLoading, error } = useMoneyMarketAsset('0xabc...');
21
+ *
22
+ * if (isLoading) return <div>Loading asset...</div>;
23
+ * if (error) return <div>Error: {error.message}</div>;
24
+ * if (asset) {
25
+ * console.log('Asset symbol:', asset.symbol);
26
+ * console.log('Liquidity rate:', asset.liquidityRate);
27
+ * console.log('Variable borrow rate:', asset.variableBorrowRate);
28
+ * }
29
+ * ```
30
+ *
31
+ * @remarks
32
+ * - The query is disabled when reserveAddress is undefined or empty
33
+ * - Uses React Query for efficient caching and state management
34
+ * - Automatically handles error states and loading indicators
35
+ * - Returns comprehensive asset information for the specified reserve
36
+ */
37
+ export declare const useBackendMoneyMarketAsset: (reserveAddress: string | undefined) => UseQueryResult<MoneyMarketAsset | undefined>;
38
+ //# sourceMappingURL=useBackendMoneyMarketAsset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBackendMoneyMarketAsset.d.ts","sourceRoot":"","sources":["../../../src/hooks/backend/useBackendMoneyMarketAsset.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,0BAA0B,mBACrB,MAAM,GAAG,SAAS,KACjC,cAAc,CAAC,gBAAgB,GAAG,SAAS,CAe7C,CAAC"}
@@ -0,0 +1,47 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,47 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,37 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,46 @@
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
@@ -0,0 +1 @@
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,5 +1,5 @@
1
1
  import { type UseQueryResult } from '@tanstack/react-query';
2
- import { type XToken, type SpokeChainId } from '@sodax/sdk';
2
+ import type { XToken, SpokeChainId } from '@sodax/sdk';
3
3
  /**
4
4
  /**
5
5
  * Hook for retrieving all bridgeable tokens from a source token on one chain to a destination chain.
@@ -1 +1 @@
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,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
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"}
@@ -2,5 +2,6 @@ export * from './shared';
2
2
  export * from './provider';
3
3
  export * from './mm';
4
4
  export * from './swap';
5
+ export * from './backend';
5
6
  export * from './bridge';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,UAAU,CAAC"}
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/index.js CHANGED
@@ -393,6 +393,136 @@ function useCancelSwap(spokeProvider) {
393
393
  }
394
394
  });
395
395
  }
396
+ var useBackendIntentByTxHash = (txHash) => {
397
+ const { sodax } = useSodaxContext();
398
+ return reactQuery.useQuery({
399
+ queryKey: ["backend", "intent", "txHash", txHash],
400
+ queryFn: async () => {
401
+ if (!txHash) {
402
+ return void 0;
403
+ }
404
+ return sodax.backendApiService.getIntentByTxHash(txHash);
405
+ },
406
+ enabled: !!txHash && txHash.length > 0,
407
+ retry: 3
408
+ });
409
+ };
410
+ var useBackendIntentByHash = (intentHash) => {
411
+ const { sodax } = useSodaxContext();
412
+ return reactQuery.useQuery({
413
+ queryKey: ["backend", "intent", "hash", intentHash],
414
+ queryFn: async () => {
415
+ if (!intentHash) {
416
+ return void 0;
417
+ }
418
+ return sodax.backendApiService.getIntentByHash(intentHash);
419
+ },
420
+ enabled: !!intentHash && intentHash.length > 0,
421
+ retry: 3
422
+ });
423
+ };
424
+ var useBackendOrderbook = (params) => {
425
+ const { sodax } = useSodaxContext();
426
+ return reactQuery.useQuery({
427
+ queryKey: ["backend", "solver", "orderbook", params],
428
+ queryFn: async () => {
429
+ if (!params || !params.offset || !params.limit) {
430
+ return void 0;
431
+ }
432
+ return sodax.backendApiService.getOrderbook(params);
433
+ },
434
+ enabled: !!params && !!params.offset && !!params.limit,
435
+ staleTime: 30 * 1e3,
436
+ // 30 seconds for real-time data
437
+ retry: 3
438
+ });
439
+ };
440
+ var useBackendMoneyMarketPosition = (userAddress) => {
441
+ const { sodax } = useSodaxContext();
442
+ return reactQuery.useQuery({
443
+ queryKey: ["backend", "moneymarket", "position", userAddress],
444
+ queryFn: async () => {
445
+ if (!userAddress) {
446
+ return void 0;
447
+ }
448
+ return sodax.backendApiService.getMoneyMarketPosition(userAddress);
449
+ },
450
+ enabled: !!userAddress && userAddress.length > 0,
451
+ retry: 3
452
+ });
453
+ };
454
+ var useBackendAllMoneyMarketAssets = () => {
455
+ const { sodax } = useSodaxContext();
456
+ return reactQuery.useQuery({
457
+ queryKey: ["backend", "moneymarket", "assets", "all"],
458
+ queryFn: async () => {
459
+ return sodax.backendApiService.getAllMoneyMarketAssets();
460
+ },
461
+ retry: 3
462
+ });
463
+ };
464
+ var useBackendMoneyMarketAsset = (reserveAddress) => {
465
+ const { sodax } = useSodaxContext();
466
+ return reactQuery.useQuery({
467
+ queryKey: ["backend", "moneymarket", "asset", reserveAddress],
468
+ queryFn: async () => {
469
+ if (!reserveAddress) {
470
+ return void 0;
471
+ }
472
+ return sodax.backendApiService.getMoneyMarketAsset(reserveAddress);
473
+ },
474
+ enabled: !!reserveAddress && reserveAddress.length > 0,
475
+ retry: 3
476
+ });
477
+ };
478
+ var useBackendMoneyMarketAssetBorrowers = (params) => {
479
+ const { sodax } = useSodaxContext();
480
+ return reactQuery.useQuery({
481
+ queryKey: ["backend", "moneymarket", "asset", "borrowers", params],
482
+ queryFn: async () => {
483
+ if (!params.reserveAddress || !params.offset || !params.limit) {
484
+ return void 0;
485
+ }
486
+ return sodax.backendApiService.getMoneyMarketAssetBorrowers(params.reserveAddress, {
487
+ offset: params.offset,
488
+ limit: params.limit
489
+ });
490
+ },
491
+ enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
492
+ retry: 3
493
+ });
494
+ };
495
+ var useBackendMoneyMarketAssetSuppliers = (params) => {
496
+ const { sodax } = useSodaxContext();
497
+ return reactQuery.useQuery({
498
+ queryKey: ["backend", "moneymarket", "asset", "suppliers", params],
499
+ queryFn: async () => {
500
+ if (!params.reserveAddress || !params.offset || !params.limit) {
501
+ return void 0;
502
+ }
503
+ return sodax.backendApiService.getMoneyMarketAssetSuppliers(params.reserveAddress, {
504
+ offset: params.offset,
505
+ limit: params.limit
506
+ });
507
+ },
508
+ enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
509
+ retry: 3
510
+ });
511
+ };
512
+ var useBackendAllMoneyMarketBorrowers = (params) => {
513
+ const { sodax } = useSodaxContext();
514
+ return reactQuery.useQuery({
515
+ queryKey: ["backend", "moneymarket", "borrowers", "all", params],
516
+ queryFn: async () => {
517
+ if (!params || !params.offset || !params.limit) {
518
+ return void 0;
519
+ }
520
+ return sodax.backendApiService.getAllMoneyMarketBorrowers(params);
521
+ },
522
+ enabled: !!params && !!params.offset && !!params.limit,
523
+ retry: 3
524
+ });
525
+ };
396
526
  function useBridgeAllowance(params, spokeProvider) {
397
527
  const { sodax } = useSodaxContext();
398
528
  return reactQuery.useQuery({
@@ -514,6 +644,15 @@ var getSpokeTokenAddressByVault = (spokeChainId, vault) => {
514
644
 
515
645
  exports.SodaxProvider = SodaxProvider;
516
646
  exports.getSpokeTokenAddressByVault = getSpokeTokenAddressByVault;
647
+ exports.useBackendAllMoneyMarketAssets = useBackendAllMoneyMarketAssets;
648
+ exports.useBackendAllMoneyMarketBorrowers = useBackendAllMoneyMarketBorrowers;
649
+ exports.useBackendIntentByHash = useBackendIntentByHash;
650
+ exports.useBackendIntentByTxHash = useBackendIntentByTxHash;
651
+ exports.useBackendMoneyMarketAsset = useBackendMoneyMarketAsset;
652
+ exports.useBackendMoneyMarketAssetBorrowers = useBackendMoneyMarketAssetBorrowers;
653
+ exports.useBackendMoneyMarketAssetSuppliers = useBackendMoneyMarketAssetSuppliers;
654
+ exports.useBackendMoneyMarketPosition = useBackendMoneyMarketPosition;
655
+ exports.useBackendOrderbook = useBackendOrderbook;
517
656
  exports.useBorrow = useBorrow;
518
657
  exports.useBridge = useBridge;
519
658
  exports.useBridgeAllowance = useBridgeAllowance;