@sodax/dapp-kit 0.0.1-rc.2 → 0.0.1-rc.20

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 (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -37
  3. package/dist/contexts/index.d.ts +4 -1
  4. package/dist/contexts/index.d.ts.map +1 -1
  5. package/dist/core/index.d.ts +2 -3
  6. package/dist/core/index.d.ts.map +1 -1
  7. package/dist/hooks/mm/index.d.ts +3 -1
  8. package/dist/hooks/mm/index.d.ts.map +1 -1
  9. package/dist/hooks/mm/useBorrow.d.ts +13 -4
  10. package/dist/hooks/mm/useBorrow.d.ts.map +1 -1
  11. package/dist/hooks/mm/useMMAllowance.d.ts +26 -0
  12. package/dist/hooks/mm/useMMAllowance.d.ts.map +1 -0
  13. package/dist/hooks/mm/useMMApprove.d.ts +27 -0
  14. package/dist/hooks/mm/useMMApprove.d.ts.map +1 -0
  15. package/dist/hooks/mm/useRepay.d.ts +13 -4
  16. package/dist/hooks/mm/useRepay.d.ts.map +1 -1
  17. package/dist/hooks/mm/useReservesData.d.ts +19 -0
  18. package/dist/hooks/mm/useReservesData.d.ts.map +1 -0
  19. package/dist/hooks/mm/useReservesHumanized.d.ts +21 -0
  20. package/dist/hooks/mm/useReservesHumanized.d.ts.map +1 -0
  21. package/dist/hooks/mm/useReservesList.d.ts +18 -0
  22. package/dist/hooks/mm/useReservesList.d.ts.map +1 -0
  23. package/dist/hooks/mm/useReservesUsdFormat.d.ts +23 -0
  24. package/dist/hooks/mm/useReservesUsdFormat.d.ts.map +1 -0
  25. package/dist/hooks/mm/useSupply.d.ts +4 -2
  26. package/dist/hooks/mm/useSupply.d.ts.map +1 -1
  27. package/dist/hooks/mm/useUserFormattedSummary.d.ts +21 -0
  28. package/dist/hooks/mm/useUserFormattedSummary.d.ts.map +1 -0
  29. package/dist/hooks/mm/useUserReservesData.d.ts +19 -8
  30. package/dist/hooks/mm/useUserReservesData.d.ts.map +1 -1
  31. package/dist/hooks/mm/useWithdraw.d.ts +11 -4
  32. package/dist/hooks/mm/useWithdraw.d.ts.map +1 -1
  33. package/dist/hooks/provider/useHubProvider.d.ts +1 -1
  34. package/dist/hooks/provider/useHubProvider.d.ts.map +1 -1
  35. package/dist/hooks/provider/useSpokeProvider.d.ts +16 -2
  36. package/dist/hooks/provider/useSpokeProvider.d.ts.map +1 -1
  37. package/dist/hooks/shared/index.d.ts +1 -2
  38. package/dist/hooks/shared/index.d.ts.map +1 -1
  39. package/dist/hooks/shared/useEstimateGas.d.ts +4 -0
  40. package/dist/hooks/shared/useEstimateGas.d.ts.map +1 -0
  41. package/dist/hooks/swap/index.d.ts +4 -1
  42. package/dist/hooks/swap/index.d.ts.map +1 -1
  43. package/dist/hooks/swap/useCancelSwap.d.ts +29 -0
  44. package/dist/hooks/swap/useCancelSwap.d.ts.map +1 -0
  45. package/dist/hooks/swap/useQuote.d.ts +4 -4
  46. package/dist/hooks/swap/useQuote.d.ts.map +1 -1
  47. package/dist/hooks/swap/useStatus.d.ts +3 -3
  48. package/dist/hooks/swap/useStatus.d.ts.map +1 -1
  49. package/dist/hooks/swap/useSwap.d.ts +29 -0
  50. package/dist/hooks/swap/useSwap.d.ts.map +1 -0
  51. package/dist/hooks/swap/useSwapAllowance.d.ts +23 -0
  52. package/dist/hooks/swap/useSwapAllowance.d.ts.map +1 -0
  53. package/dist/hooks/swap/useSwapApprove.d.ts +25 -0
  54. package/dist/hooks/swap/useSwapApprove.d.ts.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +244 -189
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.mjs +238 -186
  60. package/dist/index.mjs.map +1 -1
  61. package/dist/providers/SodaxProvider.d.ts +4 -2
  62. package/dist/providers/SodaxProvider.d.ts.map +1 -1
  63. package/dist/types.d.ts +17 -0
  64. package/dist/types.d.ts.map +1 -0
  65. package/package.json +5 -6
  66. package/src/contexts/index.ts +4 -1
  67. package/src/core/index.ts +5 -33
  68. package/src/hooks/mm/index.ts +3 -1
  69. package/src/hooks/mm/useBorrow.ts +20 -10
  70. package/src/hooks/mm/useMMAllowance.ts +55 -0
  71. package/src/hooks/mm/useMMApprove.ts +67 -0
  72. package/src/hooks/mm/useRepay.ts +20 -10
  73. package/src/hooks/mm/useReservesData.ts +30 -0
  74. package/src/hooks/mm/useReservesHumanized.ts +30 -0
  75. package/src/hooks/mm/useReservesList.ts +29 -0
  76. package/src/hooks/mm/useReservesUsdFormat.ts +38 -0
  77. package/src/hooks/mm/useSupply.ts +9 -6
  78. package/src/hooks/mm/useUserFormattedSummary.ts +54 -0
  79. package/src/hooks/mm/useUserReservesData.ts +30 -48
  80. package/src/hooks/mm/useWithdraw.ts +17 -11
  81. package/src/hooks/provider/useHubProvider.ts +2 -20
  82. package/src/hooks/provider/useSpokeProvider.ts +91 -6
  83. package/src/hooks/shared/index.ts +1 -2
  84. package/src/hooks/shared/useEstimateGas.ts +18 -0
  85. package/src/hooks/swap/index.ts +4 -1
  86. package/src/hooks/swap/useCancelSwap.ts +44 -0
  87. package/src/hooks/swap/useQuote.ts +5 -5
  88. package/src/hooks/swap/useStatus.ts +3 -3
  89. package/src/hooks/swap/{useCreateIntentOrder.ts → useSwap.ts} +16 -18
  90. package/src/hooks/swap/useSwapAllowance.ts +47 -0
  91. package/src/hooks/swap/useSwapApprove.ts +68 -0
  92. package/src/index.ts +1 -0
  93. package/src/providers/SodaxProvider.tsx +22 -5
  94. package/src/types.ts +22 -0
  95. package/dist/hooks/mm/useHubWalletAddress.d.ts +0 -24
  96. package/dist/hooks/mm/useHubWalletAddress.d.ts.map +0 -1
  97. package/dist/hooks/shared/useAllowance.d.ts +0 -3
  98. package/dist/hooks/shared/useAllowance.d.ts.map +0 -1
  99. package/dist/hooks/shared/useApprove.d.ts +0 -10
  100. package/dist/hooks/shared/useApprove.d.ts.map +0 -1
  101. package/dist/hooks/swap/useCreateIntentOrder.d.ts +0 -33
  102. package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +0 -1
  103. package/src/hooks/mm/useHubWalletAddress.ts +0 -49
  104. package/src/hooks/shared/useAllowance.ts +0 -31
  105. package/src/hooks/shared/useApprove.ts +0 -53
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2025] [Sodax]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -10,24 +10,28 @@ dApp Kit is a collection of React components, hooks, and utilities designed to s
10
10
  - Withdraw tokens from the money market (`useWithdraw`)
