useOwnedNFTs

Hook for accessing a list of NFTs owned by a single wallet address.

Available to use on smart contracts that implement either ERC721Enumerable, ERC1155Enumerable, or ERC721Supply extensions.

Example

import {
useOwnedNFTs,
useContract,
useAddress,
} from "@thirdweb-dev/react";
function App() {
const address = useAddress();
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useOwnedNFTs(contract, address);
}
function useOwnedNFTs(
contract: RequiredParam<TContract>,
ownerWalletAddress: RequiredParam<string>,
queryParams?: {},
): UseQueryResult<Array<NFT>, unknown>;

Parameters

Instance of a NFTContract

Type

let contract: RequiredParam<TContract>;

The wallet address to get owned tokens for. Likely, you will want to view the connected wallet’s NFTs. use the useAddress hook to get this value.

Type

let ownerWalletAddress: RequiredParam<string>;

Paginate the results by providing a queryParams object as an argument.

import { useOwnedNFTs, useContract, useAddress } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const address = useAddress();
const { data, isLoading, error } = useOwnedNFTs(
contract,
address
{
count: 10, // Limit the number of results
start: 0, // Start from the nth result (useful for pagination)
},
);
}

Returns

let returnType: UseQueryResult<Array<NFT>, unknown>;

Query result object that includes the list of owned NFT objects