I'm using a combination of Thirdweb and Alchemy SDK to fetch all nfts in a connected wallet. Every example I've come across for Alchemy's getNftsForOwner function has the wallet address placed in the function like so:
const NFTs = await alchemy.nft.getNftsForOwner("0x0000");
I'm trying to figure out how to use the connected wallet in the function. I use Thirdweb's connect wallet and useAddress hook to get the address but I don't have to go that route if there is a better way to make it work.
My current setup is:
const router = useRouter();
const { walletAddress } = router.query;
const [NFTs, setNFTs] = useState<OwnedNftsResponse>()
const address = useAddress();
useEffect( () => {
async function grabber() {
const NFTs = await alchemy.nft.getNftsForOwner(???);
setNFTs(NFTs);
}
grabber();
}, [NFTs]);
Every attempt I've tried to use the connected wallet address resulted in Error: 400: owner is a required request parameter