Documentation Index
Fetch the complete documentation index at: https://docs.sequence.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Parameters
| Name | Type | Description |
|---|
args | | Configuration for inventory fetching |
args | | .accountAddress - The wallet address to fetch inventory for |
args | | .collectionAddress - The collection contract address |
args | | .chainId - The blockchain network ID |
args | | .query - Optional query configuration |
args | | .query.enabled - Whether to enable the query (default: true) |
Returns
returns.isFetchingNextPage - True while fetching next page
Example
Basic usage with pagination:
const {
data,
fetchNextPage,
hasNextPage,
isLoading
} = useInventory({
accountAddress: '0x...',
collectionAddress: '0x...',
chainId: 137
});
const allCollectibles = data?.pages.flatMap(page => page.collectibles) ?? [];
return (
<div>
{allCollectibles.map(item => (
<CollectibleCard
key={item.metadata.tokenId}
metadata={item.metadata}
balance={item.balance}
/>
))}
{hasNextPage && (
<button onClick={() => fetchNextPage()}>
Load More
</button>
)}
</div>
);
With filtering and balance display:
const { data } = useInventory({
accountAddress: userAddress,
collectionAddress: collection.address,
chainId: collection.chainId,
query: {
enabled: !!userAddress && isConnected
}
});
// Get all items across pages
const inventory = data?.pages.flatMap(p => p.collectibles) ?? [];
// Show ERC1155 balances
inventory.forEach(item => {
if (item.contractType === ContractType.ERC1155) {
console.log(`Token ${item.metadata.tokenId}: ${item.balance} owned`);
}
});
Basic Usage
import { useInventory } from '@0xsequence/marketplace-sdk/react/hooks';
const result = useInventory({
// Add your parameters here
});