diff --git a/jsonrpc/debug.go b/jsonrpc/debug.go index 7fa42712..851c7030 100644 --- a/jsonrpc/debug.go +++ b/jsonrpc/debug.go @@ -6,11 +6,21 @@ type Debug struct { c *Client } -// Eth returns the reference to the eth namespace +// Debug returns the reference to the debug namespace func (c *Client) Debug() *Debug { return c.endpoints.d } +type TraceTransactionOptions struct { + EnableMemory bool `json:"enableMemory"` + DisableStack bool `json:"disableStack"` + DisableStorage bool `json:"disableStorage"` + EnableReturnData bool `json:"enableReturnData"` + Timeout string `json:"timeout,omitempty"` + Tracer string `json:"tracer,omitempty"` + TracerConfig map[string]interface{} `json:"tracerConfig,omitempty"` +} + type TransactionTrace struct { Gas uint64 ReturnValue string @@ -28,8 +38,8 @@ type StructLogs struct { Storage map[string]string } -func (d *Debug) TraceTransaction(hash ethgo.Hash) (*TransactionTrace, error) { +func (d *Debug) TraceTransaction(hash ethgo.Hash, opts TraceTransactionOptions) (*TransactionTrace, error) { var res *TransactionTrace - err := d.c.Call("debug_traceTransaction", &res, hash) + err := d.c.Call("debug_traceTransaction", &res, hash, opts) return res, err } diff --git a/jsonrpc/debug_test.go b/jsonrpc/debug_test.go index fda91c6f..e4a36579 100644 --- a/jsonrpc/debug_test.go +++ b/jsonrpc/debug_test.go @@ -22,7 +22,7 @@ func TestDebug_TraceTransaction(t *testing.T) { r, err := s.TxnTo(addr, "setA2") require.NoError(t, err) - trace, err := c.Debug().TraceTransaction(r.TransactionHash) + trace, err := c.Debug().TraceTransaction(r.TransactionHash, TraceTransactionOptions{}) assert.NoError(t, err) assert.Greater(t, trace.Gas, uint64(20000)) assert.NotEmpty(t, trace.StructLogs)