@sodax/dapp-kit 0.0.1-rc.7 → 0.0.1-rc.9

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 (61) hide show
  1. package/README.md +11 -12
  2. package/dist/core/index.d.ts +1 -2
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/hooks/mm/index.d.ts +2 -3
  5. package/dist/hooks/mm/index.d.ts.map +1 -1
  6. package/dist/hooks/mm/useBorrow.d.ts +1 -1
  7. package/dist/hooks/mm/useBorrow.d.ts.map +1 -1
  8. package/dist/hooks/mm/useMMAllowance.d.ts +26 -0
  9. package/dist/hooks/mm/useMMAllowance.d.ts.map +1 -0
  10. package/dist/hooks/mm/useMMApprove.d.ts +27 -0
  11. package/dist/hooks/mm/useMMApprove.d.ts.map +1 -0
  12. package/dist/hooks/mm/useRepay.d.ts +1 -1
  13. package/dist/hooks/mm/useRepay.d.ts.map +1 -1
  14. package/dist/hooks/mm/useSupply.d.ts +1 -1
  15. package/dist/hooks/mm/useSupply.d.ts.map +1 -1
  16. package/dist/hooks/mm/useUserReservesData.d.ts +1 -7
  17. package/dist/hooks/mm/useUserReservesData.d.ts.map +1 -1
  18. package/dist/hooks/mm/useWithdraw.d.ts +1 -1
  19. package/dist/hooks/mm/useWithdraw.d.ts.map +1 -1
  20. package/dist/hooks/provider/useSpokeProvider.d.ts.map +1 -1
  21. package/dist/hooks/swap/index.d.ts +2 -0
  22. package/dist/hooks/swap/index.d.ts.map +1 -1
  23. package/dist/hooks/swap/useCreateIntentOrder.d.ts +3 -3
  24. package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +1 -1
  25. package/dist/hooks/swap/useQuote.d.ts +4 -4
  26. package/dist/hooks/swap/useQuote.d.ts.map +1 -1
  27. package/dist/hooks/swap/useStatus.d.ts +3 -3
  28. package/dist/hooks/swap/useStatus.d.ts.map +1 -1
  29. package/dist/hooks/swap/useSwapAllowance.d.ts +23 -0
  30. package/dist/hooks/swap/useSwapAllowance.d.ts.map +1 -0
  31. package/dist/hooks/swap/useSwapApprove.d.ts +26 -0
  32. package/dist/hooks/swap/useSwapApprove.d.ts.map +1 -0
  33. package/dist/index.js +86 -67
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +84 -65
  36. package/dist/index.mjs.map +1 -1
  37. package/package.json +4 -4
  38. package/src/core/index.ts +4 -27
  39. package/src/hooks/mm/index.ts +2 -3
  40. package/src/hooks/mm/useBorrow.ts +2 -2
  41. package/src/hooks/mm/useMMAllowance.ts +55 -0
  42. package/src/hooks/mm/{useApprove.ts → useMMApprove.ts} +17 -5
  43. package/src/hooks/mm/useRepay.ts +2 -2
  44. package/src/hooks/mm/useSupply.ts +2 -2
  45. package/src/hooks/mm/useUserReservesData.ts +1 -7
  46. package/src/hooks/mm/useWithdraw.ts +2 -2
  47. package/src/hooks/provider/useSpokeProvider.ts +21 -0
  48. package/src/hooks/swap/index.ts +2 -0
  49. package/src/hooks/swap/useCreateIntentOrder.ts +5 -5
  50. package/src/hooks/swap/useQuote.ts +5 -5
  51. package/src/hooks/swap/useStatus.ts +3 -3
  52. package/src/hooks/swap/useSwapAllowance.ts +44 -0
  53. package/src/hooks/swap/useSwapApprove.ts +68 -0
  54. package/dist/hooks/mm/useAllowance.d.ts +0 -4
  55. package/dist/hooks/mm/useAllowance.d.ts.map +0 -1
  56. package/dist/hooks/mm/useApprove.d.ts +0 -14
  57. package/dist/hooks/mm/useApprove.d.ts.map +0 -1
  58. package/dist/hooks/mm/useHubWalletAddress.d.ts +0 -24
  59. package/dist/hooks/mm/useHubWalletAddress.d.ts.map +0 -1
  60. package/src/hooks/mm/useAllowance.ts +0 -33
  61. package/src/hooks/mm/useHubWalletAddress.ts +0 -49
