ethmonitor

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: LGPL-3.0, MIT Imports: 12 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ethmonitor

inspired by the work of the 0x team at github.com/0xProject/0x-mesh

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedParentHash  = fmt.Errorf("unexpected parent hash")
	ErrUnexpectedBlockNumber = fmt.Errorf("unexpected block number")
)
View Source
var DefaultOptions = Options{
	Logger:                   log.New(os.Stdout, "", 0),
	PollingInterval:          1 * time.Second,
	PollingTimeout:           120 * time.Second,
	StartBlockNumber:         nil,
	TrailNumBlocksBehindHead: 0,
	BlockRetentionLimit:      100,
	WithLogs:                 true,
	LogTopics:                []common.Hash{},
	DebugLogging:             false,
}

Functions

This section is empty.

Types

type Block

type Block struct {
	*types.Block
	Event Event
	Logs  []types.Log
	// contains filtered or unexported fields
}

type Blocks

type Blocks []*Block

func (Blocks) Copy added in v1.3.0

func (blocks Blocks) Copy() Blocks

func (Blocks) EventExists added in v1.3.0

func (blocks Blocks) EventExists(block *types.Block, event Event) bool

func (Blocks) FindBlock

func (b Blocks) FindBlock(hash common.Hash, optEvent ...Event) (*Block, bool)

func (Blocks) LatestBlock

func (b Blocks) LatestBlock() *Block

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

func (*Chain) Blocks

func (c *Chain) Blocks() []*Block

func (*Chain) GetBlock

func (c *Chain) GetBlock(hash common.Hash) *Block

func (*Chain) GetBlockByNumber added in v1.3.2

func (c *Chain) GetBlockByNumber(blockNum uint64, event Event) *Block

func (*Chain) GetTransaction

func (c *Chain) GetTransaction(hash common.Hash) *types.Transaction

func (*Chain) Head

func (c *Chain) Head() *Block

func (*Chain) PrintAllBlocks

func (c *Chain) PrintAllBlocks()

type Event added in v1.3.0

type Event uint32
const (
	Added Event = iota
	Removed
	Updated
)

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor(provider *ethrpc.Provider, opts ...Options) (*Monitor, error)

func (*Monitor) Chain

func (m *Monitor) Chain() *Chain

func (*Monitor) GetBlock

func (m *Monitor) GetBlock(hash common.Hash) *Block

GetBlock will search the retained blocks for the hash

func (*Monitor) GetTransaction

func (m *Monitor) GetTransaction(hash common.Hash) *types.Transaction

GetBlock will search within the retained blocks for the txn hash

func (*Monitor) IsRunning

func (m *Monitor) IsRunning() bool

func (*Monitor) LatestBlock

func (m *Monitor) LatestBlock() *Block

LatestBlock will return the head block of the retained chain

func (*Monitor) Options

func (m *Monitor) Options() Options

func (*Monitor) Provider added in v1.1.10

func (m *Monitor) Provider() *ethrpc.Provider

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context) error

func (*Monitor) Stop

func (m *Monitor) Stop() error

func (*Monitor) Subscribe

func (m *Monitor) Subscribe() Subscription

type Options

type Options struct {
	Logger                   util.Logger
	PollingInterval          time.Duration
	PollingTimeout           time.Duration
	StartBlockNumber         *big.Int
	TrailNumBlocksBehindHead int
	BlockRetentionLimit      int
	WithLogs                 bool
	LogTopics                []common.Hash
	DebugLogging             bool
}

type Subscription

type Subscription interface {
	Blocks() <-chan Blocks
	Done() <-chan struct{}
	Unsubscribe()
}

Jump to

Keyboard shortcuts

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