11
11
  - Borrow tokens from the money market (`useBorrow`)
12
12
  - Repay borrowed tokens (`useRepay`)
13
+ - Check token allowance (`useMMAllowance`)
14
+ - Approve token spending (`useMMApprove`)
13
15
  - Get user reserves data (`useUserReservesData`)
14
- - Calculate hub wallet address by using spoke chain id and spoke chain wallet address (`useHubWalletAddress`)
16
+ - Get reserves data (`useReservesData`)
17
+ - Get humanized reserves data (`useReservesHumanized`)
18
+ - Get list of reserves (`useReservesList`)
19
+ - Get USD formatted reserves data (`useReservesUsdFormat`)
20
+ - Get formatted user portfolio summary (`useUserFormattedSummary`)
15
21
 
16
22
  - Swap/Intent
17
23
  - Get quote for an intent order (`useQuote`)
18
- - Create and submit an intent order (`useCreateIntentOrder`)
24
+ - Create and submit an swap intent order (`useSwap`)
19
25
  - Get status of an intent order (`useStatus`)
26
+ - Check token allowance (`useSwapAllowance`)
27
+ - Approve token spending (`useSwapApprove`)
28
+ - Cancel a swap intent order (`useCancelSwap`)
20
29
 
21
30
  - Provider
22
31
  - Get hub chain provider (`useHubProvider`)
