From 7b19973f916718e98455570280da693a0ddc9490 Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 4 Jan 2023 15:48:40 -0600 Subject: [PATCH] eth_estimateGas fallthrough --- pkg/eth/api.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/eth/api.go b/pkg/eth/api.go index 44a9763b..991936fd 100644 --- a/pkg/eth/api.go +++ b/pkg/eth/api.go @@ -522,6 +522,19 @@ func (pea *PublicEthAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalO return nil, RequiresProxyError{method: "eth_feeHistory"} } +// EstimateGas returns an estimate of the amount of gas needed to execute the +// given transaction against the current pending block. +func (pea *PublicEthAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) { + if pea.proxyOnError { + var res hexutil.Uint64 + if err := pea.rpc.CallContext(ctx, &res, "eth_estimateGas", args, blockNrOrHash); err != nil { + return hexutil.Uint64(0), err + } + return res, nil + } + return hexutil.Uint64(0), RequiresProxyError{method: "eth_estimateGas"} +} + /* Receipts and Logs