@sodax/dapp-kit 0.0.1-rc.8 → 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.
- package/README.md +1 -3
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/hooks/mm/index.d.ts +0 -1
- package/dist/hooks/mm/index.d.ts.map +1 -1
- package/dist/hooks/mm/useBorrow.d.ts +1 -1
- package/dist/hooks/mm/useBorrow.d.ts.map +1 -1
- package/dist/hooks/mm/useRepay.d.ts +1 -1
- package/dist/hooks/mm/useRepay.d.ts.map +1 -1
- package/dist/hooks/mm/useSupply.d.ts +1 -1
- package/dist/hooks/mm/useSupply.d.ts.map +1 -1
- package/dist/hooks/mm/useUserReservesData.d.ts +1 -7
- package/dist/hooks/mm/useUserReservesData.d.ts.map +1 -1
- package/dist/hooks/mm/useWithdraw.d.ts +1 -1
- package/dist/hooks/mm/useWithdraw.d.ts.map +1 -1
- package/dist/hooks/provider/useSpokeProvider.d.ts.map +1 -1
- package/dist/hooks/swap/useCreateIntentOrder.d.ts +3 -3
- package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +1 -1
- package/dist/hooks/swap/useQuote.d.ts +4 -4
- package/dist/hooks/swap/useQuote.d.ts.map +1 -1
- package/dist/hooks/swap/useStatus.d.ts +3 -3
- package/dist/hooks/swap/useStatus.d.ts.map +1 -1
- package/dist/index.js +20 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/core/index.ts +4 -27
- package/src/hooks/mm/index.ts +0 -1
- package/src/hooks/mm/useBorrow.ts +2 -2
- package/src/hooks/mm/useRepay.ts +2 -2
- package/src/hooks/mm/useSupply.ts +2 -2
- package/src/hooks/mm/useUserReservesData.ts +1 -7
- package/src/hooks/mm/useWithdraw.ts +2 -2
- package/src/hooks/provider/useSpokeProvider.ts +13 -5
- package/src/hooks/swap/useCreateIntentOrder.ts +5 -5
- package/src/hooks/swap/useQuote.ts +5 -5
- package/src/hooks/swap/useStatus.ts +3 -3
- package/dist/hooks/mm/useHubWalletAddress.d.ts +0 -24
- package/dist/hooks/mm/useHubWalletAddress.d.ts.map +0 -1
- package/src/hooks/mm/useHubWalletAddress.ts +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex,
|
|
1
|
+
import type { Hex, SolverErrorResponse, SolverIntentStatusResponse, Result } from '@sodax/sdk';
|
|
2
2
|
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ import { useSodaxContext } from '../shared/useSodaxContext';
|
|
|
9
9
|
*
|
|
10
10
|
* @param {Hex} intent_tx_hash - The transaction hash of the intent order on the hub chain
|
|
11
11
|
*
|
|
12
|
-
* @returns {UseQueryResult<Result<
|
|
12
|
+
* @returns {UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>} A query result object containing:
|
|
13
13
|
* - data: The status result from the solver
|
|
14
14
|
* - isLoading: Boolean indicating if the status is being fetched
|
|
15
15
|
* - error: Error object if the status request failed
|
|
@@ -32,7 +32,7 @@ import { useSodaxContext } from '../shared/useSodaxContext';
|
|
|
32
32
|
|
|
33
33
|
export const useStatus = (
|
|
34
34
|
intent_tx_hash: Hex,
|
|
35
|
-
): UseQueryResult<Result<
|
|
35
|
+
): UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined> => {
|
|
36
36
|
const { sodax } = useSodaxContext();
|
|
37
37
|
return useQuery({
|
|
38
38
|
queryKey: [intent_tx_hash],
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type EvmHubProvider, type SpokeChainId } from '@sodax/sdk';
|
|
2
|
-
import { type UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for retrieving the hub wallet address for a given spoke chain and address.
|
|
5
|
-
*
|
|
6
|
-
* This hook fetches the hub wallet address associated with a user's address on a specific spoke chain.
|
|
7
|
-
* It uses the EvmWalletAbstraction to query the hub wallet address from the hub provider.
|
|
8
|
-
*
|
|
9
|
-
* @param spokeChainId - The chain ID of the spoke chain
|
|
10
|
-
* @param address - The user's address on the spoke chain
|
|
11
|
-
* @param hubProvider - The hub provider instance
|
|
12
|
-
*
|
|
13
|
-
* @returns {UseQueryResult<string | null>} A query result object containing:
|
|
14
|
-
* - data: The hub wallet address or null if not found
|
|
15
|
-
* - isLoading: Boolean indicating if the query is in progress
|
|
16
|
-
* - error: Error object if the query failed, null otherwise
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const { data: hubWalletAddress, isLoading, error } = useHubWalletAddress(spokeChainId, address, hubProvider);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function useHubWalletAddress(spokeChainId: SpokeChainId, address: string | undefined, hubProvider: EvmHubProvider): UseQueryResult<string | null>;
|
|
24
|
-
//# sourceMappingURL=useHubWalletAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHubWalletAddress.d.ts","sourceRoot":"","sources":["../../../src/hooks/mm/useHubWalletAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAwB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,cAAc,GAC1B,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAoB/B"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type EvmHubProvider, EvmWalletAbstraction, type SpokeChainId } from '@sodax/sdk';
|
|
2
|
-
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Hook for retrieving the hub wallet address for a given spoke chain and address.
|
|
6
|
-
*
|
|
7
|
-
* This hook fetches the hub wallet address associated with a user's address on a specific spoke chain.
|
|
8
|
-
* It uses the EvmWalletAbstraction to query the hub wallet address from the hub provider.
|
|
9
|
-
*
|
|
10
|
-
* @param spokeChainId - The chain ID of the spoke chain
|
|
11
|
-
* @param address - The user's address on the spoke chain
|
|
12
|
-
* @param hubProvider - The hub provider instance
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseQueryResult<string | null>} A query result object containing:
|
|
15
|
-
* - data: The hub wallet address or null if not found
|
|
16
|
-
* - isLoading: Boolean indicating if the query is in progress
|
|
17
|
-
* - error: Error object if the query failed, null otherwise
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const { data: hubWalletAddress, isLoading, error } = useHubWalletAddress(spokeChainId, address, hubProvider);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export function useHubWalletAddress(
|
|
26
|
-
spokeChainId: SpokeChainId,
|
|
27
|
-
address: string | undefined,
|
|
28
|
-
hubProvider: EvmHubProvider,
|
|
29
|
-
): UseQueryResult<string | null> {
|
|
30
|
-
return useQuery({
|
|
31
|
-
queryKey: ['hubWallet', spokeChainId, address],
|
|
32
|
-
queryFn: async () => {
|
|
33
|
-
if (!address) return null;
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const hubWalletAddress = await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
37
|
-
spokeChainId,
|
|
38
|
-
address as `0x${string}`,
|
|
39
|
-
hubProvider,
|
|
40
|
-
);
|
|
41
|
-
return hubWalletAddress;
|
|
42
|
-
} catch (error) {
|
|
43
|
-
console.log('error', error);
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
enabled: !!address && !!hubProvider,
|
|
48
|
-
});
|
|
49
|
-
}
|