client: TraceCall

This commit is contained in:
Krisna Pranav 2025-01-23 22:30:16 +05:30
parent d3cc618951
commit b00bf73267

View file

@ -50,11 +50,23 @@ func DialContext(ctx context.Context, rawurl string) (*Client, error) {
return NewClient(c), nil return NewClient(c), nil
} }
type Client struct {
rpcClient *rpc.Client
}
// NewClient creates a client that uses the given RPC client. // NewClient creates a client that uses the given RPC client.
func NewClient(c *rpc.Client) *Client { func NewClient(c *rpc.Client) *Client {
return &Client{c} return &Client{c}
} }
// TraceCall: for call operation
func (c *Client) TraceCall(ctx context.Context, callArgs interface{}) (*tracers.TraceResult, error) {
var result tracers.TraceResult
err := c.rpcClient.CallContext(ctx, &result, "debug_traceCall", callArgs)
return &result, err
}
// Close closes the underlying RPC connection. // Close closes the underlying RPC connection.
func (ec *Client) Close() { func (ec *Client) Close() {
ec.c.Close() ec.c.Close()