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

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
@@ -1,4 +1,18 @@
1
- import { EvmSpokeProvider, SuiSpokeProvider } from '@sodax/sdk';
1
+ import { type SpokeProvider, type IWalletProvider } from '@sodax/sdk';
2
2
  import type { SpokeChainId } from '@sodax/types';
3
- export declare function useSpokeProvider(spokeChainId: SpokeChainId): EvmSpokeProvider | SuiSpokeProvider | undefined;
3
+ /**
4
+ * Hook to get the appropriate spoke provider based on the chain type.
5
+ * Supports EVM, SUI, ICON and INJECTIVE chains.
6
+ *
7
+ * @param {SpokeChainId | undefined} spokeChainId - The spoke chain ID to get the provider for
8
+ * @param {IWalletProvider | undefined} walletProvider - The wallet provider to use
9
+ * @returns {SpokeProvider | undefined} The appropriate spoke provider instance for the given chain ID, or undefined if invalid/unsupported
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * // Using a specific SpokeChainId and wallet provider
14
+ * const spokeProvider = useSpokeProvider(spokeChainId, walletProvider);
15
+ * ```
16
+ */
17
+ export declare function useSpokeProvider(spokeChainId: SpokeChainId | undefined, walletProvider?: IWalletProvider | undefined): SpokeProvider | undefined;
4
18
  //# sourceMappingURL=useSpokeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAA0C,YAAY,EAAE,MAAM,cAAc,CAAC;AAIzF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,YAAY,mDAqB1D"}
1
+ {"version":3,"file":"useSpokeProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/useSpokeProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAYL,KAAK,aAAa,EAClB,KAAK,eAAe,EAMrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAIV,YAAY,EAIb,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,cAAc,CAAC,EAAE,eAAe,GAAG,SAAS,GAC3C,aAAa,GAAG,SAAS,CAoE3B"}
@@ -1,4 +1,3 @@
1
1
  export * from './useSodaxContext';
2
- export * from './useAllowance';
3
- export * from './useApprove';
2
+ export * from './useEstimateGas';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type GetEstimateGasReturnType, type SpokeProvider, type TxReturnType } from '@sodax/sdk';
2
+ import { type UseMutationResult } from '@tanstack/react-query';
3
+ export declare function useEstimateGas<T extends SpokeProvider = SpokeProvider>(spokeProvider: T | undefined): UseMutationResult<GetEstimateGasReturnType<T>, Error, TxReturnType<T, true>>;
4
+ //# sourceMappingURL=useEstimateGas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEstimateGas.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/useEstimateGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAAgB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EACpE,aAAa,EAAE,CAAC,GAAG,SAAS,GAC3B,iBAAiB,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAY9E"}
@@ -1,4 +1,7 @@
1
1
  export * from './useQuote';
2
- export * from './useCreateIntentOrder';
2
+ export * from './useSwap';
3
3
  export * from './useStatus';
4
+ export * from './useSwapAllowance';
5
+ export * from './useSwapApprove';
6
+ export * from './useCancelSwap';
4
7
  //# 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,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Intent, Result, SpokeProvider, TxReturnType } from '@sodax/sdk';
2
+ import { type UseMutationResult } from '@tanstack/react-query';
3
+ type CancelIntentParams = {
4
+ intent: Intent;
5
+ raw?: boolean;
6
+ };
7
+ type CancelIntentResult = Result<TxReturnType<SpokeProvider, boolean>>;
8
+ /**
9
+ * Hook for canceling a swap intent order.
10
+ * Uses React Query's useMutation for better state management and caching.
11
+ *
12
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for canceling the intent
13
+ * @returns {UseMutationResult} Mutation result object containing mutation function and state
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const { mutateAsync: cancelSwap, isPending } = useCancelSwap(spokeProvider);
18
+ *
19
+ * const handleCancelSwap = async () => {
20
+ * const result = await cancelSwap({
21
+ * intent: intentObject,
22
+ * raw: false // optional, defaults to false
23
+ * });
24
+ * };
25
+ * ```
26
+ */
27
+ export declare function useCancelSwap(spokeProvider: SpokeProvider | undefined): UseMutationResult<CancelIntentResult, Error, CancelIntentParams>;
28
+ export {};
29
+ //# sourceMappingURL=useCancelSwap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCancelSwap.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useCancelSwap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAC3B,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,29 @@
1
+ import type { CreateIntentParams, SolverExecutionResponse, Result, IntentErrorCode, Intent, IntentError, SpokeProvider, IntentDeliveryInfo } from '@sodax/sdk';
2
+ import { type UseMutationResult } from '@tanstack/react-query';
3
+ type CreateIntentResult = Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>;
4
+ /**
5
+ * Hook for creating and submitting an swap intent order for cross-chain swaps.
6
+ * Uses React Query's useMutation for better state management and caching.
7
+ *
8
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the swap
9
+ * @returns {UseMutationResult} Mutation result object containing mutation function and state
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const { mutateAsync: swap, isPending } = useSwap(spokeProvider);
14
+ *
15
+ * const handleSwap = async () => {
16
+ * const result = await swap({
17
+ * token_src: '0x...',
18
+ * token_src_blockchain_id: 'arbitrum',
19
+ * token_dst: '0x...',
20
+ * token_dst_blockchain_id: 'polygon',
21
+ * amount: '1000000000000000000',
22
+ * min_output_amount: '900000000000000000'
23
+ * });
24
+ * };
25
+ * ```
26
+ */
27
+ export declare function useSwap(spokeProvider: SpokeProvider | undefined): UseMutationResult<CreateIntentResult, Error, CreateIntentParams>;
28
+ export {};
29
+ //# sourceMappingURL=useSwap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwap.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useSwap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EACN,eAAe,EACf,MAAM,EACN,WAAW,EACX,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,KAAK,kBAAkB,GAAG,MAAM,CAAC,CAAC,uBAAuB,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;AAEtH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CACrB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,iBAAiB,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAclE"}
@@ -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,CAoBhC"}
@@ -0,0 +1,25 @@
1
+ import type { CreateIntentParams, SpokeProvider } from '@sodax/sdk';
2
+ interface UseApproveReturn {
3
+ approve: ({ params }: {
4
+ params: CreateIntentParams;
5
+ }) => Promise<boolean>;
6
+ isLoading: boolean;
7
+ error: Error | null;
8
+ resetError: () => void;
9
+ }
10
+ /**
11
+ * Hook for approving token spending for money market actions
12
+ * @param token The token to approve spending for
13
+ * @param spokeProvider The spoke provider instance for the chain
14
+ * @returns Object containing approve function, loading state, error state and reset function
15
+ * @example
16
+ * ```tsx
17
+ * const { approve, isLoading, error } = useApprove(token, spokeProvider);
18
+ *
19
+ * // Approve tokens for supply action
20
+ * await approve({ amount: "100", action: "supply" });
21
+ * ```
22
+ */
23
+ export declare function useSwapApprove(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn;
24
+ export {};
25
+ //# sourceMappingURL=useSwapApprove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwapApprove.d.ts","sourceRoot":"","sources":["../../../src/hooks/swap/useSwapApprove.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,kBAAkB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,gBAAgB,CAuClB"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './hooks';
2
2
  export * from './providers';
3
3
  export * from './core';
4
+ export * from './types';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}