I have deployed my NFT and marketplace smart contracts on Mumbai Testnet chain. When I interact with the smart contract using my Mumbai testnet account everything works fine. But when I use any other network account like rinkeby to mint an NFT through the contract it gets reverted for public read-only functions.
Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="tokenCount()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.6.2)
Here is my contract:
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract NFT is ERC721URIStorage {
uint public tokenCount;
constructor() ERC721("DApp NFT", "DAPP"){}
function mint(string memory _tokenURI) external returns(uint) {
tokenCount ++;
_safeMint(msg.sender, tokenCount);
_setTokenURI(tokenCount, _tokenURI);
return(tokenCount);
}
}
the mint() function works regardless of the network been connected while tokenCount() works only when I am connected to mumbai testnet
Should I deploy my contracts to rinkeby network chain as well and interact with that contract in case a user has connected his rinkeby network account for minting an NFT or there is any other way for doing so?