in my react app i want to use alchemy/someother-provider RPC and i want to use metamask as singer ( window.ethereum )
how to i set that ?
my current code :
var provider = new ethers.providers.JsonRpcProvider (RPCURL); var contract = new ethers.Contract(CONTRACT_ADDRESS, NEWABI, provider); var contractsinger = new ethers.Contract(CONTRACT_ADDRESS, NEWABI, provider);
after conecting to metamask the "contractsinger" becomes :
var providerforsinger = new ethers.providers.Web3Provider(window.ethereum, "any");
signer = providerforsinger.getSigner();
contractsinger = new ethers.Contract(CONTRACT_ADDRESS, NEWABI, signer);