what is returned using getGasPrice after EIP-1559 ? Is it the total average Base+Tip value or just one or the other?
Something similar to pre EIP-1559 for backward compatibility : The base fee + a gas tip estimation, this value is directly usable for legacy transactions.
You can see the go-ethereum implementation of the RPC here where the base fee is explicitely added to a gasTipCap estimation.
You can also see it for yourself by running the following web3 code on mainnet:
const gasPrice = await web3.eth.getGasPrice();
console.log(web3.utils.fromWei(gasPrice, "Gwei"));
// Displays : 30.38 at the time of writing
// Which at block 14448993 is around 25 Gwei of base fee + 5 Gwei of gas tip cap.
I hope that answers your question.
For the error mentioned in the comments : given the code I linked, you may encounter an error as metioned in the comments if the current header cannot be accessed by your provider for any reason :
if head := s.b.CurrentHeader(); head.BaseFee != nil {
tipcap.Add(tipcap, head.BaseFee)
}
As it would bypass the addition of the baseFee and probably result in a gasPrice lower than the baseFee itself leading to the rejection of your tx. That's just an idea.
eth.getGasPrice()
function. Now suddenly I'm starting to see the following errors: max fee per gas less than block base fee: address {address}, maxFeePerGas: 5000000000 baseFee: 27318189081 (supplied gas 4014405)