graphql: add blobGasUsed,excessBlobGas for block

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-09-11 22:19:09 +08:00
parent 0add9d0175
commit 05070803a8

View file

@ -1067,6 +1067,30 @@ func (b *Block) Withdrawals(ctx context.Context) (*[]*Withdrawal, error) {
return &ret, nil return &ret, nil
} }
func (b *Block) BlobGasUsed(ctx context.Context) (*hexutil.Uint64, error) {
header, err := b.resolveHeader(ctx)
if err != nil {
return nil, err
}
if header.BlobGasUsed == nil {
return nil, nil
}
ret := hexutil.Uint64(*header.BlobGasUsed)
return &ret, nil
}
func (b *Block) ExcessBlobGas(ctx context.Context) (*hexutil.Uint64, error) {
header, err := b.resolveHeader(ctx)
if err != nil {
return nil, err
}
if header.ExcessBlobGas == nil {
return nil, nil
}
ret := hexutil.Uint64(*header.ExcessBlobGas)
return &ret, nil
}
// BlockFilterCriteria encapsulates criteria passed to a `logs` accessor inside // BlockFilterCriteria encapsulates criteria passed to a `logs` accessor inside
// a block. // a block.
type BlockFilterCriteria struct { type BlockFilterCriteria struct {