package/README.md CHANGED
@@ -11,24 +11,22 @@ dApp Kit is a collection of React components, hooks, and utilities designed to s
11
11
  - Borrow tokens from the money market (`useBorrow`)
12
12
  - Repay borrowed tokens (`useRepay`)
13
13
  - Get user reserves data (`useUserReservesData`)
14
- - Calculate hub wallet address by using spoke chain id and spoke chain wallet address (`useHubWalletAddress`)
15
14
  - Get reserves data (`useReservesData`)
15
+ - Check token allowance (`useMMAllowance`)
16
+ - Approve token spending (`useMMApprove`)
16
17
 
17
18
  - Swap/Intent
18
19
  - Get quote for an intent order (`useQuote`)
19
20
  - Create and submit an intent order (`useCreateIntentOrder`)
20
21
  - Get status of an intent order (`useStatus`)
22
+ - Check token allowance (`useSwapAllowance`)
23
+ - Approve token spending (`useSwapApprove`)
21
24
 
22
25
  - Provider
23
26
  - Get hub chain provider (`useHubProvider`)
24
27
  - Get spoke chain provider (`useSpokeProvider`)
25
28
  - Get wallet provider (`useWalletProvider`)
26
29
 
27
- - Token Management
28
- - Check token allowance (`useAllowance`)
29
- - Approve token spending (`useApprove`)
30
-
31
-
32
30
  ## Installation
33
31
 
