I am trying to send a transaction quickly by adding a priority fee that is half the base fee with the following logic:
const { baseFeePerGas } = await client.getBlock();
const priorityFee = baseFeePerGas / 2n;
const hash = await wallet.writeContract({
account,
address,
abi,
functionName,
args,
maxPriorityFeePerGas: priorityFee,
maxFeePerGas: baseFeePerGas + priorityFee,
});
When I go to use this it throws an error which states I was trying to provide over 13 ETH worth of wei to the transaction but 9 gwei for the priority fee and 28 gwei for the max fee seems what I would expect it to be.
Insufficient funds for gas * price + value: address 0x035342Fb880F46A9F58343774F131Bf6f6757007 have 77717615752227236 want 13418145387500000000 (supplied gas 500000000)
Contract Call:
maxPriorityFeePerGas: 8.945430258 gwei
maxFeePerGas: 26.836290775 gwei
data: 0x3eb76b9c000000000000000000000000000000000000000000000000000000000000013f
to: 0xBE5E6De0d0Ac82b087bAaA1d53F145a52EfE1642
from: 0x035342Fb880F46A9F58343774F131Bf6f6757007
Shouldn't the max gas used be no more than 26836290775 wei (26.836 gwei) in this scenario? Where does the 13418145387500000000 wei come from?