import { ethers } from "ethers" ; import { NETWORK_ID , RPC_URL , ZORB_CONTRACT } from "./env-vars" ; const Contract = new ethers . Contract ( ZORB_CONTRACT , [ "function ownerOf(uint256 tokenId) view returns (address)" , "function zorbForAddress(address user) view returns (string)" , "function getZorbRenderAddress(uint256 tokenId) view returns (address)" , ] ) ; export async function getTokenInfo ( tokenId ) { const provider = new ethers . providers . JsonRpcBatchProvider ( RPC_URL , parseInt ( NETWORK_ID || "4" ) ) ; const connectedContract = Contract . connect ( provider ) ; const ownerAddress = await connectedContract . ownerOf ( tokenId ) ; const renderAddress = await connectedContract . getZorbRenderAddress ( tokenId ) ; const zorbImage = await connectedContract . zorbForAddress ( renderAddress ) ; return { ownerAddress , zorbImage } ; }