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() (*ethgo.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 []ethgo.Address `json:"address"`
Topics [][]*ethgo.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 ethgo.Hash, full bool) (*ethgo.Block, error)
GetBlockByNumber(i ethgo.BlockNumber, full bool) (*ethgo.Block, error)
GetLogs(filter *ethgo.LogFilter) ([]*ethgo.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.