Web3 error: The method eth_sendTransaction does not exist/is not available (Ropsten)


I created a simple erc20 token on remix. When a call the approve function in web3 js i’m getting error “The method eth_sendTransaction does not exist/is not available”.

The approve function works well on remix. Compiler version 0.8.0,

pragma solidity >=0.7.0 <0.9.0;

import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;
import “@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol”;

contract SimpleToken is ERC20, ERC20Burnable {

constructor () ERC20("SimpleToken", "Sim") {
    _mint(msg.sender, 1000000000 * (10 ** uint256(decimals())));


My js code looks like below

Web3Connect: async () => {
        try {
            const provider = await App.Provider()
            if (provider) {
                App.web3 = new Web3(provider)
            } else {
                App.web3 = new Web3(new Web3.providers.HttpProvider(App.infuraNetwork + App.infuraToken))
        } catch (error) {
            alert("Enable to access to Metamask")
  Provider: async () => {
        const {
        } = window
        if (ethereum) {
            try {
                await ethereum.enable()
                return ethereum
            } catch (error) {
        //legacy provider
        const {
        } = window
        if (web3 && web3.currentProvider) {
            return web3.currentProvider

        return null

----approve code
await token.methods.approve(
).send({ from: account })

I tried using the latest version of web3 js still got the same error. I’m using ropsten infura

Any help would be appreciated

You will need to connect first to a wallet that can Send Transaction.

You may have skipped the provider step?

You’ll need to first get some accounts like so

var accountsFromMetaMask = await window.ethereum.send('eth_requestAccounts');

Read some web3js tutorials


Sorry didn’t mentioned that I have already done the provider step. I will edit post now

Please post the full code. I don’t see the step where you get the ABI. You will need to get the contract’s ABI first before you can use its function. Otherwise the code will not know what to do.

Please use proper post formatting. Use ``` for code blocks.

I got it working now. I found out the issue was due to Metamask deprecated function.