I'm trying to get the balance of my wallet address to render on my frontend. Here's what I have so far.
const [balance, setBalance] = useState("");
const handleWalletBalance = async () => {
const { ethereum } = window;
if(ethereum) {
const balance = await ethereum.request({method: 'eth_getBalance'})
const provider = new ethers.providers.Web3Provider(ethereum)
await provider.getBalance(balance)
setBalance(balance)
console.log(balance)
}
}
The error I'm getting is MetaMask - RPC Error: missing value for required argument 0
.
I'm using a method for querying accounts. What am I missing?