forked from cerc-io/plugeth
Added uninstall filter methods
This commit is contained in:
parent
fdecc11128
commit
dba4f3122e
@ -231,6 +231,21 @@ func (req *RpcRequest) ToFilterStringArgs() (string, error) {
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (req *RpcRequest) ToUninstallFilterArgs() (int, error) {
|
||||||
|
if len(req.Params) < 1 {
|
||||||
|
return 0, NewErrorResponse(ErrorArguments)
|
||||||
|
}
|
||||||
|
|
||||||
|
var args int
|
||||||
|
err := json.Unmarshal(req.Params[0], &args)
|
||||||
|
if err != nil {
|
||||||
|
return 0, NewErrorResponse(ErrorDecodeArgs)
|
||||||
|
}
|
||||||
|
|
||||||
|
rpclogger.DebugDetailf("%T %v", args, args)
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (req *RpcRequest) ToFilterChangedArgs() (int, error) {
|
func (req *RpcRequest) ToFilterChangedArgs() (int, error) {
|
||||||
if len(req.Params) < 1 {
|
if len(req.Params) < 1 {
|
||||||
return 0, NewErrorResponse(ErrorArguments)
|
return 0, NewErrorResponse(ErrorArguments)
|
||||||
|
@ -105,6 +105,13 @@ func (self *EthereumApi) NewFilter(args *FilterOptions, reply *interface{}) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *EthereumApi) UninstallFilter(id int, reply *interface{}) error {
|
||||||
|
delete(self.logs, id)
|
||||||
|
self.filterManager.UninstallFilter(id)
|
||||||
|
*reply = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (self *EthereumApi) NewFilterString(args string, reply *interface{}) error {
|
func (self *EthereumApi) NewFilterString(args string, reply *interface{}) error {
|
||||||
var id int
|
var id int
|
||||||
filter := core.NewFilter(self.xeth.Backend())
|
filter := core.NewFilter(self.xeth.Backend())
|
||||||
@ -444,6 +451,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return p.NewFilterString(args, reply)
|
return p.NewFilterString(args, reply)
|
||||||
|
case "eth_uninstallFilter":
|
||||||
|
args, err := req.ToUninstallFilterArgs()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return p.UninstallFilter(args, reply)
|
||||||
case "eth_changed":
|
case "eth_changed":
|
||||||
args, err := req.ToFilterChangedArgs()
|
args, err := req.ToFilterChangedArgs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user