forked from ten-protocol/go-ten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_api_debug.go
40 lines (33 loc) · 1.14 KB
/
client_api_debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package clientapi
import (
"context"
"github.com/ten-protocol/go-ten/go/common/host"
"github.com/ten-protocol/go-ten/go/common/tracers"
gethcommon "github.com/ethereum/go-ethereum/common"
)
// NetworkDebug implements a subset of the Ethereum network JSON RPC operations.
type NetworkDebug struct {
host host.Host
}
func NewNetworkDebug(host host.Host) *NetworkDebug {
return &NetworkDebug{
host: host,
}
}
// TraceTransaction returns the structured logs created during the execution of EVM
// and returns them as a JSON object.
func (api *NetworkDebug) TraceTransaction(ctx context.Context, hash gethcommon.Hash, config *tracers.TraceConfig) (interface{}, error) {
response, err := api.host.EnclaveClient().DebugTraceTransaction(ctx, hash, config)
if err != nil {
return "", err
}
return response, nil
}
// EventLogRelevancy returns the events for a given transactions and the revelancy params
func (api *NetworkDebug) EventLogRelevancy(ctx context.Context, hash gethcommon.Hash) (interface{}, error) {
response, err := api.host.EnclaveClient().DebugEventLogRelevancy(ctx, hash)
if err != nil {
return "", err
}
return response, nil
}