mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +00:00
ethclient: add BlobBaseFee method to retrieve base fee per blob gas
This commit is contained in:
parent
6c286beb39
commit
916b67d8f3
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 returns the base fee per blob gas in wei.
|
||||||
|
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