diff --git a/integration/tengateway/tengateway_test.go b/integration/tengateway/tengateway_test.go index 00cf051f39..a113ec270d 100644 --- a/integration/tengateway/tengateway_test.go +++ b/integration/tengateway/tengateway_test.go @@ -493,6 +493,7 @@ func testErrorHandling(t *testing.T, startPort int, httpURL, wsURL string, w wal `{"jsonrpc":"2.0","method":"eth_getLogs","params":[[]],"id":1}`, `{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":[]}],"id":1}`, `{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x387","topics":["0xc6d8c0af6d21f291e7c359603aa97e0ed500f04db6e983b9fce75a91c6b8da6b"]}],"id":1}`, + `{"jsonrpc":"2.0","method":"debug_eventLogRelevancy","params":[{"fromBlock":"0x387","topics":["0xc6d8c0af6d21f291e7c359603aa97e0ed500f04db6e983b9fce75a91c6b8da6b"]}],"id":1}`, //`{"jsonrpc":"2.0","method":"eth_subscribe","params":["logs"],"id":1}`, //`{"jsonrpc":"2.0","method":"eth_subscribe","params":["logs",{"topics":[]}],"id":1}`, `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}`, diff --git a/tools/walletextension/rpcapi/debug_api.go b/tools/walletextension/rpcapi/debug_api.go index 77964306cf..de6711ce95 100644 --- a/tools/walletextension/rpcapi/debug_api.go +++ b/tools/walletextension/rpcapi/debug_api.go @@ -3,7 +3,10 @@ package rpcapi import ( "context" - "github.com/ethereum/go-ethereum/common" + "github.com/ten-protocol/go-ten/go/common" + "github.com/ten-protocol/go-ten/go/common/tracers" + + gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ten-protocol/go-ten/lib/gethfork/rpc" ) @@ -28,7 +31,7 @@ func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.Block return nil, rpcNotImplemented } -func (s *DebugAPI) GetRawTransaction(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { +func (s *DebugAPI) GetRawTransaction(ctx context.Context, hash gethcommon.Hash) (hexutil.Bytes, error) { return nil, rpcNotImplemented } @@ -48,8 +51,22 @@ func (api *DebugAPI) SetHead(number hexutil.Uint64) { // not implemented } -// EventLogRelevancy - specific to TEN - todo -func (api *DebugAPI) EventLogRelevancy(_ context.Context, _ common.Hash) (interface{}, error) { - // todo - return nil, rpcNotImplemented +// EventLogRelevancy - specific to TEN +func (api *DebugAPI) EventLogRelevancy(ctx context.Context, crit common.FilterCriteria) ([]*tracers.DebugLogs, error) { + l, err := ExecAuthRPC[[]*tracers.DebugLogs]( + ctx, + api.we, + &ExecCfg{ + cacheCfg: &CacheCfg{ + CacheType: NoCache, + }, + tryUntilAuthorised: true, + }, + "debug_eventLogRelevancy", + crit, + ) + if err != nil { + return nil, err + } + return *l, nil } diff --git a/tools/walletextension/rpcapi/utils.go b/tools/walletextension/rpcapi/utils.go index 13d6197b2d..88aac6e577 100644 --- a/tools/walletextension/rpcapi/utils.go +++ b/tools/walletextension/rpcapi/utils.go @@ -48,13 +48,15 @@ const ( var rpcNotImplemented = fmt.Errorf("rpc endpoint not implemented") type ExecCfg struct { + // these 4 fields specify the account(s) that should make the backend call account *gethcommon.Address computeFromCallback func(user *GWUser) *gethcommon.Address tryAll bool tryUntilAuthorised bool - adjustArgs func(acct *GWAccount) []any - cacheCfg *CacheCfg - timeout time.Duration + + adjustArgs func(acct *GWAccount) []any + cacheCfg *CacheCfg + timeout time.Duration } type CacheStrategy uint8