I have been trying to send a transaction using an RPC call with MetaMask's window.ethereum.request injected method.
I have successfully sent a transaction before, by using the web3js method web3.eth.sendTransaction with MetaMask displaying the intended amount of ether. For the conversion from ether to wei I'm using web3.utils.toWei("3", "ether).
However, when I try to send a transaction using an RPC call, the MetaMask pop-up displays an incorrect amount of ether to be sent. The accounts used below are provided by Ganache. The sender address belongs to the account I have successfully connected to my app using MetaMask.
I am using Ganache as a local network and Firefox on Ubuntu. This is the code used to make the call:
const myParameters = {
from: "0x5c0bC92f7d26F7AD821408e2B1774FC96858C691",
to: "0x6cC5550509CC3a66Df97Efa42B866A058e12ADE2",
value: web3.utils.toWei("3", "ether")
};
let results = await window.ethereum.request({method:"eth_sendTransaction", params: [myParameters]});
I have also tried converting the value to string, but I get the same wrong amount. Here's the pop-up I get for the above code: