@sodax/dapp-kit 0.0.1-rc.29 → 0.0.1-rc.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +37 -37
  2. package/dist/index.d.mts +1425 -0
  3. package/dist/index.d.ts +1425 -5
  4. package/dist/index.js +364 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +347 -1
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +3 -3
  9. package/src/contexts/index.ts +1 -1
  10. package/src/hooks/bridge/useGetBridgeableAmount.ts +1 -1
  11. package/src/hooks/index.ts +1 -0
  12. package/src/hooks/shared/useDeriveUserWalletAddress.ts +1 -1
  13. package/src/hooks/staking/index.ts +19 -0
  14. package/src/hooks/staking/useCancelUnstake.ts +52 -0
  15. package/src/hooks/staking/useClaim.ts +46 -0
  16. package/src/hooks/staking/useConvertedAssets.ts +47 -0
  17. package/src/hooks/staking/useInstantUnstake.ts +50 -0
  18. package/src/hooks/staking/useInstantUnstakeAllowance.ts +59 -0
  19. package/src/hooks/staking/useInstantUnstakeApprove.ts +52 -0
  20. package/src/hooks/staking/useInstantUnstakeRatio.ts +54 -0
  21. package/src/hooks/staking/useStake.ts +47 -0
  22. package/src/hooks/staking/useStakeAllowance.ts +57 -0
  23. package/src/hooks/staking/useStakeApprove.ts +50 -0
  24. package/src/hooks/staking/useStakeRatio.ts +53 -0
  25. package/src/hooks/staking/useStakingConfig.ts +40 -0
  26. package/src/hooks/staking/useStakingInfo.ts +50 -0
  27. package/src/hooks/staking/useUnstake.ts +54 -0
  28. package/src/hooks/staking/useUnstakeAllowance.ts +58 -0
  29. package/src/hooks/staking/useUnstakeApprove.ts +52 -0
  30. package/src/hooks/staking/useUnstakingInfo.ts +53 -0
  31. package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +59 -0
  32. package/src/index.ts +0 -1
  33. package/src/providers/SodaxProvider.tsx +1 -1
  34. package/dist/contexts/index.d.ts +0 -9
  35. package/dist/contexts/index.d.ts.map +0 -1
  36. package/dist/core/index.d.ts +0 -3
  37. package/dist/core/index.d.ts.map +0 -1
  38. package/dist/hooks/backend/index.d.ts +0 -17
  39. package/dist/hooks/backend/index.d.ts.map +0 -1
  40. package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts +0 -37
  41. package/dist/hooks/backend/useBackendAllMoneyMarketAssets.d.ts.map +0 -1
  42. package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts +0 -45
  43. package/dist/hooks/backend/useBackendAllMoneyMarketBorrowers.d.ts.map +0 -1
  44. package/dist/hooks/backend/useBackendIntentByHash.d.ts +0 -36
  45. package/dist/hooks/backend/useBackendIntentByHash.d.ts.map +0 -1
  46. package/dist/hooks/backend/useBackendIntentByTxHash.d.ts +0 -35
  47. package/dist/hooks/backend/useBackendIntentByTxHash.d.ts.map +0 -1
  48. package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts +0 -38
  49. package/dist/hooks/backend/useBackendMoneyMarketAsset.d.ts.map +0 -1
  50. package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts +0 -47
  51. package/dist/hooks/backend/useBackendMoneyMarketAssetBorrowers.d.ts.map +0 -1
  52. package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts +0 -47
  53. package/dist/hooks/backend/useBackendMoneyMarketAssetSuppliers.d.ts.map +0 -1
  54. package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts +0 -37
  55. package/dist/hooks/backend/useBackendMoneyMarketPosition.d.ts.map +0 -1
  56. package/dist/hooks/backend/useBackendOrderbook.d.ts +0 -46
  57. package/dist/hooks/backend/useBackendOrderbook.d.ts.map +0 -1
  58. package/dist/hooks/bridge/index.d.ts +0 -6
  59. package/dist/hooks/bridge/index.d.ts.map +0 -1
  60. package/dist/hooks/bridge/useBridge.d.ts +0 -33
  61. package/dist/hooks/bridge/useBridge.d.ts.map +0 -1
  62. package/dist/hooks/bridge/useBridgeAllowance.d.ts +0 -23
  63. package/dist/hooks/bridge/useBridgeAllowance.d.ts.map +0 -1
  64. package/dist/hooks/bridge/useBridgeApprove.d.ts +0 -29
  65. package/dist/hooks/bridge/useBridgeApprove.d.ts.map +0 -1
  66. package/dist/hooks/bridge/useGetBridgeableAmount.d.ts +0 -26
  67. package/dist/hooks/bridge/useGetBridgeableAmount.d.ts.map +0 -1
  68. package/dist/hooks/bridge/useGetBridgeableTokens.d.ts +0 -37
  69. package/dist/hooks/bridge/useGetBridgeableTokens.d.ts.map +0 -1
  70. package/dist/hooks/index.d.ts +0 -7
  71. package/dist/hooks/index.d.ts.map +0 -1
  72. package/dist/hooks/mm/index.d.ts +0 -9
  73. package/dist/hooks/mm/index.d.ts.map +0 -1
  74. package/dist/hooks/mm/useBorrow.d.ts +0 -35
  75. package/dist/hooks/mm/useBorrow.d.ts.map +0 -1
  76. package/dist/hooks/mm/useMMAllowance.d.ts +0 -26
  77. package/dist/hooks/mm/useMMAllowance.d.ts.map +0 -1
  78. package/dist/hooks/mm/useMMApprove.d.ts +0 -27
  79. package/dist/hooks/mm/useMMApprove.d.ts.map +0 -1
  80. package/dist/hooks/mm/useRepay.d.ts +0 -35
  81. package/dist/hooks/mm/useRepay.d.ts.map +0 -1
  82. package/dist/hooks/mm/useReservesData.d.ts +0 -19
  83. package/dist/hooks/mm/useReservesData.d.ts.map +0 -1
  84. package/dist/hooks/mm/useReservesHumanized.d.ts +0 -21
  85. package/dist/hooks/mm/useReservesHumanized.d.ts.map +0 -1
  86. package/dist/hooks/mm/useReservesList.d.ts +0 -18
  87. package/dist/hooks/mm/useReservesList.d.ts.map +0 -1
  88. package/dist/hooks/mm/useReservesUsdFormat.d.ts +0 -23
  89. package/dist/hooks/mm/useReservesUsdFormat.d.ts.map +0 -1
  90. package/dist/hooks/mm/useSupply.d.ts +0 -34
  91. package/dist/hooks/mm/useSupply.d.ts.map +0 -1
  92. package/dist/hooks/mm/useUserFormattedSummary.d.ts +0 -21
  93. package/dist/hooks/mm/useUserFormattedSummary.d.ts.map +0 -1
  94. package/dist/hooks/mm/useUserReservesData.d.ts +0 -20
  95. package/dist/hooks/mm/useUserReservesData.d.ts.map +0 -1
  96. package/dist/hooks/mm/useWithdraw.d.ts +0 -33
  97. package/dist/hooks/mm/useWithdraw.d.ts.map +0 -1
  98. package/dist/hooks/provider/index.d.ts +0 -3
  99. package/dist/hooks/provider/index.d.ts.map +0 -1
  100. package/dist/hooks/provider/useHubProvider.d.ts +0 -3
  101. package/dist/hooks/provider/useHubProvider.d.ts.map +0 -1
  102. package/dist/hooks/provider/useSpokeProvider.d.ts +0 -18
  103. package/dist/hooks/provider/useSpokeProvider.d.ts.map +0 -1
  104. package/dist/hooks/shared/index.d.ts +0 -6
  105. package/dist/hooks/shared/index.d.ts.map +0 -1
  106. package/dist/hooks/shared/useDeriveUserWalletAddress.d.ts +0 -24
  107. package/dist/hooks/shared/useDeriveUserWalletAddress.d.ts.map +0 -1
  108. package/dist/hooks/shared/useEstimateGas.d.ts +0 -4
  109. package/dist/hooks/shared/useEstimateGas.d.ts.map +0 -1
  110. package/dist/hooks/shared/useRequestTrustline.d.ts +0 -44
  111. package/dist/hooks/shared/useRequestTrustline.d.ts.map +0 -1
  112. package/dist/hooks/shared/useSodaxContext.d.ts +0 -8
  113. package/dist/hooks/shared/useSodaxContext.d.ts.map +0 -1
  114. package/dist/hooks/shared/useStellarTrustlineCheck.d.ts +0 -40
  115. package/dist/hooks/shared/useStellarTrustlineCheck.d.ts.map +0 -1
  116. package/dist/hooks/swap/index.d.ts +0 -7
  117. package/dist/hooks/swap/index.d.ts.map +0 -1
  118. package/dist/hooks/swap/useCancelSwap.d.ts +0 -29
  119. package/dist/hooks/swap/useCancelSwap.d.ts.map +0 -1
  120. package/dist/hooks/swap/useQuote.d.ts +0 -39
  121. package/dist/hooks/swap/useQuote.d.ts.map +0 -1
  122. package/dist/hooks/swap/useStatus.d.ts +0 -31
  123. package/dist/hooks/swap/useStatus.d.ts.map +0 -1
  124. package/dist/hooks/swap/useSwap.d.ts +0 -29
  125. package/dist/hooks/swap/useSwap.d.ts.map +0 -1
  126. package/dist/hooks/swap/useSwapAllowance.d.ts +0 -23
  127. package/dist/hooks/swap/useSwapAllowance.d.ts.map +0 -1
  128. package/dist/hooks/swap/useSwapApprove.d.ts +0 -25
  129. package/dist/hooks/swap/useSwapApprove.d.ts.map +0 -1
  130. package/dist/index.d.ts.map +0 -1
  131. package/dist/providers/SodaxProvider.d.ts +0 -12
  132. package/dist/providers/SodaxProvider.d.ts.map +0 -1
  133. package/dist/providers/index.d.ts +0 -2
  134. package/dist/providers/index.d.ts.map +0 -1
  135. package/dist/types.d.ts +0 -17
  136. package/dist/types.d.ts.map +0 -1
  137. package/src/types.ts +0 -22
