@dodoex/wallet-web3-react 0.4.5-beta.0 → 0.4.5-beta.1
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/cjs/index.cjs +3 -3
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/hooks/useFetchTokensBalance.ts +11 -6
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getFetchERC20BalanceOfQueryOptions,
|
|
5
|
+
getFetchMulticallWithValidGetEthBalanceQueryOptions,
|
|
6
|
+
} from '@dodoex/dodo-contract-request';
|
|
4
7
|
import { useQueries } from '@tanstack/react-query';
|
|
5
8
|
import { TokenInfo } from '../components/TokenLogo';
|
|
6
9
|
|
|
10
|
+
const NATIVE_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
11
|
+
|
|
7
12
|
type TokenInfoMap = Map<string, bigint>;
|
|
8
13
|
|
|
9
14
|
export default function useFetchTokensBalance({
|
|
@@ -19,11 +24,11 @@ export default function useFetchTokensBalance({
|
|
|
19
24
|
}) {
|
|
20
25
|
const tokensQueries = useQueries({
|
|
21
26
|
queries: (tokenList ?? []).map((token) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
token
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
const chainId = skip ? undefined : token.chainId;
|
|
28
|
+
const query =
|
|
29
|
+
token.address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()
|
|
30
|
+
? getFetchMulticallWithValidGetEthBalanceQueryOptions(chainId, account)
|
|
31
|
+
: getFetchERC20BalanceOfQueryOptions(chainId, token?.address, account);
|
|
27
32
|
|
|
28
33
|
return {
|
|
29
34
|
queryKey: blockNumber
|