23
32
  - Get spoke chain provider (`useSpokeProvider`)
24
33
  - Get wallet provider (`useWalletProvider`)
25
34
 
26
- - Token Management
27
- - Check token allowance (`useAllowance`)
28
- - Approve token spending (`useApprove`)
29
-
30
-
31
35
  ## Installation
32
36
 
33
37
  ```bash
@@ -43,7 +47,7 @@ pnpm add @sodax/dapp-kit
43
47
  1. First, install the required dependencies:
44
48
 
45
49
  ```bash
46
- npm install @sodax/dapp-kit @tanstack/react-query @sodax/wallet-sdk
50
+ pnpm install @sodax/dapp-kit @tanstack/react-query @sodax/wallet-sdk
47
51
  ```
48
52
 
49
53
  2. Set up the providers in your app:
@@ -52,31 +56,16 @@ npm install @sodax/dapp-kit @tanstack/react-query @sodax/wallet-sdk
52
56
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
53
57
  import { XWagmiProviders } from '@sodax/wallet-sdk';
54
58
  import { SodaxProvider } from '@sodax/dapp-kit';
55
- import { SONIC_MAINNET_CHAIN_ID } from '@sodax/types';
56
59
 
57
60
  const queryClient = new QueryClient();
58
61
 
59
- // Configure Sodax
60
- const sodaxConfig = {
61
- hubProviderConfig: {
62
- hubRpcUrl: 'https://rpc.soniclabs.com',
63
- chainConfig: getHubChainConfig(SONIC_MAINNET_CHAIN_ID),
64
- },
65
- moneyMarket: getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID),
66
- solver: {
67
- intentsContract: '0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef',
68
- solverApiEndpoint: 'https://staging-new-world.iconblockchain.xyz',
69
- partnerFee: {
70
- address: '0x0Ab764AB3816cD036Ea951bE973098510D8105A6',
71
- percentage: 100, // 1%
72
- },
73
- },
74
- relayerApiEndpoint: 'https://xcall-relay.nw.iconblockchain.xyz',
62
+ const rpcConfig = {
63
+ "solana": "private rpc url",
75
64
  };
76
65
 
77
66
  function App() {
78
67
  return (
79
- <SodaxProvider testnet={false} config={sodaxConfig}>
68
+ <SodaxProvider testnet={false} rpcConfig={rpcConfig}>
80
69
  <QueryClientProvider client={queryClient}>
81
70
  <XWagmiProviders
82
71
  config={{
@@ -146,11 +135,11 @@ function MoneyMarketComponent() {
146
135
  }
147
136
 
148
137
  // Token Management
149
- import { useAllowance, useApprove } from '@sodax/dapp-kit';
138
+ import { useMMAllowance, useApprove } from '@sodax/dapp-kit';
150
139
 
151
140
  function TokenManagementComponent() {
152
141
  // Check token allowance
153
- const { data: hasAllowed } = useAllowance(token, amount);
142
+ const { data: hasAllowed } = useMMAllowance(token, amount);
154
143
 
155
144
  // Approve token spending
156
145
  const { approve, isLoading: isApproving } = useApprove(token);
@@ -160,7 +149,7 @@ function TokenManagementComponent() {
160
149
  }
161
150
 
162
151
  // Swap Operations
163
- import { useQuote, useCreateIntentOrder, useStatus } from '@sodax/dapp-kit';
152
+ import { useQuote, useSwap, useStatus } from '@sodax/dapp-kit';
164
153
 
165
154
  function SwapComponent() {
166
155
  // Get quote for an intent order
@@ -174,9 +163,9 @@ function SwapComponent() {
174
163
  });
175
164
 
176
165
  // Create and submit an intent order
177
- const { mutateAsync: createOrder, isPending: isCreating } = useCreateIntentOrder();
178
- const handleCreateOrder = async () => {
179
- const order = await createOrder({
166
+ const { mutateAsync: swap, isPending: isCreating } = useSwap();
167
+ const handleSwap = async () => {
168
+ const order = await swap({
180
169
  token_src: '0x...',
181
170
  token_src_blockchain_id: '0xa86a.avax',
182
171
  token_dst: '0x...',
@@ -210,18 +199,22 @@ function SwapComponent() {
210
199
  - [`useRepay()`](./src/hooks/mm/useRepay.ts) - Repay borrowed tokens
211
200
  - [`useSupply()`](./src/hooks/mm/useSupply.ts) - Supply tokens to the money market
212
201
  - [`useWithdraw()`](./src/hooks/mm/useWithdraw.ts) - Withdraw supplied tokens
213
- - [`useUserReservesData()`](./src/hooks/mm/useUserReservesData.ts) - Get list of supplied assets
214
- - [`useHubWalletAddress()`](./src/hooks/mm/useHubWalletAddress.ts) - Get hub wallet address for a spoke chain
202
+ - [`useUserReservesData()`](./src/hooks/mm/useUserReservesData.ts) - Get user's reserves data(supplied asset and debt)
203
+ - [`useReservesData()`](./src/hooks/mm/useReservesData.ts) - Get reserves data
204
+ - [`useMMAllowance()`](./src/hooks/mm/useMMAllowance.ts) - Check token allowance for a specific amount
205
+ - [`useMMApprove()`](./src/hooks/mm/useMMApprove.ts) - Approve token spending
215
206
 
216
207
  #### Swap Hooks
217
208
  - [`useQuote()`](./src/hooks/swap/useQuote.ts) - Get quote for an intent order
218
- - [`useCreateIntentOrder()`](./src/hooks/swap/useCreateIntentOrder.ts) - Create and submit an intent order
209
+ - [`useSwap()`](./src/hooks/swap/useSwap.ts) - Create and submit an intent order
219
210
  - [`useStatus()`](./src/hooks/swap/useStatus.ts) - Get status of an intent order
211
+ - [`useSwapAllowance()`](./src/hooks/swap/useSwapAllowance.ts) - Check token allowance for an intent order
212
+ - [`useSwapApprove()`](./src/hooks/swap/useSwapApprove.ts) - Approve token spending
213
+ - [`useCancelSwap()`](./src/hooks/swap/useCancelSwap.ts) - Cancel a swap intent order
220
214
 
221
215
  #### Shared Hooks
222
216
  - [`useSodaxContext()`](./src/hooks/shared/useSodaxContext.ts) - Access Sodax context and configuration
223
- - [`useAllowance()`](./src/hooks/shared/useAllowance.ts) - Check token allowance for a specific amount
224
- - [`useApprove()`](./src/hooks/shared/useApprove.ts) - Approve token spending
217
+ - [`useEstimateGas()`](./src/hooks/shared/useEstimateGas.ts) - Estimate gas costs for transactions
225
218
 
226
219
 
227
220
  ## Contributing
@@ -1,7 +1,10 @@
1
- import type { Sodax } from '@sodax/sdk';
1
+ import type { EvmHubProvider, Sodax } from '@sodax/sdk';
2
+ import type { RpcConfig } from '@/types';
2
3
  export interface SodaxContextType {
3
4
  sodax: Sodax;
4
5
  testnet: boolean;
6
+ hubProvider: EvmHubProvider | undefined;
7
+ rpcConfig: RpcConfig;
5
8
  }
6
9
  export declare const SodaxContext: import("react").Context<SodaxContextType | null>;
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,kDAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,cAAc,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,kDAA+C,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { XToken, ChainId } from '@sodax/types';
2
- export declare const allXTokens: XToken[];
3
- export declare const getSpokeTokenAddressByVault: (spokeChainId: ChainId, vault: string) => string;
1
+ import type { ChainId } from '@sodax/types';
2
+ export declare const getSpokeTokenAddressByVault: (spokeChainId: ChainId, vault: string) => string | undefined;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIpD,eAAO,MAAM,UAAU,EAAE,MAAM,EAAO,CAAC;AAyBvC,eAAO,MAAM,2BAA2B,iBAAkB,OAAO,SAAS,MAAM,WAU/E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,2BAA2B,iBAAkB,OAAO,SAAS,MAAM,uBAO/E,CAAC"}
@@ -3,5 +3,7 @@ export * from './useRepay';
3
3
  export * from './useSupply';
4
4
  export * from './useWithdraw';
5
5
  export * from './useUserReservesData';
6
- export * from './useHubWalletAddress';
6
+ export * from './useReservesData';
7
+ export * from './useMMAllowance';
8
+ export * from './useMMApprove';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,uBAAuB,CAAC"}
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,8 +1,9 @@
1
- import type { ChainId, XToken } from '@sodax/types';
1
+ import type { XToken } from '@sodax/types';
2
2
  import { type UseMutationResult } from '@tanstack/react-query';
3
+ import type { SpokeProvider } from '@sodax/sdk';
3
4
  interface BorrowResponse {
4
5
  ok: true;
5
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
6
7
  }
7
8
  /**
8
9
  * Hook for borrowing tokens from the Sodax money market.
@@ -11,9 +12,17 @@ interface BorrowResponse {
11
12
  * handling the entire borrow process including transaction creation, submission,
12
13
  * and cross-chain communication.
13
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
+ *
14
23
  * @example
15
24
  * ```typescript
