Here are some typos to fix:
- Capital C while calling
contract
function.
var transferEth = new window.web3.eth.Contract(transferEthABI, transferEthAddress);
- It is web3.utils instead of web3js.utils:
transferEth.methods.sendEth().send({from: web3.eth.accounts[0], value: web3.utils.toWei("0.001","ether")});
Lastly, almost all functions from web3 are asynchronous and returning promise, so do not forget to write callback or use async/await syntax.
async function sendEth() {
var transferEthAddress = "0x0152E36df4fB7587b035fbF5c02A059A0B3b9c38";
var transferEth = await new window.web3.eth.Contract(transferEthABI, transferEthAddress);
console.log(transferETH);
await transferEth.methods.sendEth().send({from: web3.eth.accounts[0], value: web3jsweb3.utils.toWei("0.001","ether")});
}
Also show me the console.log.
I hope it will work, try and let me know if did not work. Thanks