Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockNumberMod ¶
BlockNumberMod returns true if the block number % n is 0
Types ¶
type BlockOptions ¶
type BlockOptions struct { // Number returns true if the block with the given number should be handled Number func(number uint64) bool }
BlockOptions contains options to filter blocks
type Broadcaster ¶
type Broadcaster interface { // RegisterEventHandler registers the given handler for specific events based on the given filters. RegisterEventHandler(id string, chainID uint64, handler HandleEventFunc, opts EventOptions) (func(), error) // RegisterBlockHandler registers the given handler for blocks based on the given filters. RegisterBlockHandler(id string, chainID uint64, handler HandleBlockFunc, opts BlockOptions) (func(), error) // Start starts broadcasting on-chain data to subscribers Start(ctx context.Context) error // Stop stops broadcasting Stop() error }
Broadcaster represents a behavior of events broadcaster.
func NewMultiChain ¶
func NewMultiChain(broadcasters map[uint64]Broadcaster) Broadcaster
NewMultiChain is the constructor of multiChainBroadcaster
func NewSingleChain ¶
func NewSingleChain(ctx context.Context, logger logrus.FieldLogger, provider onchain.Provider, opts Options) (Broadcaster, error)
NewSingleChain is the constructor of singleChainBroadcaster
type Client ¶
type Client interface { ethereum.LogFilterer ethereum.ChainReader }
Client represents the behavior of the on-chain data provider
type EventOptions ¶
type EventOptions struct { // Contracts contains contract addresses to listen events from. Contracts []common.Address // Event types to receive, with value filter for each field in the event // No filter or an empty filter for a given field position mean: all values allowed // the key should be a result of AbigenLog.Topic() call // topic => topicValueFilters LogsWithTopics map[common.Hash][][]common.Hash }
EventOptions contains options to filter events
type HandleBlockFunc ¶
HandleBlockFunc is the signature of a function to handle heads
type HandleEventFunc ¶
HandleEventFunc is the signature of a function to handle events
Click to show internal directories.
Click to hide internal directories.