I just deployed the most simple NFT contract on the polygon mainnet at "0xda528AccACF4eec33EF21c6078273eBfe52609df". I can mint some token using Alchemy as a web3 provider and I do it in a simple Nodejs app.
Now, I wanted to use an independant Angular app to check if the user own one or more token with Metamask as a web3 provider. I get the provider from window.ethereum after I check that the user is connected to the polygon chain with his Metamask. Whenever I try to call a web3 method such as :
const contract = new this.web3.eth.Contract(HuntingJSON.abi, "0xda528AccACF4eec33EF21c6078273eBfe52609df");
const name = await contract.methods.name().call(function(data: any,error: any) {
console.log(data);
console.log(error);
});
I get this kind of error : Uncaught (in promise): TypeError: process.nextTick is not a function
Is it possible to call a contract with a Metamask provider ? I imagined method such as ownerOf(), owner() or name() wouldn't need a sendTransaction, am I wrong ?
On the other side, I can successfully call the JSON RPC API from Metamask or Ethereum such as :
window.ethereum.request({method: 'eth_requestAccounts'});
Is there a way to check if a user owns a NFT tokenID with Metamask as a provider ? And how ?
Thank you!