Documentation ¶
Overview ¶
package filters implements an ethereum filtering system for block, transactions and log events.
Index ¶
- type AccountChange
- type Filter
- type FilterSystem
- type FilterType
- type NewFilterArgs
- type PublicFilterAPI
- func (s *PublicFilterAPI) GetFilterChanges(filterId string) interface{}
- func (s *PublicFilterAPI) GetFilterLogs(filterId string) []vmlog
- func (s *PublicFilterAPI) GetLogs(args NewFilterArgs) []vmlog
- func (s *PublicFilterAPI) Logs(ctx context.Context, args NewFilterArgs) (rpc.Subscription, error)
- func (s *PublicFilterAPI) NewBlockFilter() (string, error)
- func (s *PublicFilterAPI) NewFilter(args NewFilterArgs) (string, error)
- func (s *PublicFilterAPI) NewPendingTransactionFilter() (string, error)
- func (s *PublicFilterAPI) Stop()
- func (s *PublicFilterAPI) UninstallFilter(filterId string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountChange ¶
type AccountChange struct {
Address, StateAddress []byte
}
type Filter ¶
type Filter struct { BlockCallback func(*types.Block, vm.Logs) TransactionCallback func(*types.Transaction) LogCallback func(*vm.Log, bool) // contains filtered or unexported fields }
Filtering interface
func New ¶
Create a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.
func (*Filter) SetAddresses ¶
func (*Filter) SetBeginBlock ¶
Set the earliest and latest block for filtering. -1 = latest block (i.e., the current block) hash = particular hash from-to
func (*Filter) SetEndBlock ¶
type FilterSystem ¶
type FilterSystem struct {
// contains filtered or unexported fields
}
FilterSystem manages filters that filter specific events such as block, transaction and log events. The Filtering system can be used to listen for specific LOG events fired by the EVM (Ethereum Virtual Machine).
func NewFilterSystem ¶
func NewFilterSystem(mux *event.TypeMux) *FilterSystem
NewFilterSystem returns a newly allocated filter manager
func (*FilterSystem) Add ¶
func (fs *FilterSystem) Add(filter *Filter, filterType FilterType) (int, error)
Add adds a filter to the filter manager
func (*FilterSystem) Get ¶
func (fs *FilterSystem) Get(id int) *Filter
func (*FilterSystem) Remove ¶
func (fs *FilterSystem) Remove(id int)
Remove removes a filter by filter id
func (*FilterSystem) Stop ¶
func (fs *FilterSystem) Stop()
Stop quits the filter loop required for polling events
type FilterType ¶ added in v1.4.0
type FilterType byte
FilterType determines the type of filter and is used to put the filter in to the correct bucket when added.
const ( ChainFilter FilterType = iota // new block events filter PendingTxFilter // pending transaction filter LogFilter // new or removed log filter PendingLogFilter // pending log filter )
type NewFilterArgs ¶ added in v1.4.0
type NewFilterArgs struct { FromBlock rpc.BlockNumber ToBlock rpc.BlockNumber Addresses []common.Address Topics [][]common.Hash }
NewFilterArgs represents a request to create a new filter.
func (*NewFilterArgs) UnmarshalJSON ¶ added in v1.4.0
func (args *NewFilterArgs) UnmarshalJSON(data []byte) error
type PublicFilterAPI ¶ added in v1.4.0
type PublicFilterAPI struct {
// contains filtered or unexported fields
}
PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various information related to the Ethereum protocol such als blocks, transactions and logs.
func NewPublicFilterAPI ¶ added in v1.4.0
func NewPublicFilterAPI(chainDb ethdb.Database, mux *event.TypeMux) *PublicFilterAPI
NewPublicFilterAPI returns a new PublicFilterAPI instance.
func (*PublicFilterAPI) GetFilterChanges ¶ added in v1.4.0
func (s *PublicFilterAPI) GetFilterChanges(filterId string) interface{}
GetFilterChanges returns the logs for the filter with the given id since last time is was called. This can be used for polling.
func (*PublicFilterAPI) GetFilterLogs ¶ added in v1.4.0
func (s *PublicFilterAPI) GetFilterLogs(filterId string) []vmlog
GetFilterLogs returns the logs for the filter with the given id.
func (*PublicFilterAPI) GetLogs ¶ added in v1.4.0
func (s *PublicFilterAPI) GetLogs(args NewFilterArgs) []vmlog
GetLogs returns the logs matching the given argument.
func (*PublicFilterAPI) Logs ¶ added in v1.4.0
func (s *PublicFilterAPI) Logs(ctx context.Context, args NewFilterArgs) (rpc.Subscription, error)
func (*PublicFilterAPI) NewBlockFilter ¶ added in v1.4.0
func (s *PublicFilterAPI) NewBlockFilter() (string, error)
NewBlockFilter create a new filter that returns blocks that are included into the canonical chain.
func (*PublicFilterAPI) NewFilter ¶ added in v1.4.0
func (s *PublicFilterAPI) NewFilter(args NewFilterArgs) (string, error)
NewFilter creates a new filter and returns the filter id. It can be uses to retrieve logs.
func (*PublicFilterAPI) NewPendingTransactionFilter ¶ added in v1.4.0
func (s *PublicFilterAPI) NewPendingTransactionFilter() (string, error)
NewPendingTransactionFilter creates a filter that returns new pending transactions.
func (*PublicFilterAPI) Stop ¶ added in v1.4.0
func (s *PublicFilterAPI) Stop()
Stop quits the work loop.
func (*PublicFilterAPI) UninstallFilter ¶ added in v1.4.0
func (s *PublicFilterAPI) UninstallFilter(filterId string) bool
UninstallFilter removes the filter with the given filter id.