watcher

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package watcher watches the chain for events

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlockHeightWatcher

func NewBlockHeightWatcher(ctx context.Context, chainID uint64, reader EthHeadClient) chainwatcher.BlockHeightWatcher

NewBlockHeightWatcher creates a new height watcher.

func NewContractWatcher

func NewContractWatcher(ctx context.Context, contractListener ContractFilterer, heightWatcher chainwatcher.BlockHeightWatcher, requiredConfirmations uint) chainwatcher.ContractWatcher

NewContractWatcher creates a new contract contractWatcher. A contract contractWatcher defines two types: a listener, and a producer. A producer is responsible for emitting events on a contract to listeners. There can only be one producer per contract. A listener processes these events. there can be (theoretically) unlimited listeners per producer. Listeners are responsible for registering and unregistering themselves. TODO: consider replacing with: https://pkg.go.dev/github.com/cryptoriums/telliot@v0.3.0/pkg/tracker/events#New

Types

type ContractFilterer

type ContractFilterer interface {
	bind.ContractFilterer
	GetBigChainID() *big.Int
}

ContractFilterer is the filterer object.

type EthHeadClient

type EthHeadClient interface {
	// HeaderByNumber gets a block by its number, If nil is passed for number, the most recent
	// block is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
}

EthHeadClient defines a method for getting a subscription to the chain-tip height on geth based rpc clients.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL