I am running VisualStudio Code, Sanity Studio, and Thirdweb
When I inspect the element on localhost:3000, I am able to see the array of my imported tokens on Sanity, but NOT on Thirdweb.
Here is a snippet of my code:
const sdk = new ThirdwebSDK(
new ethers.Wallet(
process.env.NEXT_PUBLIC_METAMASK_KEY,
ethers.getDefaultProvider('https://rinkeby_xyz),
),
)
const Portfolio = () => {
const[sanityTokens, setSanityTokens] = useState([])
const[thirdWebTokens, setThirdWebTokens] = useState([])
useEffect (() => {
const getSanityAndThirdWebTokens = async () => {
const coins = await fetch("https://xyz"
)
const sanityTokens = (await coins.json()).result
setSanityTokens(sanityTokens)
setThirdWebTokens(
sanityTokens.map(token => sdk.getTokenModule(token.contractAddress))
)
}
return getSanityAndThirdWebTokens()
}, [])
console.log('Sanity', sanityTokens)
console.log('Thirdweb', thirdWebTokens)
Error Message: Unhandled Runtime Error TypeError: sdk.getTokenModule is not a function
How do I get the ThirdWeb array to show up?
A lot has changed with thirdwebSDK. getTokenModule is no longer a valid function as of this time, instead try
sdk.getToken(token.contractAddress)
in the part of the code where you havesdk.getTokenModule(token.contractAddress)