mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
graphql: implement the blob fields
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
3e272162cd
commit
22abf61296
1 changed files with 54 additions and 0 deletions
|
|
@ -330,6 +330,26 @@ func (t *Transaction) MaxPriorityFeePerGas(ctx context.Context) *hexutil.Big {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
@ -462,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{}) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue