-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathclient_filter.go
45 lines (35 loc) · 1.23 KB
/
client_filter.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 sdk
import (
"github.com/Conflux-Chain/go-conflux-sdk/types"
rpc "github.com/openweb3/go-rpc-provider"
)
type RpcFilterClient struct {
core *Client
}
func NewRpcFilterClient(core *Client) RpcPosClient {
return RpcPosClient{core}
}
func (c *RpcFilterClient) NewFilter(logFilter types.LogFilter) (filterId *rpc.ID, err error) {
err = c.core.CallRPC(&filterId, "cfx_newFilter", logFilter)
return
}
func (c *RpcFilterClient) NewBlockFilter() (filterId *rpc.ID, err error) {
err = c.core.CallRPC(&filterId, "cfx_newBlockFilter")
return
}
func (c *RpcFilterClient) NewPendingTransactionFilter() (filterId *rpc.ID, err error) {
err = c.core.CallRPC(&filterId, "cfx_newPendingTransactionFilter")
return
}
func (c *RpcFilterClient) GetFilterChanges(filterId rpc.ID) (cfxFilterChanges *types.CfxFilterChanges, err error) {
err = c.core.CallRPC(&cfxFilterChanges, "cfx_getFilterChanges", filterId)
return
}
func (c *RpcFilterClient) GetFilterLogs(filterID rpc.ID) (logs []types.Log, err error) {
err = c.core.CallRPC(&logs, "cfx_getFilterLogs", filterID)
return
}
func (c *RpcFilterClient) UninstallFilter(filterId rpc.ID) (isUninstalled bool, err error) {
err = c.core.CallRPC(&isUninstalled, "cfx_uninstallFilter", filterId)
return
}