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) 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 ¶
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 ¶
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 ¶
func (args *NewFilterArgs) UnmarshalJSON(data []byte) error
type PublicFilterAPI ¶
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 ¶
func NewPublicFilterAPI(chainDb ethdb.Database, mux *event.TypeMux) *PublicFilterAPI
NewPublicFilterAPI returns a new PublicFilterAPI instance.
func (*PublicFilterAPI) GetFilterChanges ¶
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 ¶
func (s *PublicFilterAPI) GetFilterLogs(filterId string) []vmlog
GetFilterLogs returns the logs for the filter with the given id.
func (*PublicFilterAPI) GetLogs ¶
func (s *PublicFilterAPI) GetLogs(args NewFilterArgs) []vmlog
GetLogs returns the logs matching the given argument.
func (*PublicFilterAPI) NewBlockFilter ¶
func (s *PublicFilterAPI) NewBlockFilter() (string, error)
NewBlockFilter create a new filter that returns blocks that are included into the canonical chain.
func (*PublicFilterAPI) NewFilter ¶
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 ¶
func (s *PublicFilterAPI) NewPendingTransactionFilter() (string, error)
NewPendingTransactionFilter creates a filter that returns new pending transactions.
func (*PublicFilterAPI) UninstallFilter ¶
func (s *PublicFilterAPI) UninstallFilter(filterId string) bool
UninstallFilter removes the filter with the given filter id.