Skip to content

Commit

Permalink
Rename parameters in FeeHistory funciton to reflect the semantic
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Aug 8, 2023
1 parent 5f4cedb commit 3d60565
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions jsonrpc/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions jsonrpc/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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]
Expand Down

0 comments on commit 3d60565

Please sign in to comment.