Documentation ¶
Index ¶
- type BlockEvent
- type Config
- type ConfigOption
- type Event
- type EventType
- type FilterConfig
- type Provider
- type Tracker
- func (t *Tracker) BatchSync(ctx context.Context) error
- func (t *Tracker) Entry() store.Entry
- func (t *Tracker) GetLastBlock() (*core.Block, error)
- func (t *Tracker) IsSynced() bool
- func (t *Tracker) Sync(ctx context.Context) error
- func (t *Tracker) Wait()
- func (t *Tracker) WaitDuration(dur time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockEvent ¶
BlockEvent is an event emitted when a new block is included
type Config ¶
type Config struct { BatchSize uint64 BlockTracker *blocktracker.BlockTracker // move to interface EtherscanAPIKey string Filter *FilterConfig Store store.Store }
Config is the configuration of the tracker
type ConfigOption ¶
type ConfigOption func(*Config)
func WithBatchSize ¶
func WithBatchSize(b uint64) ConfigOption
func WithBlockTracker ¶
func WithBlockTracker(b *blocktracker.BlockTracker) ConfigOption
func WithEtherscan ¶
func WithEtherscan(k string) ConfigOption
func WithFilter ¶
func WithFilter(f *FilterConfig) ConfigOption
func WithStore ¶
func WithStore(s store.Store) ConfigOption
type FilterConfig ¶
type FilterConfig struct { Address []core.Address `json:"address"` Topics [][]*core.Hash `json:"topics"` Start uint64 Hash string Async bool }
FilterConfig is a tracker filter configuration
type Provider ¶
type Provider interface { BlockNumber() (uint64, error) GetBlockByHash(hash core.Hash, full bool) (*core.Block, error) GetBlockByNumber(i core.BlockNumber, full bool) (*core.Block, error) GetLogs(filter *core.LogFilter) ([]*core.Log, error) ChainID() (*big.Int, error) }
Provider are the eth1x methods required by the tracker
type Tracker ¶
type Tracker struct { BlockCh chan *blocktracker.BlockEvent ReadyCh chan struct{} SyncCh chan uint64 EventCh chan *Event DoneCh chan struct{} // contains filtered or unexported fields }
Tracker is a contract event tracker
func NewTracker ¶
func NewTracker(provider Provider, opts ...ConfigOption) (*Tracker, error)
NewTracker creates a new tracker
func (*Tracker) GetLastBlock ¶
GetLastBlock returns the last block processed for this filter
Click to show internal directories.
Click to hide internal directories.