I am using React, to interact with a smart contract deployed on local Ganache, I can approve allowances to accounts generated by Ganache, but I can't approve allowance with Metamask accounts which aren't.
await tokenContract.methods.approve(farmContractAddress, amount).call({ from: userAccount })
Using this, I tried using:
window.ethereum
.request({
method: 'wallet_requestPermissions',
params: [{
eth_accounts: {
requiredMethods: ['signTypedData_v3']
}
}],
})
but I don't understand which methods can be added in the requiredMethods
param, to require the user to 'Approve' them.
PS: I am a beginner. Thank you
Best Answer
On a personal project I made on react also using Metamask I used
eth_requestAccounts
like this, as you can see in my code:await window.ethereum.request({ method: 'eth_requestAccounts' });