34
32
  ```bash
@@ -66,7 +64,7 @@ const sodaxConfig = {
66
64
  moneyMarket: getMoneyMarketConfig(SONIC_MAINNET_CHAIN_ID),
67
65
  solver: {
68
66
  intentsContract: '0x6382D6ccD780758C5e8A6123c33ee8F4472F96ef',
69
- solverApiEndpoint: 'https://staging-new-world.iconblockchain.xyz',
67
+ solverApiEndpoint: 'https://sodax-solver-staging.iconblockchain.xyz',
70
68
  partnerFee: {
71
69
  address: '0x0Ab764AB3816cD036Ea951bE973098510D8105A6',
72
70
  percentage: 100, // 1%
@@ -147,11 +145,11 @@ function MoneyMarketComponent() {
147
145
  }
148
146
 
149
147
  // Token Management
150
- import { useAllowance, useApprove } from '@sodax/dapp-kit';
148
+ import { useMMAllowance, useApprove } from '@sodax/dapp-kit';
151
149
 
152
150
  function TokenManagementComponent() {
153
151
  // Check token allowance
154
- const { data: hasAllowed } = useAllowance(token, amount);
152
+ const { data: hasAllowed } = useMMAllowance(token, amount);
155
153
 
156
154
  // Approve token spending
157
155
  const { approve, isLoading: isApproving } = useApprove(token);
@@ -212,18 +210,19 @@ function SwapComponent() {
212
210
  - [`useSupply()`](./src/hooks/mm/useSupply.ts) - Supply tokens to the money market
213
211
  - [`useWithdraw()`](./src/hooks/mm/useWithdraw.ts) - Withdraw supplied tokens
214
212
  - [`useUserReservesData()`](./src/hooks/mm/useUserReservesData.ts) - Get user's reserves data(supplied asset and debt)
215
- - [`useHubWalletAddress()`](./src/hooks/mm/useHubWalletAddress.ts) - Get hub wallet address for a spoke chain
216
213
  - [`useReservesData()`](./src/hooks/mm/useReservesData.ts) - Get reserves data
214
+ - [`useMMAllowance()`](./src/hooks/mm/useMMAllowance.ts) - Check token allowance for a specific amount
215
+ - [`useMMApprove()`](./src/hooks/mm/useMMApprove.ts) - Approve token spending
217
216
 
218
217
  #### Swap Hooks
219
218
  - [`useQuote()`](./src/hooks/swap/useQuote.ts) - Get quote for an intent order
220
219
  - [`useCreateIntentOrder()`](./src/hooks/swap/useCreateIntentOrder.ts) - Create and submit an intent order
221
220
  - [`useStatus()`](./src/hooks/swap/useStatus.ts) - Get status of an intent order
221
+ - [`useSwapAllowance()`](./src/hooks/swap/useSwapAllowance.ts) - Check token allowance for an intent order
222
+ - [`useSwapApprove()`](./src/hooks/swap/useSwapApprove.ts) - Approve token spending
222
223
 
223
224
  #### Shared Hooks
224
225
  - [`useSodaxContext()`](./src/hooks/shared/useSodaxContext.ts) - Access Sodax context and configuration
225
- - [`useAllowance()`](./src/hooks/shared/useAllowance.ts) - Check token allowance for a specific amount
226
- - [`useApprove()`](./src/hooks/shared/useApprove.ts) - Approve token spending
227
226
 
228
227
 
229
228
  ## Contributing
@@ -1,4 +1,3 @@
1
- import type { XToken, ChainId } from '@sodax/types';
2
- export declare const allXTokens: XToken[];
1
+ import type { ChainId } from '@sodax/types';
3
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,uBAK/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,8 +3,7 @@ export * from './useRepay';
3
3
  export * from './useSupply';
4
4
  export * from './useWithdraw';
5
5
  export * from './useUserReservesData';
6
- export * from './useHubWalletAddress';
7
6
  export * from './useReservesData';
8
- export * from './useAllowance';
9
- export * from './useApprove';
7
+ export * from './useMMAllowance';
8
+ export * from './useMMApprove';
10
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;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,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"}
@@ -3,7 +3,7 @@ import { type UseMutationResult } from '@tanstack/react-query';
3
3
  import type { SpokeProvider } from '@sodax/sdk';
4
4
  interface BorrowResponse {
5
5
  ok: true;
6
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
7
7
  }
8
8
  /**
9
9
  * Hook for borrowing tokens from the Sodax money market.
@@ -1 +1 @@
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,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;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
+ {"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"}
@@ -3,7 +3,7 @@ import type { XToken } from '@sodax/types';
3
3
  import { type UseMutationResult } from '@tanstack/react-query';
4
4
  interface RepayResponse {
5
5
  ok: true;
6
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
7
7
  }
8
8
  /**
9
9
  * Hook for repaying borrowed tokens to the Sodax money market.
@@ -1 +1 @@
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,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;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
+ {"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"}
@@ -3,7 +3,7 @@ import type { XToken } from '@sodax/types';
3
3
  import { type UseMutationResult } from '@tanstack/react-query';
4
4
  interface SupplyResponse {
5
5
  ok: true;
6
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
7
7
  }
8
8
  /**
9
9
  * Hook for supplying tokens to the Sodax money market.
@@ -1 +1 @@
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,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;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"}
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"}
@@ -1,9 +1,3 @@
1
1
  import type { ChainId } from '@sodax/types';
2
- export declare function useUserReservesData(spokeChainId: ChainId, address: string | undefined): {
3
- token: import("@sodax/sdk").XToken | undefined;
4
- underlyingAsset: string;
5
- scaledATokenBalance: bigint;
6
- usageAsCollateralEnabledOnUser: boolean;
7
- scaledVariableDebt: bigint;
8
- }[] | undefined;
2
+ export declare function useUserReservesData(spokeChainId: ChainId, address: string | undefined): readonly import("@sodax/sdk").UserReserveData[] | undefined;
9
3
  //# sourceMappingURL=useUserReservesData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;;;;;;gBAsCrF"}
1
+ {"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,+DAiCrF"}
@@ -3,7 +3,7 @@ import type { XToken } from '@sodax/types';
3
3
  import { type UseMutationResult } from '@tanstack/react-query';
4
4
  interface WithdrawResponse {
5
5
  ok: true;
6
- value: [`0x${string}`, `0x${string}`];
6
+ value: [string, string];
7
7
  }
8
8
  /**
9
9
  * Hook for withdrawing supplied tokens from the Sodax money market.
@@ -1 +1 @@
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,KAAK,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CACvC;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
+ {"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 +1 @@
1
- {"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAIV,YAAY,EAEb,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,cAAc,CAAC,EAAE,eAAe,GAAG,SAAS,GAC3C,aAAa,GAAG,SAAS,CAsC3B"}
1
+ {"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,aAAa,EAClB,KAAK,eAAe,EAGrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAIV,YAAY,EAIb,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,cAAc,CAAC,EAAE,eAAe,GAAG,SAAS,GAC3C,aAAa,GAAG,SAAS,CAqD3B"}
@@ -1,4 +1,6 @@
1
1
  export * from './useQuote';
2
2
  export * from './useCreateIntentOrder';
3
3
  export * from './useStatus';
4
+ export * from './useSwapAllowance';
5
+ export * from './useSwapApprove';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
@@ -1,10 +1,10 @@
1
- import type { CreateIntentParams, IntentExecutionResponse, Result, IntentSubmitErrorCode, Intent, PacketData, IntentSubmitError, SpokeProvider } from '@sodax/sdk';
1
+ import type { CreateIntentParams, SolverExecutionResponse, Result, IntentErrorCode, Intent, PacketData, IntentError, SpokeProvider } from '@sodax/sdk';
2
2
  import { type UseMutationResult } from '@tanstack/react-query';
3
3
  type CreateIntentResult = Result<[
4
- IntentExecutionResponse,
4
+ SolverExecutionResponse,
5
5
  Intent,
6
6
  PacketData
7
- ], IntentSubmitError<IntentSubmitErrorCode>>;
7
+ ], IntentError<IntentErrorCode>>;
8
8
  /**
9
9
  * Hook for creating and submitting an intent order for cross-chain swaps.
10
10
  * Uses React Query's useMutation for better state management and caching.
@@ -1 +1 @@
1
- {"version":3,"file":"useCreateIntentOrder.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useCreateIntentOrder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EACN,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,KAAK,kBAAkB,GAAG,MAAM,CAC9B;IAAC,uBAAuB;IAAE,MAAM;IAAE,UAAU;CAAC,EAC7C,iBAAiB,CAAC,qBAAqB,CAAC,CACzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAWlE"}
1
+ {"version":3,"file":"useCreateIntentOrder.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useCreateIntentOrder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EACN,eAAe,EACf,MAAM,EACN,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,KAAK,kBAAkB,GAAG,MAAM,CAC9B;IAAC,uBAAuB;IAAE,MAAM;IAAE,UAAU;CAAC,EAC7C,WAAW,CAAC,eAAe,CAAC,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAWlE"}
@@ -1,13 +1,13 @@
1
- import type { IntentErrorResponse, IntentQuoteRequest, IntentQuoteResponse, Result } from '@sodax/sdk';
1
+ import type { SolverErrorResponse, SolverIntentQuoteRequest, SolverIntentQuoteResponse, Result } from '@sodax/sdk';
2
2
  import { type UseQueryResult } from '@tanstack/react-query';
3
3
  /**
4
4
  * Hook for fetching a quote for an intent-based swap.
5
5
  *
6
6
  * This hook provides real-time quote data for an intent-based swap.
7
7
  *
8
- * @param {IntentQuoteRequest | undefined} payload - The intent quote request parameters. If undefined, the query will be disabled.
8
+ * @param {SolverIntentQuoteRequest | undefined} payload - The intent quote request parameters. If undefined, the query will be disabled.
9
9
  *
10
- * @returns {UseQueryResult<Result<IntentQuoteResponse, IntentErrorResponse> | undefined>} A query result object containing:
10
+ * @returns {UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>} A query result object containing:
11
11
  * - data: The quote result from the solver
12
12
  * - isLoading: Boolean indicating if the quote is being fetched
13
13
  * - error: Error object if the quote request failed
@@ -35,5 +35,5 @@ import { type UseQueryResult } from '@tanstack/react-query';
35
35
  * - The query is disabled when payload is undefined
36
36
  * - Uses React Query for efficient caching and state management
37
37
  */
38
- export declare const useQuote: (payload: IntentQuoteRequest | undefined) => UseQueryResult<Result<IntentQuoteResponse, IntentErrorResponse> | undefined>;
38
+ export declare const useQuote: (payload: SolverIntentQuoteRequest | undefined) => UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>;
39
39
  //# sourceMappingURL=useQuote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useQuote.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useQuote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEvG,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,QAAQ,YACV,kBAAkB,GAAG,SAAS,KACtC,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,GAAG,SAAS,CAa7E,CAAC"}
1
+ {"version":3,"file":"useQuote.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useQuote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEnH,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,QAAQ,YACV,wBAAwB,GAAG,SAAS,KAC5C,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,GAAG,SAAS,CAanF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Hex, IntentErrorResponse, IntentStatusResponse, Result } from '@sodax/sdk';
1
+ import type { Hex, SolverErrorResponse, SolverIntentStatusResponse, Result } from '@sodax/sdk';
2
2
  import { type UseQueryResult } from '@tanstack/react-query';
3
3
  /**
4
4
  * Hook for monitoring the status of an intent-based swap.
@@ -7,7 +7,7 @@ import { type UseQueryResult } from '@tanstack/react-query';
7
7
  *
8
8
  * @param {Hex} intent_tx_hash - The transaction hash of the intent order on the hub chain
9
9
  *
10
- * @returns {UseQueryResult<Result<IntentStatusResponse, IntentErrorResponse> | undefined>} A query result object containing:
10
+ * @returns {UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>} A query result object containing:
11
11
  * - data: The status result from the solver
12
12
  * - isLoading: Boolean indicating if the status is being fetched
13
13
  * - error: Error object if the status request failed
@@ -27,5 +27,5 @@ import { type UseQueryResult } from '@tanstack/react-query';
27
27
  * - The status is automatically refreshed every 3 seconds
28
28
  * - Uses React Query for efficient caching and state management
29
29
  */
30
- export declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<IntentStatusResponse, IntentErrorResponse> | undefined>;
30
+ export declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
31
31
  //# sourceMappingURL=useStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,SAAS,mBACJ,GAAG,KAClB,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,GAAG,SAAS,CAS9E,CAAC"}
1
+ {"version":3,"file":"useStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,SAAS,mBACJ,GAAG,KAClB,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,GAAG,SAAS,CASpF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import type { CreateIntentParams, SpokeProvider } from '@sodax/sdk';
3
+ /**
4
+ * Hook for checking token allowance for money market operations.
5
+ *
6
+ * This hook verifies if the user has approved enough tokens for a specific money market action
7
+ * (borrow/repay). It automatically queries and tracks the allowance status.
8
+ *
9
+ * @param {CreateIntentParams} params - The parameters for the intent 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 } = useMMAllowance(params, spokeProvider);
20
+ * ```
21
+ */
22
+ export declare function useSwapAllowance(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
23
+ //# sourceMappingURL=useSwapAllowance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwapAllowance.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useSwapAllowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAiBhC"}
@@ -0,0 +1,26 @@
1
+ import type { Token } from '@sodax/types';
2
+ import type { SpokeProvider } from '@sodax/sdk';
3
+ interface UseApproveReturn {
4
+ approve: ({ amount }: {
5
+ amount: string;
6
+ }) => Promise<boolean>;
7
+ isLoading: boolean;
8
+ error: Error | null;
9
+ resetError: () => void;
10
+ }
11
+ /**
12
+ * Hook for approving token spending for money market actions
13
+ * @param token The token to approve spending for
14
+ * @param spokeProvider The spoke provider instance for the chain
15
+ * @returns Object containing approve function, loading state, error state and reset function
16
+ * @example
17
+ * ```tsx
18
+ * const { approve, isLoading, error } = useApprove(token, spokeProvider);
19
+ *
20
+ * // Approve tokens for supply action
21
+ * await approve({ amount: "100", action: "supply" });
22
+ * ```
23
+ */
24
+ export declare function useSwapApprove(token: Token | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn;
25
+ export {};
26
+ //# sourceMappingURL=useSwapApprove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwapApprove.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useSwapApprove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,gBAAgB,CAwCnH"}