@sodax/dapp-kit 1.0.0-rc.6 → 1.0.0-rc.7
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/dist/index.d.mts +31 -11
- package/dist/index.d.ts +31 -11
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/backend/useBackendIntentByTxHash.ts +11 -6
- package/src/hooks/mm/index.ts +2 -1
- package/src/index.ts +0 -1
- package/src/core/index.ts +0 -12
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sodax/dapp-kit",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.7",
|
|
5
5
|
"description": "dapp-kit of New World",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"viem": "2.29.2",
|
|
19
|
-
"@sodax/sdk": "1.0.0-rc.
|
|
20
|
-
"@sodax/types": "1.0.0-rc.
|
|
19
|
+
"@sodax/sdk": "1.0.0-rc.7",
|
|
20
|
+
"@sodax/types": "1.0.0-rc.7"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "18.3.1",
|
|
@@ -4,13 +4,13 @@ import type { IntentResponse } from '@sodax/sdk';
|
|
|
4
4
|
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Hook for fetching intent details by transaction hash from the backend API.
|
|
7
|
+
* Hook for fetching intent details by intent created transaction hash from the backend API.
|
|
8
8
|
*
|
|
9
|
-
* This hook provides access to intent data associated with
|
|
10
|
-
* including intent details, events, and transaction
|
|
11
|
-
* fetched and cached using React Query.
|
|
9
|
+
* This hook provides access to intent data associated with the transaction hash from when
|
|
10
|
+
* the intent was created on the hub chain, including intent details, events, and transaction
|
|
11
|
+
* information. The data is automatically fetched and cached using React Query.
|
|
12
12
|
*
|
|
13
|
-
* @param {string | undefined} txHash - The transaction hash to fetch intent for. If undefined, the query will be disabled.
|
|
13
|
+
* @param {string | undefined} txHash - The intent created transaction hash from the hub chain to fetch intent for. If undefined, the query will be disabled.
|
|
14
14
|
*
|
|
15
15
|
* @returns {UseQueryResult<IntentResponse | undefined>} A query result object containing:
|
|
16
16
|
* - data: The intent response data when available
|
|
@@ -30,11 +30,15 @@ import { useSodaxContext } from '../shared/useSodaxContext';
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
+
* - Intents are only created on the hub chain, so the transaction hash must be from the hub chain
|
|
33
34
|
* - The query is disabled when txHash is undefined or empty
|
|
34
35
|
* - Uses React Query for efficient caching and state management
|
|
35
36
|
* - Automatically handles error states and loading indicators
|
|
36
37
|
*/
|
|
37
|
-
export const useBackendIntentByTxHash = (
|
|
38
|
+
export const useBackendIntentByTxHash = (
|
|
39
|
+
txHash: string | undefined,
|
|
40
|
+
refetchInterval = 1000,
|
|
41
|
+
): UseQueryResult<IntentResponse | undefined> => {
|
|
38
42
|
const { sodax } = useSodaxContext();
|
|
39
43
|
|
|
40
44
|
return useQuery({
|
|
@@ -46,6 +50,7 @@ export const useBackendIntentByTxHash = (txHash: string | undefined): UseQueryRe
|
|
|
46
50
|
|
|
47
51
|
return sodax.backendApi.getIntentByTxHash(txHash);
|
|
48
52
|
},
|
|
53
|
+
refetchInterval,
|
|
49
54
|
enabled: !!txHash && txHash.length > 0,
|
|
50
55
|
retry: 3,
|
|
51
56
|
});
|
package/src/hooks/mm/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/core/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ChainId } from '@sodax/types';
|
|
2
|
-
|
|
3
|
-
import { hubAssets } from '@sodax/sdk';
|
|
4
|
-
|
|
5
|
-
export const getSpokeTokenAddressByVault = (spokeChainId: ChainId, vault: string) => {
|
|
6
|
-
const tokens = hubAssets[spokeChainId];
|
|
7
|
-
const address = Object.keys(tokens).find(
|
|
8
|
-
tokenAddress => tokens[tokenAddress].vault.toLowerCase() === vault.toLowerCase(),
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
return address;
|
|
12
|
-
};
|