From 3d60565e727c0123c9fb75cf9a0a3f2058eb6b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Tue, 8 Aug 2023 14:38:50 +0200 Subject: [PATCH] Rename parameters in FeeHistory funciton to reflect the semantic --- jsonrpc/eth.go | 4 ++-- jsonrpc/eth_test.go | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/jsonrpc/eth.go b/jsonrpc/eth.go index 82afde3d..034d5b6c 100644 --- a/jsonrpc/eth.go +++ b/jsonrpc/eth.go @@ -266,9 +266,9 @@ func (f *FeeHistory) UnmarshalJSON(data []byte) error { } // FeeHistory returns base fee per gas and transaction effective priority fee -func (e *Eth) FeeHistory(from, to ethgo.BlockNumber) (*FeeHistory, error) { +func (e *Eth) FeeHistory(blockCount uint64, newestBlock ethgo.BlockNumber) (*FeeHistory, error) { var out *FeeHistory - if err := e.c.Call("eth_feeHistory", &out, from.String(), to.String(), nil); err != nil { + if err := e.c.Call("eth_feeHistory", &out, blockCount, newestBlock.String(), nil); err != nil { return nil, err } return out, nil diff --git a/jsonrpc/eth_test.go b/jsonrpc/eth_test.go index 4dfee806..6bd9910b 100644 --- a/jsonrpc/eth_test.go +++ b/jsonrpc/eth_test.go @@ -394,10 +394,7 @@ func TestEthFeeHistory(t *testing.T) { lastBlock, err := c.Eth().BlockNumber() assert.NoError(t, err) - from := ethgo.BlockNumber(lastBlock - 2) - to := ethgo.BlockNumber(lastBlock) - - fee, err := c.Eth().FeeHistory(from, to) + fee, err := c.Eth().FeeHistory(1, ethgo.BlockNumber(lastBlock)) assert.NoError(t, err) assert.NotNil(t, fee) } @@ -424,7 +421,7 @@ func TestEthMaxPriorityFeePerGas(t *testing.T) { latestBlock, err := c.Eth().BlockNumber() require.NoError(t, err) - feeHistory, err := c.Eth().FeeHistory(ethgo.BlockNumber(latestBlock-1), ethgo.BlockNumber(latestBlock)) + feeHistory, err := c.Eth().FeeHistory(1, ethgo.BlockNumber(latestBlock)) require.NoError(t, err) latestBaseFee := feeHistory.BaseFee[len(feeHistory.BaseFee)-1]