@@ -1,23 +0,0 @@
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
@@ -1 +0,0 @@
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,34 +0,0 @@
1
- import type { SpokeProvider } from '@sodax/sdk';
2
- import type { XToken } from '@sodax/types';
3
- import { type UseMutationResult } from '@tanstack/react-query';
4
- interface SupplyResponse {
5
- ok: true;
6
- value: [string, string];
7
- }
8
- /**
9
- * Hook for supplying tokens to the Sodax money market.
10
- *
11
- * This hook provides functionality to supply tokens to the money market protocol,
12
- * handling the entire supply process including transaction creation, submission,
13
- * and cross-chain communication.
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.
17
- *
18
- * @returns {UseMutationResult<SupplyResponse, Error, string>} A mutation result object with the following properties:
19
- * - mutateAsync: Function to execute the supply transaction
20
- * - isPending: Boolean indicating if a transaction is in progress
21
- * - error: Error object if the last transaction failed, null otherwise
22
- *
23
- * @example
24
- * ```typescript
25
- * const { mutateAsync: supply, isPending, error } = useSupply(spokeToken);
26
- * await supply('100');
27
- * ```
28
- *
29
- * @throws {Error} When:
30
- * - spokeProvider is not available
31
- */
32
- export declare function useSupply(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<SupplyResponse, Error, string>;
33
- export {};
34
- //# sourceMappingURL=useSupply.d.ts.map
@@ -1 +0,0 @@
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,21 +0,0 @@
1
- import type { FormatUserSummaryResponse, 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
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUserFormattedSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserFormattedSummary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrG,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,20 +0,0 @@
1
- import type { SpokeProvider, 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>;
20
- //# sourceMappingURL=useUserReservesData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUserReservesData.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useUserReservesData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,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,33 +0,0 @@
1
- import type { SpokeProvider } from '@sodax/sdk';
2
- import type { XToken } from '@sodax/types';
3
- import { type UseMutationResult } from '@tanstack/react-query';
4
- interface WithdrawResponse {
5
- ok: true;
6
- value: [string, string];
7
- }
8
- /**
9
- * Hook for withdrawing supplied tokens from the Sodax money market.
10
- *
11
- * This hook provides functionality to withdraw previously supplied tokens from the money market protocol,
12
- * handling the entire withdrawal process including transaction creation, submission,
13
- * and cross-chain communication.
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
21
- * @example
22
- * ```typescript
23
- * const { mutateAsync: withdraw, isPending, error } = useWithdraw(spokeToken);
24
- * await withdraw('100');
25
- * ```
26
- *
27
- * @throws {Error} When:
28
- * - spokeProvider is not available
29
- * - Transaction execution fails
30
- */
31
- export declare function useWithdraw(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<WithdrawResponse, Error, string>;
32
- export {};
33
- //# sourceMappingURL=useWithdraw.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './useHubProvider';
2
- export * from './useSpokeProvider';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { EvmHubProvider } from '@sodax/sdk';
2
- export declare function useHubProvider(): EvmHubProvider;
3
- //# sourceMappingURL=useHubProvider.d.ts.map
@@ -1 +0,0 @@
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,CAI/C"}
@@ -1,18 +0,0 @@
1
- import { type SpokeProvider, type IWalletProvider } from '@sodax/sdk';
2
- import type { SpokeChainId } from '@sodax/types';
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;
18
- //# sourceMappingURL=useSpokeProvider.d.ts.map
@@ -1 +0,0 @@
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,CA0E3B"}
@@ -1,6 +0,0 @@
1
- export * from './useSodaxContext';
2
- export * from './useEstimateGas';
3
- export * from './useDeriveUserWalletAddress';
4
- export * from './useStellarTrustlineCheck';
5
- export * from './useRequestTrustline';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
@@ -1,24 +0,0 @@
1
- import { type SpokeProvider } from '@sodax/sdk';
2
- import { type UseQueryResult } from '@tanstack/react-query';
3
- import type { Address } from 'viem';
4
- /**
5
- * Hook for deriving user wallet address for hub abstraction.
6
- *
7
- * This hook derives the user's abstracted wallet address for the hub chain.
8
- * If the spoke chain is the same as the hub chain, it returns the original wallet address.
9
- * Otherwise, it returns the abstracted wallet address for cross-chain operations.
10
- *
11
- * @param spokeProvider - The spoke provider instance for the origin chain
12
- * @param walletAddress - Optional user wallet address on spoke chain. If not provided, will fetch from spokeProvider
13
- * @returns A React Query result object containing:
14
- * - data: The derived user wallet address when available
15
- * - isLoading: Loading state indicator
16
- * - error: Any error that occurred during derivation
17
- *
18
- * @example
19
- * ```typescript
20
- * const { data: derivedAddress, isLoading, error } = useDeriveUserWalletAddress(spokeProvider, userAddress);
21
- * ```
22
- */
23
- export declare function useDeriveUserWalletAddress(spokeProvider: SpokeProvider | undefined, walletAddress?: string | undefined): UseQueryResult<Address, Error>;
24
- //# sourceMappingURL=useDeriveUserWalletAddress.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDeriveUserWalletAddress.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/useDeriveUserWalletAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,aAAa,EAAuB,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GACjC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAehC"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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,44 +0,0 @@
1
- import { type SpokeProvider, StellarSpokeProvider, type TxReturnType } from '@sodax/sdk';
2
- import { type UseMutationResult } from '@tanstack/react-query';
3
- /**
4
- * React hook to request a Stellar trustline for a given token and amount.
5
- *
6
- * This hook provides a mutation for requesting a trustline on the Stellar network
7
- * using the provided SpokeProvider. It is intended for use with StellarSpokeProvider
8
- * and will throw if used with a non-Stellar provider. Upon success, it invalidates
9
- * the trustline check query to ensure UI reflects the updated trustline state.
10
- *
11
- * @template T - The type of SpokeProvider, defaults to SpokeProvider.
12
- * @param {string | undefined} token - The Stellar asset code or token address for which to request a trustline.
13
- * @returns {UseMutationResult<TxReturnType<StellarSpokeProvider, false>, Error, { token: string; amount: bigint; spokeProvider: T }>}
14
- * A React Query mutation result object containing:
15
- * - `mutate`/`mutateAsync`: Function to trigger the trustline request.
16
- * - `data`: The transaction result if successful.
17
- * - `error`: Any error encountered during the request.
18
- * - `isLoading`: Whether the mutation is in progress.
19
- * - Other React Query mutation state.
20
- *
21
- * @example
22
- * ```tsx
23
- * import { useRequestTrustline } from '@sodax/dapp-kit';
24
- *
25
- * const { mutate: requestTrustline, isLoading, error, data } = useRequestTrustline('USDC-G...TOKEN');
26
- *
27
- * // To request a trustline:
28
- * requestTrustline({
29
- * token: 'USDC-G...TOKEN',
30
- * amount: 10000000n,
31
- * spokeProvider: stellarProvider,
32
- * });
33
- *
34
- * if (isLoading) return <span>Requesting trustline...</span>;
35
- * if (error) return <span>Error: {error.message}</span>;
36
- * if (data) return <span>Trustline requested! Tx: {data.txHash}</span>;
37
- * ```
38
- */
39
- export declare function useRequestTrustline<T extends SpokeProvider = SpokeProvider>(token: string | undefined): UseMutationResult<TxReturnType<StellarSpokeProvider, false>, Error, {
40
- token: string;
41
- amount: bigint;
42
- spokeProvider: T;
43
- }>;
44
- //# sourceMappingURL=useRequestTrustline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRequestTrustline.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/useRequestTrustline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAuB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAe,KAAK,iBAAiB,EAAkB,MAAM,uBAAuB,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EACzE,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,iBAAiB,CAClB,YAAY,CAAC,oBAAoB,EAAE,KAAK,CAAC,EACzC,KAAK,EACL;IACE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC;CAClB,CACF,CA+BA"}
@@ -1,8 +0,0 @@
1
- import { type SodaxContextType } from '@/contexts';
2
- /**
3
- * Hook to access the Sodax context which provides access to the Sodax SDK instance and chain configuration
4
- * @throws {Error} If used outside of a SodaxProvider
5
- * @returns {SodaxContextType} The Sodax context containing SDK instance and configuration
6
- */
7
- export declare const useSodaxContext: () => SodaxContextType;
8
- //# sourceMappingURL=useSodaxContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSodaxContext.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/useSodaxContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjE;;;;GAIG;AAEH,eAAO,MAAM,eAAe,QAAO,gBAMlC,CAAC"}
@@ -1,40 +0,0 @@
1
- import type { SpokeChainId, SpokeProvider } from '@sodax/sdk';
2
- import { type UseQueryResult } from '@tanstack/react-query';
3
- /**
4
- * React hook to check if a Stellar account has a sufficient trustline for a given token and amount.
5
- *
6
- * This hook queries the Stellar network (via the provided SpokeProvider) to determine
7
- * whether the account has established a trustline for the specified token and if the trustline
8
- * is sufficient for the intended amount. It is useful for gating UI actions that require
9
- * a trustline to be present and funded.
10
- *
11
- * @template T - The type of SpokeProvider, defaults to SpokeProvider.
12
- * @param {string | undefined} token - The Stellar asset code or token address to check the trustline for.
13
- * @param {bigint | undefined} amount - The minimum amount required for the trustline.
14
- * @param {T | undefined} spokeProvider - The provider instance for interacting with the Stellar network.
15
- * @param {SpokeChainId | undefined} chainId - The chain ID to determine if the check should be performed (only on Stellar mainnet).
16
- * @returns {UseQueryResult<boolean, Error>} A React Query result object containing:
17
- * - `data`: `true` if the trustline exists and is sufficient, `false` otherwise.
18
- * - `error`: Any error encountered during the check.
19
- * - `isLoading`: Whether the query is in progress.
20
- * - Other React Query state.
21
- *
22
- * @example
23
- * ```tsx
24
- * import { useStellarTrustlineCheck } from '@sodax/dapp-kit';
25
- *
26
- * const { data: hasTrustline, isLoading, error } = useStellarTrustlineCheck(
27
- * 'USDC-G...TOKEN',
28
- * 10000000n,
29
- * stellarProvider,
30
- * 'stellar'
31
- * );
32
- *
33
- * if (isLoading) return <span>Checking trustline...</span>;
34
- * if (error) return <span>Error: {error.message}</span>;
35
- * if (!hasTrustline) return <span>Trustline not established or insufficient.</span>;
36
- * return <span>Trustline is sufficient!</span>;
37
- * ```
38
- */
39
- export declare function useStellarTrustlineCheck<T extends SpokeProvider = SpokeProvider>(token: string | undefined, amount: bigint | undefined, spokeProvider: T | undefined, chainId: SpokeChainId | undefined): UseQueryResult<boolean, Error>;
40
- //# sourceMappingURL=useStellarTrustlineCheck.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStellarTrustlineCheck.d.ts","sourceRoot":"","sources":["../../../src/hooks/shared/useStellarTrustlineCheck.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAC9E,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,aAAa,EAAE,CAAC,GAAG,SAAS,EAC5B,OAAO,EAAE,YAAY,GAAG,SAAS,GAChC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAwBhC"}
@@ -1,7 +0,0 @@
1
- export * from './useQuote';
2
- export * from './useSwap';
3
- export * from './useStatus';
4
- export * from './useSwapAllowance';
5
- export * from './useSwapApprove';
6
- export * from './useCancelSwap';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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,39 +0,0 @@
1
- import type { SolverErrorResponse, SolverIntentQuoteRequest, SolverIntentQuoteResponse, Result } from '@sodax/sdk';
2
- import { type UseQueryResult } from '@tanstack/react-query';
3
- /**
4
- * Hook for fetching a quote for an intent-based swap.
5
- *
6
- * This hook provides real-time quote data for an intent-based swap.
7
- *
8
- * @param {SolverIntentQuoteRequest | undefined} payload - The intent quote request parameters. If undefined, the query will be disabled.
9
- *
10
- * @returns {UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>} A query result object containing:
11
- * - data: The quote result from the solver
12
- * - isLoading: Boolean indicating if the quote is being fetched
13
- * - error: Error object if the quote request failed
14
- * - refetch: Function to manually trigger a quote refresh
15
- *
16
- * @example
17
- * ```typescript
18
- * const { data: quote, isLoading } = useQuote({
19
- * token_src: '0x...',
20
- * token_src_blockchain_id: '1',
21
- * token_dst: '0x...',
22
- * token_dst_blockchain_id: '2',
23
- * amount: '1000000000000000000',
24
- * quote_type: 'exact_input',
25
- * });
26
- *
27
- * if (isLoading) return <div>Loading quote...</div>;
28
- * if (quote) {
29
- * console.log('Quote received:', quote);
30
- * }
31
- * ```
32
- *
33
- * @remarks
34
- * - The quote is automatically refreshed every 3 seconds
35
- * - The query is disabled when payload is undefined
36
- * - Uses React Query for efficient caching and state management
37
- */
38
- export declare const useQuote: (payload: SolverIntentQuoteRequest | undefined) => UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>;
39
- //# sourceMappingURL=useQuote.d.ts.map
@@ -1 +0,0 @@
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;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,QAAQ,YACV,wBAAwB,GAAG,SAAS,KAC5C,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,GAAG,SAAS,CA0BnF,CAAC"}
@@ -1,31 +0,0 @@
1
- import type { Hex, SolverErrorResponse, SolverIntentStatusResponse, Result } from '@sodax/sdk';
2
- import { type UseQueryResult } from '@tanstack/react-query';
3
- /**
4
- * Hook for monitoring the status of an intent-based swap.
5
- *
6
- * This hook provides real-time status updates for an intent-based swap transaction.
7
- *
8
- * @param {Hex} intent_tx_hash - The transaction hash of the intent order on the hub chain
9
- *
10
- * @returns {UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>} A query result object containing:
11
- * - data: The status result from the solver
12
- * - isLoading: Boolean indicating if the status is being fetched
13
- * - error: Error object if the status request failed
14
- * - refetch: Function to manually trigger a status refresh
15
- *
16
- * @example
17
- * ```typescript
18
- * const { data: status, isLoading } = useStatus('0x...');
19
- *
20
- * if (isLoading) return <div>Loading status...</div>;
21
- * if (status?.ok) {
22
- * console.log('Status:', status.value);
23
- * }
24
- * ```
25
- *
26
- * @remarks
27
- * - The status is automatically refreshed every 3 seconds
28
- * - Uses React Query for efficient caching and state management
29
- */
30
- export declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
31
- //# sourceMappingURL=useStatus.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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,EAAkB,MAAM,uBAAuB,CAAC;AAE5F,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,CAmBlE"}
@@ -1,23 +0,0 @@
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
@@ -1 +0,0 @@
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,CAqBhC"}
@@ -1,25 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1,12 +0,0 @@
1
- import type { ReactNode, ReactElement } from 'react';
2
- import { type SodaxConfig } from '@sodax/sdk';
3
- import type { RpcConfig } from '@/types';
4
- interface SodaxProviderProps {
5
- children: ReactNode;
6
- testnet?: boolean;
7
- config?: SodaxConfig;
8
- rpcConfig: RpcConfig;
9
- }
10
- export declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
11
- export {};
12
- //# sourceMappingURL=SodaxProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SodaxProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SodaxProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,6CAAsD,kBAAkB,KAAG,YAIpG,CAAC"}
@@ -1,2 +0,0 @@
1
- export { SodaxProvider } from './SodaxProvider';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}