From 888bb671750a404740a22b28c4130688dde2cf6a Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 9 Dec 2021 15:47:30 +0800 Subject: [PATCH] add effectiveGasPrice to tx receipt --- rpc/ethereum/namespaces/eth/api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpc/ethereum/namespaces/eth/api.go b/rpc/ethereum/namespaces/eth/api.go index d0a230e2b0..3b4d3af943 100644 --- a/rpc/ethereum/namespaces/eth/api.go +++ b/rpc/ethereum/namespaces/eth/api.go @@ -843,6 +843,14 @@ func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (map[string]interfac receipt["contractAddress"] = crypto.CreateAddress(from, txData.GetNonce()) } + if dynamicTx, ok := txData.(*evmtypes.DynamicFeeTx); ok { + baseFee, err := e.backend.BaseFee(res.Height) + if err != nil { + return nil, err + } + receipt["effectiveGasPrice"] = hexutil.Big(*dynamicTx.GetEffectiveGasPrice(baseFee)) + } + return receipt, nil }