Documentation ¶
Index ¶
- type BlockEvent
- type BlockTracker
- type Config
- type Event
- type EventType
- type Filter
- type FilterConfig
- type JSONBlockTracker
- type Provider
- type SubscriptionBlockTracker
- type Tracker
- func (t *Tracker) GetSavedFilters() ([]*FilterConfig, error)
- func (t *Tracker) NewFilter(config *FilterConfig) (*Filter, error)
- func (t *Tracker) SetLogger(logger *log.Logger)
- func (t *Tracker) SetStore(store store.Store)
- func (t *Tracker) Start(ctx context.Context) error
- func (t *Tracker) Sync(ctx context.Context, filter *Filter) error
- func (t *Tracker) SyncAsync(ctx context.Context, filter *Filter)
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 BlockTracker ¶
BlockTracker is an interface to track new blocks on the chain
type Config ¶
type Config struct { BatchSize uint64 MaxBlockBacklog uint64 EtherscanFastTrack bool EtherscanAPIKey string }
Config is the configuration of the tracker
type Filter ¶
type Filter struct { SyncCh chan uint64 EventCh chan *Event DoneCh chan struct{} // contains filtered or unexported fields }
Filter is a specific filter
func (*Filter) GetLastBlock ¶
GetLastBlock returns the last block processed for this filter
type FilterConfig ¶
type FilterConfig struct { Address []web3.Address `json:"address"` Topics []*web3.Hash `json:"topics"` Start uint64 Hash string Async bool }
FilterConfig is a tracker filter configuration
type JSONBlockTracker ¶
type JSONBlockTracker struct { PollInterval time.Duration // contains filtered or unexported fields }
JSONBlockTracker implements the BlockTracker interface using the http jsonrpc endpoint
func NewJSONBlockTracker ¶
func NewJSONBlockTracker(logger *log.Logger, provider Provider) *JSONBlockTracker
NewJSONBlockTracker creates a new json block tracker
type Provider ¶
type Provider interface { BlockNumber() (uint64, error) GetBlockByHash(hash web3.Hash, full bool) (*web3.Block, error) GetBlockByNumber(i web3.BlockNumber, full bool) (*web3.Block, error) GetLogs(filter *web3.LogFilter) ([]*web3.Log, error) ChainID() (*big.Int, error) }
Provider are the eth1x methods required by the tracker
type SubscriptionBlockTracker ¶
type SubscriptionBlockTracker struct {
// contains filtered or unexported fields
}
SubscriptionBlockTracker is an interface to track new blocks using the newHeads subscription endpoint
func NewSubscriptionBlockTracker ¶
func NewSubscriptionBlockTracker(logger *log.Logger, client *jsonrpc.Client) (*SubscriptionBlockTracker, error)
NewSubscriptionBlockTracker creates a new block tracker using the subscription endpoint
type Tracker ¶
type Tracker struct { BlockCh chan *BlockEvent ReadyCh chan struct{} // contains filtered or unexported fields }
Tracker is a contract event tracker
func NewTracker ¶
NewTracker creates a new tracker
func (*Tracker) GetSavedFilters ¶
func (t *Tracker) GetSavedFilters() ([]*FilterConfig, error)
GetSavedFilters returns the filters stored in the store
func (*Tracker) NewFilter ¶
func (t *Tracker) NewFilter(config *FilterConfig) (*Filter, error)
NewFilter creates a new log filter