16
- * const { mutateAsync: borrow, isPending, error } = useBorrow(hubToken, spokeChainId);
25
+ * const { mutateAsync: borrow, isPending, error } = useBorrow(spokeToken);
17
26
  * await borrow('100');
18
27
  * ```
19
28
  *
@@ -21,6 +30,6 @@ interface BorrowResponse {
21
30
  * - spokeProvider is not available
22
31
  * - Transaction execution fails
23
32
  */
24
- export declare function useBorrow(hubToken: XToken, spokeChainId: ChainId): UseMutationResult<BorrowResponse, Error, string>;
33
+ export declare function useBorrow(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<BorrowResponse, Error, string>;
25
34
  export {};
26
35
  //# sourceMappingURL=useBorrow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBorrow.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useBorrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK5E,UAAU,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BnH"}
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"}
@@ -0,0 +1,26 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,27 @@
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
@@ -0,0 +1 @@
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,8 +1,9 @@
1
- import type { ChainId, XToken } from '@sodax/types';
1
+ import type { SpokeProvider } from '@sodax/sdk';
2
+ import type { XToken } from '@sodax/types';
2
3
  import { type UseMutationResult } from '@tanstack/react-query';
3
4
  interface RepayResponse {
4
5
  ok: true;
5
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
6
7
  }
7
8
  /**
8
9
  * Hook for repaying borrowed tokens to the Sodax money market.
@@ -11,9 +12,17 @@ interface RepayResponse {
11
12
  * handling the entire repayment process including transaction creation, submission,
12
13
  * and cross-chain communication.
13
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
+ *
14
23
  * @example
15
24
  * ```typescript
