@ -272,8 +272,6 @@ func (t *Transaction) GasPrice(ctx context.Context) hexutil.Big {
return hexutil . Big { }
}
switch tx . Type ( ) {
case types . AccessListTxType :
return hexutil . Big ( * tx . GasPrice ( ) )
case types . DynamicFeeTxType :
if block != nil {
if baseFee , _ := block . BaseFeePerGas ( ctx ) ; baseFee != nil {
@ -312,9 +310,7 @@ func (t *Transaction) MaxFeePerGas(ctx context.Context) *hexutil.Big {
return nil
}
switch tx . Type ( ) {
case types . AccessListTxType :
return nil
case types . DynamicFeeTxType :
case types . DynamicFeeTxType , types . BlobTxType :
return ( * hexutil . Big ) ( tx . GasFeeCap ( ) )
default :
return nil
@ -327,15 +323,33 @@ func (t *Transaction) MaxPriorityFeePerGas(ctx context.Context) *hexutil.Big {
return nil
}
switch tx . Type ( ) {
case types . AccessListTxType :
return nil
case types . DynamicFeeTxType :
case types . DynamicFeeTxType , types . BlobTxType :
return ( * hexutil . Big ) ( tx . GasTipCap ( ) )
default :
return nil
}
}
func ( t * Transaction ) MaxFeePerBlobGas ( ctx context . Context ) * hexutil . Big {
tx , _ := t . resolve ( ctx )
if tx == nil {
return nil
}
return ( * hexutil . Big ) ( tx . BlobGasFeeCap ( ) )
}
func ( t * Transaction ) BlobVersionedHashes ( ctx context . Context ) * [ ] common . Hash {
tx , _ := t . resolve ( ctx )
if tx == nil {
return nil
}
if tx . Type ( ) != types . BlobTxType {
return nil
}
blobHashes := tx . BlobHashes ( )
return & blobHashes
}
func ( t * Transaction ) EffectiveTip ( ctx context . Context ) ( * hexutil . Big , error ) {
tx , block := t . resolve ( ctx )
if tx == nil {
@ -468,6 +482,40 @@ func (t *Transaction) CumulativeGasUsed(ctx context.Context) (*hexutil.Uint64, e
return & ret , nil
}
func ( t * Transaction ) BlobGasUsed ( ctx context . Context ) ( * hexutil . Uint64 , error ) {
tx , _ := t . resolve ( ctx )
if tx == nil {
return nil , nil
}
if tx . Type ( ) != types . BlobTxType {
return nil , nil
}
receipt , err := t . getReceipt ( ctx )
if err != nil || receipt == nil {
return nil , err
}
ret := hexutil . Uint64 ( receipt . BlobGasUsed )
return & ret , nil
}
func ( t * Transaction ) BlobGasPrice ( ctx context . Context ) ( * hexutil . Big , error ) {
tx , _ := t . resolve ( ctx )
if tx == nil {
return nil , nil
}
if tx . Type ( ) != types . BlobTxType {
return nil , nil
}
receipt , err := t . getReceipt ( ctx )
if err != nil || receipt == nil {
return nil , err
}
ret := ( * hexutil . Big ) ( receipt . BlobGasPrice )
return ret , nil
}
func ( t * Transaction ) CreatedContract ( ctx context . Context , args BlockNumberArgs ) ( * Account , error ) {
receipt , err := t . getReceipt ( ctx )
if err != nil || receipt == nil || receipt . ContractAddress == ( common . Address { } ) {
@ -1019,6 +1067,30 @@ func (b *Block) Withdrawals(ctx context.Context) (*[]*Withdrawal, error) {
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
// a block.
type BlockFilterCriteria struct {