// Initialize providerimport Fortmatic from'fortmatic';import Web3 from'web3';constfm=newFortmatic('YOUR_API_KEY');window.web3 =newWeb3(fm.getProvider());consttoAddress='0xb159752065EA68Ef0B22249Df25864E624fec45D';constsendValue=web3.utils.toWei(1,'ether'); // Convert 1 ether to wei// Get user account wallet address firstweb3.eth.getAccounts().then((accounts) => {// Construct Ether transaction paramsconsttxnParams= { from: accounts[0], to: toAddress, value: sendValue }// Send Ether transaction with web3web3.eth.sendTransaction(txnParams).once('transactionHash', (hash) => { console.log(hash); }).once('receipt', (receipt) => { console.log(receipt); });});
Custom Gas Price
Fortmatic provides the option to offer a customized gas price. If provided, it will be shown as a suggested option in the delivery fee section. One parameter addition to include a customized gas price should suffice. Gas limit is optional, if not provided, Fortmatic will smartly estimate the gas limit for the transaction!
consttxnParams= { from: accounts[0], to: toAddress, value: sendValue, gasPrice:'0x2540be400',// Include your own gas price here.}