Script
Script
document.getElementById('ethForm').addEventListener('submit', async
function (e) {
e.preventDefault();
const recipientAddress =
document.getElementById('recipientAddress').value;
const amountEth = document.getElementById('amountEth').value;
const gasPriceGwei = document.getElementById('gasPrice').value;
const gasLimit = document.getElementById('gasLimit').value;
if (!valid) return;
try {
const amountInWei = web3.utils.toWei(amountEth, 'ether');
const nonce = await web3.eth.getTransactionCount(senderAddress);
const transaction = {
to: recipientAddress,
value: amountInWei,
gasPrice: web3.utils.toWei(gasPriceGwei, 'gwei'),
gas: gasLimit,
nonce: nonce,
chainId: 1
};
function resetFeedback() {
document.getElementById('recipientAddressFeedback').textContent = '';
document.getElementById('amountEthFeedback').textContent = '';
document.getElementById('gasPriceFeedback').textContent = '';
document.getElementById('gasLimitFeedback').textContent = '';
}
function displayTransactionStatus(message) {
const statusBox = document.getElementById('transactionStatus');
document.getElementById('transactionMessage').innerHTML = message;
statusBox.classList.remove('hide');
statusBox.classList.add('fancy-box');
}
</html>