mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-20 06:49:27 +00:00
ethclient: add BlobBaseFee method (#31290)
This commit is contained in:
parent
d2bbde2f2d
commit
31c972febf
2 changed files with 18 additions and 0 deletions
|
|
@ -598,6 +598,15 @@ func (ec *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
||||||
return (*big.Int)(&hex), nil
|
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 {
|
type feeHistoryResultMarshaling struct {
|
||||||
OldestBlock *hexutil.Big `json:"oldestBlock"`
|
OldestBlock *hexutil.Big `json:"oldestBlock"`
|
||||||
Reward [][]*hexutil.Big `json:"reward,omitempty"`
|
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)
|
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
|
// FeeHistory
|
||||||
history, err := ec.FeeHistory(context.Background(), 1, big.NewInt(2), []float64{95, 99})
|
history, err := ec.FeeHistory(context.Background(), 1, big.NewInt(2), []float64{95, 99})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue