Search code examples
reactjsblockchainmetamaskethers.jsganache

inpage.js:1 MetaMask - RPC Error: Invalid parameters: must provide an Ethereum address


I'm facing an issue when I try to transfer ether from one account to another account. For now I'm using ganache locally and import ganache wallets into metamask. `

let unformatEther = ethers.utils.parseEther("1");
      const account = await window.ethereum.request({
        method: "eth_accounts",
      });
      console.log(account[0])
      let sendEth = await window.ethereum.request({
        method: "eth_sendTransaction",
        params: [
          {
            form: account[0],
            to: "0x2972E7f02dA9f5078D37E126C6bEEFA883B3819C",
            gasPrice: "0x09184e72a000",
            gas: "0x2710",
            value: unformatEther._hex,
          },
        ],
      });

`

There I'm getting the error into my console that is enter image description here

I search everything on google, read metamask documentation here

Also add address manually on from key but not resolved this one.


Solution

  • you have typo here

    form: account[0],
    

    should be

    from: account[0],