aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go23
-rw-r--r--rpc/responses.go11
2 files changed, 27 insertions, 7 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 452116fb4..6ba0d93e2 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -338,14 +338,13 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- id := api.xeth().RegisterFilter(args.Earliest, args.Latest, args.Skip, args.Max, args.Address, args.Topics)
+ id := api.xeth().NewLogFilter(args.Earliest, args.Latest, args.Skip, args.Max, args.Address, args.Topics)
*reply = newHexNum(big.NewInt(int64(id)).Bytes())
+
case "eth_newBlockFilter":
- args := new(FilterStringArgs)
- if err := json.Unmarshal(req.Params, &args); err != nil {
- return err
- }
- *reply = newHexNum(api.xeth().NewFilterString(args.Word))
+ *reply = newHexNum(api.xeth().NewBlockFilter())
+ case "eth_newPendingTransactionFilter":
+ *reply = newHexNum(api.xeth().NewTransactionFilter())
case "eth_uninstallFilter":
args := new(FilterIdArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
@@ -357,7 +356,17 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- *reply = NewLogsRes(api.xeth().FilterChanged(args.Id))
+
+ switch api.xeth().GetFilterType(args.Id) {
+ case xeth.BlockFilterTy:
+ *reply = NewHashesRes(api.xeth().BlockFilterChanged(args.Id))
+ case xeth.TransactionFilterTy:
+ *reply = NewHashesRes(api.xeth().TransactionFilterChanged(args.Id))
+ case xeth.LogFilterTy:
+ *reply = NewLogsRes(api.xeth().LogFilterChanged(args.Id))
+ default:
+ *reply = []string{} // reply empty string slice
+ }
case "eth_getFilterLogs":
args := new(FilterIdArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
diff --git a/rpc/responses.go b/rpc/responses.go
index 884b7e69b..9fdf60c02 100644
--- a/rpc/responses.go
+++ b/rpc/responses.go
@@ -3,6 +3,7 @@ package rpc
import (
"encoding/json"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
)
@@ -303,3 +304,13 @@ func NewLogsRes(logs state.Logs) (ls []LogRes) {
return
}
+
+func NewHashesRes(hs []common.Hash) []string {
+ hashes := make([]string, len(hs))
+
+ for i, hash := range hs {
+ hashes[i] = hash.Hex()
+ }
+
+ return hashes
+}