ethclient: add BlobBaseFee method (#31290)
This commit is contained in:
parent
d2bbde2f2d
commit
31c972febf
|
@ -598,6 +598,15 @@ func (ec *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
|||
return (*big.Int)(&hex), nil
|
||||
}
|
||||
|
||||
// BlobBaseFee retrieves the current blob base fee.
|
||||
func (ec *Client) BlobBaseFee(ctx context.Context) (*big.Int, error) {
|
||||
var hex hexutil.Big
|
||||
if err := ec.c.CallContext(ctx, &hex, "eth_blobBaseFee"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*big.Int)(&hex), nil
|
||||
}
|
||||
|
||||
type feeHistoryResultMarshaling struct {
|
||||
OldestBlock *hexutil.Big `json:"oldestBlock"`
|
||||
Reward [][]*hexutil.Big `json:"reward,omitempty"`
|
||||
|
|
|
@ -404,6 +404,15 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
|
|||
t.Fatalf("unexpected gas tip cap: %v", gasTipCap)
|
||||
}
|
||||
|
||||
// BlobBaseFee
|
||||
blobBaseFee, err := ec.BlobBaseFee(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if blobBaseFee.Cmp(big.NewInt(1)) != 0 {
|
||||
t.Fatalf("unexpected blob base fee: %v", blobBaseFee)
|
||||
}
|
||||
|
||||
// FeeHistory
|
||||
history, err := ec.FeeHistory(context.Background(), 1, big.NewInt(2), []float64{95, 99})
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue