I am creating a website using the metamask ethereum API. But for some reason, I am getting this error on line 8:
const provider = await detectEthereumProvider();
The thing is that I copied this code straight from the API website, so I don't know why it is recieving an error
https://docs.metamask.io/guide/ethereum-provider.html#using-the-provider
Can anyone help? Thanks
The await keyword must be called within an async function:
async function main()
{
// Place your code here.
}
// Then, call that async function that wraps your code:
main();