-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathclient_api_debug.go
45 lines (36 loc) · 1.28 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
41
42
43
44
45
package clientapi
import (
"context"
"github.com/ten-protocol/go-ten/go/responses"
"github.com/ten-protocol/go-ten/go/common"
"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
}
func (api *NetworkDebug) EventLogRelevancy(ctx context.Context, encryptedParams common.EncryptedParamsDebugLogRelevancy) (responses.DebugLogs, error) {
enclaveResponse, sysError := api.host.EnclaveClient().DebugEventLogRelevancy(ctx, encryptedParams)
if sysError != nil {
return responses.EnclaveResponse{
Err: &responses.InternalErrMsg,
}, nil
}
return *enclaveResponse, nil
}