ethclient/gethclient: add method TraceBlock #32092 (#1399)

This commit is contained in:
Daniel Liu 2025-08-31 15:48:35 +08:00 committed by GitHub
parent 905cbd63df
commit dc2a0c1b86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -216,6 +216,17 @@ func (ec *Client) TraceTransaction(ctx context.Context, hash common.Hash, config
return result, nil
}
// TraceBlock returns the structured logs created during the execution of EVM
// and returns them as a JSON object.
func (ec *Client) TraceBlock(ctx context.Context, hash common.Hash, config *tracers.TraceConfig) (any, error) {
var result any
err := ec.c.CallContext(ctx, &result, "debug_traceBlockByHash", hash, config)
if err != nil {
return nil, err
}
return result, nil
}
func toBlockNumArg(number *big.Int) string {
if number == nil {
return "latest"