@0xsequence/hooks 5.1.0 → 5.2.0
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/hooks/Combination/useGetSwapPrices.d.ts.map +1 -1
- package/dist/cjs/hooks/Combination/useGetSwapPrices.js +17 -13
- package/dist/cjs/hooks/Combination/useGetSwapPrices.js.map +1 -1
- package/dist/cjs/hooks/Combination/useGetSwapQuote.d.ts.map +1 -1
- package/dist/cjs/hooks/Combination/useGetSwapQuote.js +7 -1
- package/dist/cjs/hooks/Combination/useGetSwapQuote.js.map +1 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.d.ts +7 -2
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.d.ts.map +1 -1
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.js +3 -3
- package/dist/cjs/hooks/Indexer/useGetTransactionHistorySummary.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts +29 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.js +29 -1
- package/dist/cjs/hooks/IndexerGateway/useGetNativeTokenBalance.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.d.ts +38 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.js +38 -1
- package/dist/cjs/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts +52 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.js +52 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesByContract.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts +90 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.js +90 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesDetails.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts +65 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.js +65 -1
- package/dist/cjs/hooks/IndexerGateway/useGetTokenBalancesSummary.js.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.d.ts +26 -0
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.d.ts.map +1 -1
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.js +26 -0
- package/dist/cjs/hooks/IndexerGateway/useIndexerGatewayClient.js.map +1 -1
- package/dist/cjs/tests/handlers.d.ts.map +1 -1
- package/dist/cjs/tests/handlers.js +20 -0
- package/dist/cjs/tests/handlers.js.map +1 -1
- package/dist/esm/hooks/Combination/useGetSwapPrices.d.ts.map +1 -1
- package/dist/esm/hooks/Combination/useGetSwapPrices.js +18 -14
- package/dist/esm/hooks/Combination/useGetSwapPrices.js.map +1 -1
- package/dist/esm/hooks/Combination/useGetSwapQuote.d.ts.map +1 -1
- package/dist/esm/hooks/Combination/useGetSwapQuote.js +7 -1
- package/dist/esm/hooks/Combination/useGetSwapQuote.js.map +1 -1
- package/dist/esm/hooks/Indexer/useGetTransactionHistorySummary.d.ts +7 -2
- package/dist/esm/hooks/Indexer/useGetTransactionHistorySummary.d.ts.map +1 -1
- package/dist/esm/hooks/Indexer/useGetTransactionHistorySummary.js +3 -3
- package/dist/esm/hooks/Indexer/useGetTransactionHistorySummary.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts +29 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.js +29 -1
- package/dist/esm/hooks/IndexerGateway/useGetNativeTokenBalance.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.d.ts +38 -1
- package/dist/esm/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.js +38 -1
- package/dist/esm/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts +52 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.js +52 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesByContract.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts +90 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.js +90 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesDetails.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts +65 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.js +65 -1
- package/dist/esm/hooks/IndexerGateway/useGetTokenBalancesSummary.js.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useIndexerGatewayClient.d.ts +26 -0
- package/dist/esm/hooks/IndexerGateway/useIndexerGatewayClient.d.ts.map +1 -1
- package/dist/esm/hooks/IndexerGateway/useIndexerGatewayClient.js +26 -0
- package/dist/esm/hooks/IndexerGateway/useIndexerGatewayClient.js.map +1 -1
- package/dist/esm/tests/handlers.d.ts.map +1 -1
- package/dist/esm/tests/handlers.js +20 -0
- package/dist/esm/tests/handlers.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import { IndexerGateway, TokenBalance } from '@0xsequence/indexer';
|
|
2
2
|
import { HooksOptions } from '../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Hook to fetch native token balances (like ETH, POL) across multiple chains for a given address.
|
|
5
|
+
* Uses the indexer gateway client to efficiently fetch balances in a single request.
|
|
6
|
+
*
|
|
7
|
+
* @param getNativeTokenBalanceArgs - Arguments for fetching native token balances
|
|
8
|
+
* @param getNativeTokenBalanceArgs.accountAddress - The address to fetch balances for
|
|
9
|
+
* @param getNativeTokenBalanceArgs.chainIds - Array of chain IDs to fetch balances from
|
|
10
|
+
* @param options - Optional configuration for the query behavior
|
|
11
|
+
*
|
|
12
|
+
* @returns Query result containing an array of TokenBalance objects
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetNativeTokenBalance} for more detailed documentation.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { useGetNativeTokenBalance } from '@0xsequence/hooks'
|
|
19
|
+
*
|
|
20
|
+
* function NativeBalances() {
|
|
21
|
+
* const { data: balances } = useGetNativeTokenBalance({
|
|
22
|
+
* accountAddress: '0x123...',
|
|
23
|
+
* chainIds: [1, 137] // Fetch ETH on Ethereum and MATIC on Polygon
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* return balances?.map(balance => (
|
|
27
|
+
* <div key={balance.chainId}>
|
|
28
|
+
* Chain {balance.chainId}: {balance.balance}
|
|
29
|
+
* </div>
|
|
30
|
+
* ))
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
5
33
|
*/
|
|
6
34
|
export declare const useGetNativeTokenBalance: (getNativeTokenBalanceArgs: IndexerGateway.GetNativeTokenBalanceArgs, options?: HooksOptions) => import("@tanstack/react-query").UseQueryResult<TokenBalance[], Error>;
|
|
7
35
|
//# sourceMappingURL=useGetNativeTokenBalance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetNativeTokenBalance.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetNativeTokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAI1F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAkB1C
|
|
1
|
+
{"version":3,"file":"useGetNativeTokenBalance.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetNativeTokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAI1F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAkB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,wBAAwB,GACnC,2BAA2B,cAAc,CAAC,yBAAyB,EACnE,UAAU,YAAY,0EAWvB,CAAA"}
|
|
@@ -8,7 +8,35 @@ const getNativeTokenBalance = async (indexerGatewayClient, getNativeTokenBalance
|
|
|
8
8
|
return balances;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Hook to fetch native token balances (like ETH, POL) across multiple chains for a given address.
|
|
12
|
+
* Uses the indexer gateway client to efficiently fetch balances in a single request.
|
|
13
|
+
*
|
|
14
|
+
* @param getNativeTokenBalanceArgs - Arguments for fetching native token balances
|
|
15
|
+
* @param getNativeTokenBalanceArgs.accountAddress - The address to fetch balances for
|
|
16
|
+
* @param getNativeTokenBalanceArgs.chainIds - Array of chain IDs to fetch balances from
|
|
17
|
+
* @param options - Optional configuration for the query behavior
|
|
18
|
+
*
|
|
19
|
+
* @returns Query result containing an array of TokenBalance objects
|
|
20
|
+
*
|
|
21
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetNativeTokenBalance} for more detailed documentation.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* import { useGetNativeTokenBalance } from '@0xsequence/hooks'
|
|
26
|
+
*
|
|
27
|
+
* function NativeBalances() {
|
|
28
|
+
* const { data: balances } = useGetNativeTokenBalance({
|
|
29
|
+
* accountAddress: '0x123...',
|
|
30
|
+
* chainIds: [1, 137] // Fetch ETH on Ethereum and MATIC on Polygon
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* return balances?.map(balance => (
|
|
34
|
+
* <div key={balance.chainId}>
|
|
35
|
+
* Chain {balance.chainId}: {balance.balance}
|
|
36
|
+
* </div>
|
|
37
|
+
* ))
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
12
40
|
*/
|
|
13
41
|
export const useGetNativeTokenBalance = (getNativeTokenBalanceArgs, options) => {
|
|
14
42
|
const indexerGatewayClient = useIndexerGatewayClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetNativeTokenBalance.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetNativeTokenBalance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,qBAAqB,GAAG,KAAK,EACjC,oBAA4C,EAC5C,yBAAmE,EAC1C,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAA;IAEvF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAC3C,wBAAwB,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CACpG,CAAA;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"useGetNativeTokenBalance.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetNativeTokenBalance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,qBAAqB,GAAG,KAAK,EACjC,oBAA4C,EAC5C,yBAAmE,EAC1C,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAA;IAEvF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAC3C,wBAAwB,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CACpG,CAAA;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,yBAAmE,EACnE,OAAsB,EACtB,EAAE;IACF,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAA;IAEtD,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,wBAAwB,EAAE,yBAAyB,EAAE,OAAO,CAAC;QACnF,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,qBAAqB,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;QACjG,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,EAAE;QAC9B,OAAO,EAAE,CAAC,CAAC,yBAAyB,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,QAAQ;KAC1E,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -5,7 +5,44 @@ export interface GetSingleTokenBalanceSummaryArgs {
|
|
|
5
5
|
contractAddress: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Hook to fetch the balance of a specific token (native or ERC20) for an account on a specific chain.
|
|
9
|
+
* For native tokens, use ZERO_ADDRESS (0x0000...0000) as the contractAddress.
|
|
10
|
+
*
|
|
11
|
+
* @param args - Arguments for fetching the token balance
|
|
12
|
+
* @param args.chainId - The chain ID to fetch the balance from
|
|
13
|
+
* @param args.accountAddress - The address to fetch the balance for
|
|
14
|
+
* @param args.contractAddress - The token contract address (use ZERO_ADDRESS for native tokens)
|
|
15
|
+
* @param options - Optional configuration for the query behavior
|
|
16
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens
|
|
17
|
+
*
|
|
18
|
+
* @returns Query result containing the token balance
|
|
19
|
+
*
|
|
20
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetSingleTokenBalanceSummary} for more detailed documentation.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { useGetSingleTokenBalanceSummary, ZERO_ADDRESS } from '@0xsequence/hooks'
|
|
25
|
+
*
|
|
26
|
+
* // Fetch native ETH balance
|
|
27
|
+
* function NativeBalance() {
|
|
28
|
+
* const { data: ethBalance } = useGetSingleTokenBalanceSummary({
|
|
29
|
+
* chainId: 1,
|
|
30
|
+
* accountAddress: '0x123...',
|
|
31
|
+
* contractAddress: ZERO_ADDRESS
|
|
32
|
+
* })
|
|
33
|
+
* return <div>ETH Balance: {ethBalance?.balance}</div>
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* // Fetch USDC balance
|
|
37
|
+
* function TokenBalance() {
|
|
38
|
+
* const { data: usdcBalance } = useGetSingleTokenBalanceSummary({
|
|
39
|
+
* chainId: 1,
|
|
40
|
+
* accountAddress: '0x123...',
|
|
41
|
+
* contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC
|
|
42
|
+
* })
|
|
43
|
+
* return <div>USDC Balance: {usdcBalance?.balance}</div>
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
9
46
|
*/
|
|
10
47
|
export declare const useGetSingleTokenBalanceSummary: (args: GetSingleTokenBalanceSummaryArgs, options?: BalanceHookOptions) => import("@tanstack/react-query").UseQueryResult<import("@0xsequence/indexer").TokenBalance, Error>;
|
|
11
48
|
//# sourceMappingURL=useGetSingleTokenBalanceSummary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSingleTokenBalanceSummary.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAKhD,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;CACxB;AA+BD
|
|
1
|
+
{"version":3,"file":"useGetSingleTokenBalanceSummary.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAKhD,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;CACxB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,+BAA+B,GAAI,MAAM,gCAAgC,EAAE,UAAU,kBAAkB,sGAYnH,CAAA"}
|
|
@@ -25,7 +25,44 @@ const getSingleTokenBalanceSummary = async (args, indexerGatewayClient, hideColl
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Hook to fetch the balance of a specific token (native or ERC20) for an account on a specific chain.
|
|
29
|
+
* For native tokens, use ZERO_ADDRESS (0x0000...0000) as the contractAddress.
|
|
30
|
+
*
|
|
31
|
+
* @param args - Arguments for fetching the token balance
|
|
32
|
+
* @param args.chainId - The chain ID to fetch the balance from
|
|
33
|
+
* @param args.accountAddress - The address to fetch the balance for
|
|
34
|
+
* @param args.contractAddress - The token contract address (use ZERO_ADDRESS for native tokens)
|
|
35
|
+
* @param options - Optional configuration for the query behavior
|
|
36
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens
|
|
37
|
+
*
|
|
38
|
+
* @returns Query result containing the token balance
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetSingleTokenBalanceSummary} for more detailed documentation.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import { useGetSingleTokenBalanceSummary, ZERO_ADDRESS } from '@0xsequence/hooks'
|
|
45
|
+
*
|
|
46
|
+
* // Fetch native ETH balance
|
|
47
|
+
* function NativeBalance() {
|
|
48
|
+
* const { data: ethBalance } = useGetSingleTokenBalanceSummary({
|
|
49
|
+
* chainId: 1,
|
|
50
|
+
* accountAddress: '0x123...',
|
|
51
|
+
* contractAddress: ZERO_ADDRESS
|
|
52
|
+
* })
|
|
53
|
+
* return <div>ETH Balance: {ethBalance?.balance}</div>
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* // Fetch USDC balance
|
|
57
|
+
* function TokenBalance() {
|
|
58
|
+
* const { data: usdcBalance } = useGetSingleTokenBalanceSummary({
|
|
59
|
+
* chainId: 1,
|
|
60
|
+
* accountAddress: '0x123...',
|
|
61
|
+
* contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC
|
|
62
|
+
* })
|
|
63
|
+
* return <div>USDC Balance: {usdcBalance?.balance}</div>
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
29
66
|
*/
|
|
30
67
|
export const useGetSingleTokenBalanceSummary = (args, options) => {
|
|
31
68
|
const indexerGatewayClient = useIndexerGatewayClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSingleTokenBalanceSummary.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAQnE,MAAM,4BAA4B,GAAG,KAAK,EACxC,IAAsC,EACtC,oBAA4C,EAC5C,gBAAyB,EACzB,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,uBAAuB,CAAC;QACjE,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;QACxB,MAAM,EAAE;YACN,gBAAgB,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC;YACvC,iBAAiB,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC;YACzC,kBAAkB,EAAE,KAAK;SAC1B;KACF,CAAC,CAAA;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC5C,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;QACH,CAAC;IACH,CAAC;IAED,IAAI,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,CAAC;QACvD,OAAO,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClH,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACvC,CAAC;AACH,CAAC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"useGetSingleTokenBalanceSummary.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetSingleTokenBalanceSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAQnE,MAAM,4BAA4B,GAAG,KAAK,EACxC,IAAsC,EACtC,oBAA4C,EAC5C,gBAAyB,EACzB,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,uBAAuB,CAAC;QACjE,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;QACxB,MAAM,EAAE;YACN,gBAAgB,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC;YACvC,iBAAiB,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC;YACzC,kBAAkB,EAAE,KAAK;SAC1B;KACF,CAAC,CAAA;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC5C,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;QACH,CAAC;IACH,CAAC;IAED,IAAI,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,CAAC;QACvD,OAAO,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClH,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACvC,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,IAAsC,EAAE,OAA4B,EAAE,EAAE;IACtH,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAA;IAEtD,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,+BAA+B,EAAE,IAAI,EAAE,OAAO,CAAC;QACrE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,MAAM,4BAA4B,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK,CAAC,CAAA;QAC3G,CAAC;QACD,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,EAAE;QAC9B,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,QAAQ;KACvE,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,7 +1,58 @@
|
|
|
1
1
|
import { IndexerGateway, TokenBalance } from '@0xsequence/indexer';
|
|
2
2
|
import { BalanceHookOptions } from '../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Hook to fetch token balances by contract address.
|
|
5
|
+
* Can be used to fetch multiple token balances in a single request.
|
|
6
|
+
*
|
|
7
|
+
* @param getTokenBalancesByContractArgs - Arguments for fetching token balances
|
|
8
|
+
* @param getTokenBalancesByContractArgs.chainIds - Array of chain IDs to fetch balances from
|
|
9
|
+
* @param getTokenBalancesByContractArgs.filter - Filter criteria for the query
|
|
10
|
+
* @param getTokenBalancesByContractArgs.filter.contractAddresses - List of token contract addresses to fetch balances for
|
|
11
|
+
* @param getTokenBalancesByContractArgs.filter.accountAddresses - Optional list of account addresses to fetch balances for
|
|
12
|
+
* @param getTokenBalancesByContractArgs.filter.contractStatus - Optional filter for contract verification status
|
|
13
|
+
* @param options - Optional configuration for the query behavior
|
|
14
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens from the results
|
|
15
|
+
* @param options.disabled - If true, disables the query from automatically running
|
|
16
|
+
* @param options.retry - If true, retries failed queries
|
|
17
|
+
*
|
|
18
|
+
* @returns Query result containing an array of TokenBalance objects with the following properties:
|
|
19
|
+
* - `contractType`: Type of the token contract (ERC20, ERC721, ERC1155)
|
|
20
|
+
* - `contractAddress`: Address of the token contract
|
|
21
|
+
* - `accountAddress`: Address of the account holding the tokens
|
|
22
|
+
* - `tokenID`: (for ERC721/ERC1155) ID of the token
|
|
23
|
+
* - `balance`: Token balance as a string
|
|
24
|
+
* - `blockHash`: Hash of the block where this balance was last updated
|
|
25
|
+
* - `blockNumber`: Block number where this balance was last updated
|
|
26
|
+
* - `chainId`: Chain ID where the token exists
|
|
27
|
+
* - `contractInfo`: (optional) Additional token contract information including:
|
|
28
|
+
* - `name`: Token name
|
|
29
|
+
* - `symbol`: Token symbol
|
|
30
|
+
* - `decimals`: Number of decimals (for ERC20)
|
|
31
|
+
* - `logoURI`: URL of the token logo
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetTokenBalancesByContract} for more detailed documentation.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* function TokenBalances() {
|
|
38
|
+
* const { data: balances } = useGetTokenBalancesByContract({
|
|
39
|
+
* chainIds: [1], // Ethereum mainnet
|
|
40
|
+
* filter: {
|
|
41
|
+
* contractAddresses: [
|
|
42
|
+
* '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
|
|
43
|
+
* '0xdac17f958d2ee523a2206206994597c13d831ec7' // USDT
|
|
44
|
+
* ],
|
|
45
|
+
* accountAddresses: ['0x123...']
|
|
46
|
+
* }
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* return balances?.map(balance => (
|
|
50
|
+
* <div key={balance.contractAddress}>
|
|
51
|
+
* {balance.contractInfo?.symbol}: {balance.balance}
|
|
52
|
+
* </div>
|
|
53
|
+
* ))
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
5
56
|
*/
|
|
6
57
|
export declare const useGetTokenBalancesByContract: (getTokenBalancesByContractArgs: IndexerGateway.GetTokenBalancesByContractArgs, options?: BalanceHookOptions) => import("@tanstack/react-query").UseQueryResult<TokenBalance[], Error>;
|
|
7
58
|
//# sourceMappingURL=useGetTokenBalancesByContract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTokenBalancesByContract.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesByContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAsBhD
|
|
1
|
+
{"version":3,"file":"useGetTokenBalancesByContract.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesByContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAsBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,6BAA6B,GACxC,gCAAgC,cAAc,CAAC,8BAA8B,EAC7E,UAAU,kBAAkB,0EAiB7B,CAAA"}
|
|
@@ -12,7 +12,58 @@ const getTokenBalancesByContract = async (indexerGatewayClient, getTokenBalances
|
|
|
12
12
|
return res.balances.flatMap(balance => balance.results);
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Hook to fetch token balances by contract address.
|
|
16
|
+
* Can be used to fetch multiple token balances in a single request.
|
|
17
|
+
*
|
|
18
|
+
* @param getTokenBalancesByContractArgs - Arguments for fetching token balances
|
|
19
|
+
* @param getTokenBalancesByContractArgs.chainIds - Array of chain IDs to fetch balances from
|
|
20
|
+
* @param getTokenBalancesByContractArgs.filter - Filter criteria for the query
|
|
21
|
+
* @param getTokenBalancesByContractArgs.filter.contractAddresses - List of token contract addresses to fetch balances for
|
|
22
|
+
* @param getTokenBalancesByContractArgs.filter.accountAddresses - Optional list of account addresses to fetch balances for
|
|
23
|
+
* @param getTokenBalancesByContractArgs.filter.contractStatus - Optional filter for contract verification status
|
|
24
|
+
* @param options - Optional configuration for the query behavior
|
|
25
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens from the results
|
|
26
|
+
* @param options.disabled - If true, disables the query from automatically running
|
|
27
|
+
* @param options.retry - If true, retries failed queries
|
|
28
|
+
*
|
|
29
|
+
* @returns Query result containing an array of TokenBalance objects with the following properties:
|
|
30
|
+
* - `contractType`: Type of the token contract (ERC20, ERC721, ERC1155)
|
|
31
|
+
* - `contractAddress`: Address of the token contract
|
|
32
|
+
* - `accountAddress`: Address of the account holding the tokens
|
|
33
|
+
* - `tokenID`: (for ERC721/ERC1155) ID of the token
|
|
34
|
+
* - `balance`: Token balance as a string
|
|
35
|
+
* - `blockHash`: Hash of the block where this balance was last updated
|
|
36
|
+
* - `blockNumber`: Block number where this balance was last updated
|
|
37
|
+
* - `chainId`: Chain ID where the token exists
|
|
38
|
+
* - `contractInfo`: (optional) Additional token contract information including:
|
|
39
|
+
* - `name`: Token name
|
|
40
|
+
* - `symbol`: Token symbol
|
|
41
|
+
* - `decimals`: Number of decimals (for ERC20)
|
|
42
|
+
* - `logoURI`: URL of the token logo
|
|
43
|
+
*
|
|
44
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetTokenBalancesByContract} for more detailed documentation.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* function TokenBalances() {
|
|
49
|
+
* const { data: balances } = useGetTokenBalancesByContract({
|
|
50
|
+
* chainIds: [1], // Ethereum mainnet
|
|
51
|
+
* filter: {
|
|
52
|
+
* contractAddresses: [
|
|
53
|
+
* '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
|
|
54
|
+
* '0xdac17f958d2ee523a2206206994597c13d831ec7' // USDT
|
|
55
|
+
* ],
|
|
56
|
+
* accountAddresses: ['0x123...']
|
|
57
|
+
* }
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* return balances?.map(balance => (
|
|
61
|
+
* <div key={balance.contractAddress}>
|
|
62
|
+
* {balance.contractInfo?.symbol}: {balance.balance}
|
|
63
|
+
* </div>
|
|
64
|
+
* ))
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
16
67
|
*/
|
|
17
68
|
export const useGetTokenBalancesByContract = (getTokenBalancesByContractArgs, options) => {
|
|
18
69
|
const indexerGatewayClient = useIndexerGatewayClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTokenBalancesByContract.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesByContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,0BAA0B,GAAG,KAAK,EACtC,oBAA4C,EAC5C,8BAA6E,EAC7E,gBAAyB,EACA,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,0BAA0B,CAAC,8BAA8B,CAAC,CAAA;IAEjG,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AACzD,CAAC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"useGetTokenBalancesByContract.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesByContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,0BAA0B,GAAG,KAAK,EACtC,oBAA4C,EAC5C,8BAA6E,EAC7E,gBAAyB,EACA,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,0BAA0B,CAAC,8BAA8B,CAAC,CAAA;IAEjG,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AACzD,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,8BAA6E,EAC7E,OAA4B,EAC5B,EAAE;IACF,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAA;IAEtD,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,6BAA6B,EAAE,8BAA8B,EAAE,OAAO,CAAC;QAC7F,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,MAAM,0BAA0B,CACrC,oBAAoB,EACpB,8BAA8B,EAC9B,OAAO,EAAE,gBAAgB,IAAI,KAAK,CACnC,CAAA;QACH,CAAC;QACD,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,EAAE;QAC9B,OAAO,EAAE,CAAC,CAAC,8BAA8B,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ;KAC7F,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,7 +1,96 @@
|
|
|
1
1
|
import { IndexerGateway, TokenBalance } from '@0xsequence/indexer';
|
|
2
2
|
import { BalanceHookOptions } from '../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Hook to fetch detailed token balances including individual token metadata.
|
|
5
|
+
*
|
|
6
|
+
* Key differences from other balance hooks:
|
|
7
|
+
* - useGetTokenBalancesSummary: Returns basic token info, faster but less detailed
|
|
8
|
+
* - useGetTokenBalancesByContract: Only fetches specific contracts
|
|
9
|
+
* - useGetSingleTokenBalanceSummary: Fetches a single token balance
|
|
10
|
+
*
|
|
11
|
+
* This hook is best used when you need full token details, especially for NFTs and collectibles
|
|
12
|
+
* where metadata is important (images, attributes, etc).
|
|
13
|
+
* Results are sorted by type: native tokens first, then ERC20s, then collectibles.
|
|
14
|
+
*
|
|
15
|
+
* @param getTokenBalancesDetailsArgs - Arguments for fetching token balances
|
|
16
|
+
* @param getTokenBalancesDetailsArgs.chainIds - Array of chain IDs to fetch balances from
|
|
17
|
+
* @param getTokenBalancesDetailsArgs.filter - Filter criteria for the query
|
|
18
|
+
* @param getTokenBalancesDetailsArgs.filter.accountAddresses - List of account addresses to fetch balances for
|
|
19
|
+
* @param getTokenBalancesDetailsArgs.filter.contractWhitelist - Optional list of contracts to include
|
|
20
|
+
* @param getTokenBalancesDetailsArgs.filter.contractBlacklist - Optional list of contracts to exclude
|
|
21
|
+
* @param getTokenBalancesDetailsArgs.filter.omitNativeBalances - If true, excludes native token balances
|
|
22
|
+
* @param getTokenBalancesDetailsArgs.filter.contractStatus - Optional filter for contract verification status
|
|
23
|
+
* @param options - Optional configuration for the query behavior
|
|
24
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens
|
|
25
|
+
* @param options.disabled - If true, disables the query from automatically running
|
|
26
|
+
* @param options.retry - If true (default), retries failed queries
|
|
27
|
+
*
|
|
28
|
+
* Query configuration:
|
|
29
|
+
* - Marks data as stale after 30 seconds
|
|
30
|
+
* - Retries failed requests by default
|
|
31
|
+
* - Only enabled when account address is present and not explicitly disabled
|
|
32
|
+
*
|
|
33
|
+
* @returns Query result containing an array of TokenBalance objects with detailed information:
|
|
34
|
+
* - `contractType`: Type of the token contract (NATIVE, ERC20, ERC721, ERC1155)
|
|
35
|
+
* - `contractAddress`: Address of the token contract
|
|
36
|
+
* - `accountAddress`: Address of the account holding the tokens
|
|
37
|
+
* - `tokenID`: (for NFTs) ID of the token
|
|
38
|
+
* - `balance`: Token balance as a string
|
|
39
|
+
* - `blockHash`: Hash of the block where this balance was last updated
|
|
40
|
+
* - `blockNumber`: Block number where this balance was last updated
|
|
41
|
+
* - `chainId`: Chain ID where the token exists
|
|
42
|
+
* - `contractInfo`: Additional token contract information including:
|
|
43
|
+
* - `name`: Token name
|
|
44
|
+
* - `symbol`: Token symbol
|
|
45
|
+
* - `decimals`: Number of decimals
|
|
46
|
+
* - `logoURI`: URL of the token logo
|
|
47
|
+
* - `tokenMetadata`: (for NFTs) Detailed token metadata including:
|
|
48
|
+
* - `name`: Token name
|
|
49
|
+
* - `description`: Token description
|
|
50
|
+
* - `image`: Token image URL
|
|
51
|
+
* - `attributes`: Array of token attributes
|
|
52
|
+
*
|
|
53
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetTokenBalancesDetails} for more detailed documentation.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { useGetTokenBalancesDetails } from '@0xsequence/hooks'
|
|
58
|
+
*
|
|
59
|
+
* // Fetch all token balances with full details
|
|
60
|
+
* function TokenList() {
|
|
61
|
+
* const { data: tokens } = useGetTokenBalancesDetails({
|
|
62
|
+
* chainIds: [1], // Ethereum mainnet
|
|
63
|
+
* filter: {
|
|
64
|
+
* accountAddresses: ['0x123...'],
|
|
65
|
+
* omitNativeBalances: false,
|
|
66
|
+
* // Optional: only include specific tokens
|
|
67
|
+
* contractWhitelist: ['0x...', '0x...'],
|
|
68
|
+
* // Optional: exclude specific tokens
|
|
69
|
+
* contractBlacklist: ['0x...']
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* return tokens?.map(token => (
|
|
74
|
+
* <div key={`${token.chainId}-${token.contractAddress}-${token.tokenID}`}>
|
|
75
|
+
* {token.contractType === 'ERC721' ? (
|
|
76
|
+
* // NFT display with metadata
|
|
77
|
+
* <NFTCard
|
|
78
|
+
* name={token.tokenMetadata?.name}
|
|
79
|
+
* image={token.tokenMetadata?.image}
|
|
80
|
+
* attributes={token.tokenMetadata?.attributes}
|
|
81
|
+
* />
|
|
82
|
+
* ) : (
|
|
83
|
+
* // Regular token display
|
|
84
|
+
* <TokenRow
|
|
85
|
+
* symbol={token.contractInfo?.symbol}
|
|
86
|
+
* balance={token.balance}
|
|
87
|
+
* decimals={token.contractInfo?.decimals}
|
|
88
|
+
* />
|
|
89
|
+
* )}
|
|
90
|
+
* </div>
|
|
91
|
+
* ))
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
5
94
|
*/
|
|
6
95
|
export declare const useGetTokenBalancesDetails: (getTokenBalancesDetailsArgs: IndexerGateway.GetTokenBalancesDetailsArgs, options?: BalanceHookOptions) => import("@tanstack/react-query").UseQueryResult<TokenBalance[], Error>;
|
|
7
96
|
//# sourceMappingURL=useGetTokenBalancesDetails.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTokenBalancesDetails.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAqChD
|
|
1
|
+
{"version":3,"file":"useGetTokenBalancesDetails.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAqChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,eAAO,MAAM,0BAA0B,GACrC,6BAA6B,cAAc,CAAC,2BAA2B,EACvE,UAAU,kBAAkB,0EAa7B,CAAA"}
|
|
@@ -21,7 +21,96 @@ const getTokenBalancesDetails = async (getTokenBalancesDetailsArgs, indexerGatew
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Hook to fetch detailed token balances including individual token metadata.
|
|
25
|
+
*
|
|
26
|
+
* Key differences from other balance hooks:
|
|
27
|
+
* - useGetTokenBalancesSummary: Returns basic token info, faster but less detailed
|
|
28
|
+
* - useGetTokenBalancesByContract: Only fetches specific contracts
|
|
29
|
+
* - useGetSingleTokenBalanceSummary: Fetches a single token balance
|
|
30
|
+
*
|
|
31
|
+
* This hook is best used when you need full token details, especially for NFTs and collectibles
|
|
32
|
+
* where metadata is important (images, attributes, etc).
|
|
33
|
+
* Results are sorted by type: native tokens first, then ERC20s, then collectibles.
|
|
34
|
+
*
|
|
35
|
+
* @param getTokenBalancesDetailsArgs - Arguments for fetching token balances
|
|
36
|
+
* @param getTokenBalancesDetailsArgs.chainIds - Array of chain IDs to fetch balances from
|
|
37
|
+
* @param getTokenBalancesDetailsArgs.filter - Filter criteria for the query
|
|
38
|
+
* @param getTokenBalancesDetailsArgs.filter.accountAddresses - List of account addresses to fetch balances for
|
|
39
|
+
* @param getTokenBalancesDetailsArgs.filter.contractWhitelist - Optional list of contracts to include
|
|
40
|
+
* @param getTokenBalancesDetailsArgs.filter.contractBlacklist - Optional list of contracts to exclude
|
|
41
|
+
* @param getTokenBalancesDetailsArgs.filter.omitNativeBalances - If true, excludes native token balances
|
|
42
|
+
* @param getTokenBalancesDetailsArgs.filter.contractStatus - Optional filter for contract verification status
|
|
43
|
+
* @param options - Optional configuration for the query behavior
|
|
44
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens
|
|
45
|
+
* @param options.disabled - If true, disables the query from automatically running
|
|
46
|
+
* @param options.retry - If true (default), retries failed queries
|
|
47
|
+
*
|
|
48
|
+
* Query configuration:
|
|
49
|
+
* - Marks data as stale after 30 seconds
|
|
50
|
+
* - Retries failed requests by default
|
|
51
|
+
* - Only enabled when account address is present and not explicitly disabled
|
|
52
|
+
*
|
|
53
|
+
* @returns Query result containing an array of TokenBalance objects with detailed information:
|
|
54
|
+
* - `contractType`: Type of the token contract (NATIVE, ERC20, ERC721, ERC1155)
|
|
55
|
+
* - `contractAddress`: Address of the token contract
|
|
56
|
+
* - `accountAddress`: Address of the account holding the tokens
|
|
57
|
+
* - `tokenID`: (for NFTs) ID of the token
|
|
58
|
+
* - `balance`: Token balance as a string
|
|
59
|
+
* - `blockHash`: Hash of the block where this balance was last updated
|
|
60
|
+
* - `blockNumber`: Block number where this balance was last updated
|
|
61
|
+
* - `chainId`: Chain ID where the token exists
|
|
62
|
+
* - `contractInfo`: Additional token contract information including:
|
|
63
|
+
* - `name`: Token name
|
|
64
|
+
* - `symbol`: Token symbol
|
|
65
|
+
* - `decimals`: Number of decimals
|
|
66
|
+
* - `logoURI`: URL of the token logo
|
|
67
|
+
* - `tokenMetadata`: (for NFTs) Detailed token metadata including:
|
|
68
|
+
* - `name`: Token name
|
|
69
|
+
* - `description`: Token description
|
|
70
|
+
* - `image`: Token image URL
|
|
71
|
+
* - `attributes`: Array of token attributes
|
|
72
|
+
*
|
|
73
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetTokenBalancesDetails} for more detailed documentation.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* import { useGetTokenBalancesDetails } from '@0xsequence/hooks'
|
|
78
|
+
*
|
|
79
|
+
* // Fetch all token balances with full details
|
|
80
|
+
* function TokenList() {
|
|
81
|
+
* const { data: tokens } = useGetTokenBalancesDetails({
|
|
82
|
+
* chainIds: [1], // Ethereum mainnet
|
|
83
|
+
* filter: {
|
|
84
|
+
* accountAddresses: ['0x123...'],
|
|
85
|
+
* omitNativeBalances: false,
|
|
86
|
+
* // Optional: only include specific tokens
|
|
87
|
+
* contractWhitelist: ['0x...', '0x...'],
|
|
88
|
+
* // Optional: exclude specific tokens
|
|
89
|
+
* contractBlacklist: ['0x...']
|
|
90
|
+
* }
|
|
91
|
+
* })
|
|
92
|
+
*
|
|
93
|
+
* return tokens?.map(token => (
|
|
94
|
+
* <div key={`${token.chainId}-${token.contractAddress}-${token.tokenID}`}>
|
|
95
|
+
* {token.contractType === 'ERC721' ? (
|
|
96
|
+
* // NFT display with metadata
|
|
97
|
+
* <NFTCard
|
|
98
|
+
* name={token.tokenMetadata?.name}
|
|
99
|
+
* image={token.tokenMetadata?.image}
|
|
100
|
+
* attributes={token.tokenMetadata?.attributes}
|
|
101
|
+
* />
|
|
102
|
+
* ) : (
|
|
103
|
+
* // Regular token display
|
|
104
|
+
* <TokenRow
|
|
105
|
+
* symbol={token.contractInfo?.symbol}
|
|
106
|
+
* balance={token.balance}
|
|
107
|
+
* decimals={token.contractInfo?.decimals}
|
|
108
|
+
* />
|
|
109
|
+
* )}
|
|
110
|
+
* </div>
|
|
111
|
+
* ))
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
25
114
|
*/
|
|
26
115
|
export const useGetTokenBalancesDetails = (getTokenBalancesDetailsArgs, options) => {
|
|
27
116
|
const indexerGatewayClient = useIndexerGatewayClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTokenBalancesDetails.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAElF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,uBAAuB,GAAG,KAAK,EACnC,2BAAuE,EACvE,oBAA4C,EAC5C,gBAAyB,EACA,EAAE;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,CAAA;QAE3F,IAAI,gBAAgB,EAAE,CAAC;YACrB,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACxC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;YACH,CAAC;QACH,CAAC;QAED,MAAM,YAAY,GAAmB,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CACnF,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAClD,wBAAwB,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,cAAc,EAAE,kBAAkB,CAAC,OAAO,CAAC,CACpH,CACF,CAAA;QAED,MAAM,MAAM,GAAmB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAEzF,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC,CAAC,CAAA;QAEvE,OAAO,CAAC,GAAG,cAAc,CAAC,YAAY,EAAE,GAAG,cAAc,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;IACxG,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"useGetTokenBalancesDetails.js","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAElF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,uBAAuB,GAAG,KAAK,EACnC,2BAAuE,EACvE,oBAA4C,EAC5C,gBAAyB,EACA,EAAE;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,CAAA;QAE3F,IAAI,gBAAgB,EAAE,CAAC;YACrB,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACxC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAChD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CACtG,CAAA;YACH,CAAC;QACH,CAAC;QAED,MAAM,YAAY,GAAmB,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CACnF,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAClD,wBAAwB,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,cAAc,EAAE,kBAAkB,CAAC,OAAO,CAAC,CACpH,CACF,CAAA;QAED,MAAM,MAAM,GAAmB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAEzF,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC,CAAC,CAAA;QAEvE,OAAO,CAAC,GAAG,cAAc,CAAC,YAAY,EAAE,GAAG,cAAc,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;IACxG,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,2BAAuE,EACvE,OAA4B,EAC5B,EAAE;IACF,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAA;IAEtD,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,0BAA0B,EAAE,2BAA2B,EAAE,OAAO,CAAC;QACvF,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,MAAM,uBAAuB,CAAC,2BAA2B,EAAE,oBAAoB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK,CAAC,CAAA;QAC7H,CAAC;QACD,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,EAAE;QAC9B,OAAO,EAAE,CAAC,CAAC,2BAA2B,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ;KACxF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,7 +1,71 @@
|
|
|
1
1
|
import { IndexerGateway, TokenBalance } from '@0xsequence/indexer';
|
|
2
2
|
import { BalanceHookOptions } from '../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Hook to fetch token balances with summarized contract information.
|
|
5
|
+
* This is a lighter version of useGetTokenBalancesDetails - it returns basic token information
|
|
6
|
+
* without detailed metadata, making it faster and more suitable for token lists and balances display.
|
|
7
|
+
* Results are sorted by type: native tokens first, then ERC20s, then collectibles.
|
|
8
|
+
*
|
|
9
|
+
* @param getTokenBalancesSummaryArgs - Arguments for fetching token balances
|
|
10
|
+
* @param getTokenBalancesSummaryArgs.chainIds - Array of chain IDs to fetch balances from
|
|
11
|
+
* @param getTokenBalancesSummaryArgs.filter - Filter criteria for the query
|
|
12
|
+
* @param getTokenBalancesSummaryArgs.filter.accountAddresses - List of account addresses to fetch balances for
|
|
13
|
+
* @param getTokenBalancesSummaryArgs.filter.contractWhitelist - Optional list of contracts to include
|
|
14
|
+
* @param getTokenBalancesSummaryArgs.filter.contractBlacklist - Optional list of contracts to exclude
|
|
15
|
+
* @param getTokenBalancesSummaryArgs.filter.omitNativeBalances - If true, excludes native token balances
|
|
16
|
+
* @param getTokenBalancesSummaryArgs.filter.contractStatus - Optional filter for contract verification status
|
|
17
|
+
* @param options - Optional configuration for the query behavior
|
|
18
|
+
* @param options.hideCollectibles - If true, filters out ERC721 and ERC1155 tokens
|
|
19
|
+
* @param options.disabled - If true, disables the query from automatically running
|
|
20
|
+
* @param options.retry - If true (default), retries failed queries
|
|
21
|
+
*
|
|
22
|
+
* Query configuration:
|
|
23
|
+
* - Marks data as stale after 30 seconds
|
|
24
|
+
* - Retries failed requests by default
|
|
25
|
+
* - Only enabled when account address is present and not explicitly disabled
|
|
26
|
+
*
|
|
27
|
+
* @returns Query result containing an array of TokenBalance objects with basic information:
|
|
28
|
+
* - `contractType`: Type of the token contract (NATIVE, ERC20, ERC721, ERC1155)
|
|
29
|
+
* - `contractAddress`: Address of the token contract
|
|
30
|
+
* - `accountAddress`: Address of the account holding the tokens
|
|
31
|
+
* - `balance`: Token balance as a string
|
|
32
|
+
* - `chainId`: Chain ID where the token exists
|
|
33
|
+
* - `contractInfo`: Basic token contract information including:
|
|
34
|
+
* - `name`: Token name
|
|
35
|
+
* - `symbol`: Token symbol
|
|
36
|
+
* - `decimals`: Number of decimals
|
|
37
|
+
* - `logoURI`: URL of the token logo
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://docs.sequence.xyz/sdk/web/hooks/useGetTokenBalancesSummary} for more detailed documentation.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* import { useGetTokenBalancesSummary } from '@0xsequence/hooks'
|
|
44
|
+
*
|
|
45
|
+
* // Fetch token balances for a wallet
|
|
46
|
+
* function TokenBalances() {
|
|
47
|
+
* const { data: tokens } = useGetTokenBalancesSummary({
|
|
48
|
+
* chainIds: [1, 137], // Ethereum and Polygon
|
|
49
|
+
* filter: {
|
|
50
|
+
* accountAddresses: ['0x123...'],
|
|
51
|
+
* omitNativeBalances: false,
|
|
52
|
+
* // Optional: filter specific tokens
|
|
53
|
+
* contractWhitelist: ['0x...', '0x...']
|
|
54
|
+
* }
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* return tokens?.map(token => (
|
|
58
|
+
* <div key={`${token.chainId}-${token.contractAddress}`}>
|
|
59
|
+
* <TokenRow
|
|
60
|
+
* symbol={token.contractInfo?.symbol}
|
|
61
|
+
* balance={token.balance}
|
|
62
|
+
* decimals={token.contractInfo?.decimals}
|
|
63
|
+
* logoURI={token.contractInfo?.logoURI}
|
|
64
|
+
* />
|
|
65
|
+
* </div>
|
|
66
|
+
* ))
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
5
69
|
*/
|
|
6
70
|
export declare const useGetTokenBalancesSummary: (getTokenBalancesSummaryArgs: IndexerGateway.GetTokenBalancesSummaryArgs, options?: BalanceHookOptions) => import("@tanstack/react-query").UseQueryResult<TokenBalance[], Error>;
|
|
7
71
|
//# sourceMappingURL=useGetTokenBalancesSummary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTokenBalancesSummary.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAqChD
|
|
1
|
+
{"version":3,"file":"useGetTokenBalancesSummary.d.ts","sourceRoot":"","sources":["../../../../src/hooks/IndexerGateway/useGetTokenBalancesSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAqChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,eAAO,MAAM,0BAA0B,GACrC,6BAA6B,cAAc,CAAC,2BAA2B,EACvE,UAAU,kBAAkB,0EAa7B,CAAA"}
|