feat(ethclient): export GetTxBlockTraceOnTopOfBlock & GetNumSkippedTransactions & GetSkippedTransactionHashes & GetSkippedTransaction (#644)

This commit is contained in:
HAOYUatHZ 2024-03-11 17:30:45 +08:00 committed by GitHub
parent a807a41fd1
commit dab4354b62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -28,6 +28,8 @@ import (
"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/eth"
"github.com/scroll-tech/go-ethereum/eth/tracers"
"github.com/scroll-tech/go-ethereum/rpc"
)
@ -342,6 +344,30 @@ func (ec *Client) GetBlockTraceByNumber(ctx context.Context, number *big.Int) (*
return blockTrace, ec.c.CallContext(ctx, &blockTrace, "scroll_getBlockTraceByNumberOrHash", toBlockNumArg(number))
}
// GetTxBlockTraceOnTopOfBlock returns the BlockTrace given the tx and block.
func (ec *Client) GetTxBlockTraceOnTopOfBlock(ctx context.Context, tx *types.Transaction, blockNumberOrHash rpc.BlockNumberOrHash, config *tracers.TraceConfig) (*types.BlockTrace, error) {
blockTrace := &types.BlockTrace{}
return blockTrace, ec.c.CallContext(ctx, &blockTrace, "scroll_getTxBlockTraceOnTopOfBlock", tx, blockNumberOrHash, config)
}
// GetNumSkippedTransactions returns the ...
func (ec *Client) GetNumSkippedTransactions(ctx context.Context) (uint64, error) {
var num uint64
return num, ec.c.CallContext(ctx, &num, "scroll_getNumSkippedTransactions")
}
// GetSkippedTransactionHashes returns the BlockTrace given the tx and block.
func (ec *Client) GetSkippedTransactionHashes(ctx context.Context, from uint64, to uint64) ([]common.Hash, error) {
hashes := []common.Hash{}
return hashes, ec.c.CallContext(ctx, &hashes, "scroll_getSkippedTransactionHashes", from, to)
}
// GetSkippedTransaction returns the BlockTrace given the tx and block.
func (ec *Client) GetSkippedTransaction(ctx context.Context, txHash common.Hash) (*eth.RPCTransaction, error) {
tx := &eth.RPCTransaction{}
return tx, ec.c.CallContext(ctx, &tx, "scroll_getSkippedTransaction", txHash)
}
type rpcRowConsumption struct {
RowConsumption types.RowConsumption `json:"rowConsumption"`
}

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 1 // Minor version component of the current release
VersionPatch = 20 // Patch version component of the current release
VersionPatch = 21 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)