16
- * const { mutateAsync: repay, isPending, error } = useRepay(hubToken, spokeChainId);
25
+ * const { mutateAsync: repay, isPending, error } = useRepay(spokeToken);
17
26
  * await repay('100');
18
27
  * ```
19
28
  *
@@ -21,6 +30,6 @@ interface RepayResponse {
21
30
  * - spokeProvider is not available
22
31
  * - Transaction execution fails
23
32
  */
24
- export declare function useRepay(hubToken: XToken, spokeChainId: ChainId): UseMutationResult<RepayResponse, Error, string>;
33
+ export declare function useRepay(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<RepayResponse, Error, string>;
25
34
  export {};
26
35
  //# sourceMappingURL=useRepay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRepay.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useRepay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK5E,UAAU,aAAa;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,iBAAiB,CAAC,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BjH"}
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"}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesData.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAgB,eAAe,mKAS9B"}
@@ -0,0 +1,21 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReservesList.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesList.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,oFAS9B"}
@@ -0,0 +1,23 @@
1
+ import type { FormatReserveUSDResponse, ReserveData } from '@sodax/sdk';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ /**
4
+ * Hook for fetching formatted summary of Sodax user portfolio (holdings, total liquidity,
5
+ * collateral, borrows, liquidation threshold, health factor, available borrowing power, etc..).
6
+ *
7
+ * This hook provides access to the current state of user portfolio in the money market protocol.
8
+ * The data is automatically fetched and cached using React Query.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const { data: userFormattedSummary, isLoading, error } = useUserFormattedSummary();
13
+ * ```
14
+ *
15
+ * @returns A React Query result object containing:
16
+ * - data: The formatted summary of Sodax user portfolio when available
17
+ * - isLoading: Loading state indicator
18
+ * - error: Any error that occurred during data fetching
19
+ */
20
+ export declare function useReservesUsdFormat(): UseQueryResult<(ReserveData & {
21
+ priceInMarketReferenceCurrency: string;
22
+ } & FormatReserveUSDResponse)[], Error>;
23
+ //# sourceMappingURL=useReservesUsdFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReservesUsdFormat.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useReservesUsdFormat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CACpD,CAAC,WAAW,GAAG;IAAE,8BAA8B,EAAE,MAAM,CAAA;CAAE,GAAG,wBAAwB,CAAC,EAAE,EACvF,KAAK,CACN,CAaA"}
@@ -1,8 +1,9 @@
1
+ import type { SpokeProvider } from '@sodax/sdk';
1
2
  import type { XToken } from '@sodax/types';
2
3
  import { type UseMutationResult } from '@tanstack/react-query';
3
4
  interface SupplyResponse {
4
5
  ok: true;
5
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
6
7
  }
7
8
  /**
8
9
  * Hook for supplying tokens to the Sodax money market.
@@ -12,6 +13,7 @@ interface SupplyResponse {
12
13
  * and cross-chain communication.
13
14
  *
14
15
  * @param {XToken} spokeToken - The token to supply 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 supply transaction. Must be a valid SpokeProvider instance.
15
17
  *
16
18
  * @returns {UseMutationResult<SupplyResponse, Error, string>} A mutation result object with the following properties:
17
19
  * - mutateAsync: Function to execute the supply transaction
@@ -27,6 +29,6 @@ interface SupplyResponse {
27
29
  * @throws {Error} When:
28
30
  * - spokeProvider is not available
29
31
  */
30
- export declare function useSupply(spokeToken: XToken): UseMutationResult<SupplyResponse, Error, string>;
32
+ export declare function useSupply(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<SupplyResponse, Error, string>;
31
33
  export {};
32
34
  //# sourceMappingURL=useSupply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSupply.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useSupply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK5E,UAAU,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0B9F"}
1
+ {"version":3,"file":"useSupply.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useSupply.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,cAAc;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BlD"}
@@ -0,0 +1,21 @@
1
+ import { type FormatUserSummaryResponse, type FormatReserveUSDResponse, SpokeProvider } from '@sodax/sdk';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ /**
4
+ * Hook for fetching formatted summary of Sodax user portfolio (holdings, total liquidity,
5
+ * collateral, borrows, liquidation threshold, health factor, available borrowing power, etc..).
6
+ *
7
+ * This hook provides access to the current state of user portfolio in the money market protocol.
8
+ * The data is automatically fetched and cached using React Query.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const { data: userFormattedSummary, isLoading, error } = useUserFormattedSummary(spokeProvider, address);
13
+ * ```
14
+ *
15
+ * @returns A React Query result object containing:
16
+ * - data: The formatted summary of Sodax user portfolio when available
17
+ * - isLoading: Loading state indicator
18
+ * - error: Any error that occurred during data fetching
19
+ */
20
+ export declare function useUserFormattedSummary(spokeProvider: SpokeProvider | undefined, address: string | undefined): UseQueryResult<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>;
21
+ //# sourceMappingURL=useUserFormattedSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserFormattedSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserFormattedSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1G,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,cAAc,CAAC,yBAAyB,CAAC,wBAAwB,CAAC,EAAE,KAAK,CAAC,CA6B5E"}
@@ -1,9 +1,20 @@
1
- import type { ChainId } from '@sodax/types';
2
- export declare function useUserReservesData(spokeChainId: ChainId): {
3
- token: import("@sodax/sdk").XToken | undefined;
4
- underlyingAsset: string;
5
- scaledATokenBalance: bigint;
6
- usageAsCollateralEnabledOnUser: boolean;
7
- scaledVariableDebt: bigint;
8
- }[] | undefined;
1
+ import { SpokeProvider, type UserReserveData } from '@sodax/sdk';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ /**
4
+ * Hook for fetching user reserves data from the Sodax money market.
5
+ *
6
+ * This hook provides access to the current state of user reserves in the money market protocol.
7
+ * The data is automatically fetched and cached using React Query.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { data: userReservesData, isLoading, error } = useUserReservesData(spokeProvider, address);
12
+ * ```
13
+ *
14
+ * @returns A React Query result object containing:
15
+ * - data: The user reserves data when available
16
+ * - isLoading: Loading state indicator
17
+ * - error: Any error that occurred during data fetching
18
+ */
19
+ export declare function useUserReservesData(spokeProvider: SpokeProvider | undefined, address: string | undefined, refetchInterval?: number): UseQueryResult<readonly [readonly UserReserveData[], number], Error>;
9
20
  //# sourceMappingURL=useUserReservesData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAM5C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO;;;;;;gBA+CxD"}
1
+ {"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,eAAe,SAAO,GACrB,cAAc,CAAC,SAAS,CAAC,SAAS,eAAe,EAAE,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAetE"}
@@ -1,8 +1,9 @@
1
- import type { ChainId, XToken } from '@sodax/types';
1
+ import type { SpokeProvider } from '@sodax/sdk';
2
+ import type { XToken } from '@sodax/types';
2
3
  import { type UseMutationResult } from '@tanstack/react-query';
3
4
  interface WithdrawResponse {
4
5
  ok: true;
5
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
6
7
  }
7
8
  /**
8
9
  * Hook for withdrawing supplied tokens from the Sodax money market.
@@ -11,9 +12,15 @@ interface WithdrawResponse {
11
12
  * handling the entire withdrawal process including transaction creation, submission,
12
13
  * and cross-chain communication.
13
14
  *
15
+ * @param {XToken} spokeToken - The token to withdraw 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 withdraw transaction. Must be a valid SpokeProvider instance.
17
+ *
18
+ * @returns {UseMutationResult<WithdrawResponse, Error, string>} A mutation result object with the following properties:
19
+ * - mutateAsync: Function to execute the withdraw transaction
20
+ * - isPending: Boolean indicating if a transaction is in progress
14
21
  * @example
15
22
  * ```typescript
16
- * const { mutateAsync: withdraw, isPending, error } = useWithdraw(hubToken, spokeChainId);
23
+ * const { mutateAsync: withdraw, isPending, error } = useWithdraw(spokeToken);
17
24
  * await withdraw('100');
18
25
  * ```
19
26
  *
@@ -21,6 +28,6 @@ interface WithdrawResponse {
21
28
  * - spokeProvider is not available
22
29
  * - Transaction execution fails
23
30
  */
24
- export declare function useWithdraw(hubToken: XToken, spokeChainId: ChainId): UseMutationResult<WithdrawResponse, Error, string>;
31
+ export declare function useWithdraw(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<WithdrawResponse, Error, string>;
25
32
  export {};
26
33
  //# sourceMappingURL=useWithdraw.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWithdraw.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useWithdraw.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK5E,UAAU,gBAAgB;IACxB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,OAAO,GACpB,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC,CA0BpD"}
1
+ {"version":3,"file":"useWithdraw.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useWithdraw.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,gBAAgB;IACxB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC,CA2BpD"}
@@ -1,3 +1,3 @@
1
- import { EvmHubProvider } from '@sodax/sdk';
1
+ import type { EvmHubProvider } from '@sodax/sdk';
2
2
  export declare function useHubProvider(): EvmHubProvider | undefined;
3
3
  //# sourceMappingURL=useHubProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHubProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useHubProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsC,MAAM,YAAY,CAAC;AAKhF,wBAAgB,cAAc,IAAI,cAAc,GAAG,SAAS,CAoB3D"}
1
+ {"version":3,"file":"useHubProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useHubProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,wBAAgB,cAAc,IAAI,cAAc,GAAG,SAAS,CAI3D"}