4

I am trying to get MetaMask to popup to approve a dapp to use my erc20 tokens like:

const provider = new ethers.providers.JsonRpcProvider(url); // url === bsc testnet rpc
const erco20Contract = new ethers.Contract(
    erco20ContractAddress,
    erc20Abi,
    provider.getSigner(metamaskAddress)
);
await erco20Contract.approve(dappContractAddress, amount);

This code used to work in the past (2 or 3 months ago). Now when I call this same code I get

processing response error (body="{"jsonrpc":"2.0","id":51,"error":{"code":-32000,"message":"unknown account"}}\n", error={"code":-32000}, requestBody="{"method":"eth_sendTransaction","params":[{"gas":"0xac9f","from":"<my_metamask_address>","to":"<dapp_address>","data":"0x095ea7b300000000000000000000000078c18d3d5f86c9e3e14c13b8065018acd0d76c11000000000000000000000000000000000000000000000000016345785d8a0000"}],"id":51,"jsonrpc":"2.0"}", requestMethod="POST", url="https://data-seed-prebsc-1-s1.binance.org:8545/", code=SERVER_ERROR, version=web/5.7.0)

I'm now noticing part of the error message says code=SERVER_ERROR, so did Binance change something on their end?

Could it be that MetaMask or ethers updated with breaking changes? I literally have no idea what to do. Please help!

sdfsdf
  • 5,052
  • 9
  • 42
  • 75

0 Answers0