0

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

1 Answer 1

0

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' });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.