Documentation ¶
Index ¶
- Variables
- func IsBlockEq(a, b *types.Block) bool
- type Block
- type Blocks
- func (blocks Blocks) Copy() Blocks
- func (blocks Blocks) EventExists(block *types.Block, event Event) bool
- func (blocks Blocks) FindBlock(hash common.Hash, optEvent ...Event) (*Block, bool)
- func (b Blocks) Head() *Block
- func (b Blocks) IsOK() bool
- func (b Blocks) LatestBlock() *Block
- func (b Blocks) Reorg() bool
- func (b Blocks) Tail() *Block
- type Chain
- func (c *Chain) Blocks() Blocks
- func (c *Chain) GetBlock(hash common.Hash) *Block
- func (c *Chain) GetBlockByNumber(blockNum uint64, event Event) *Block
- func (c *Chain) GetTransaction(hash common.Hash) *types.Transaction
- func (c *Chain) Head() *Block
- func (c *Chain) PrintAllBlocks()
- func (c *Chain) Tail() *Block
- type Event
- type Monitor
- func (m *Monitor) Chain() *Chain
- func (m *Monitor) GetBlock(hash common.Hash) *Block
- func (m *Monitor) GetTransaction(hash common.Hash) *types.Transaction
- func (m *Monitor) IsRunning() bool
- func (m *Monitor) LatestBlock() *Block
- func (m *Monitor) Options() Options
- func (m *Monitor) Provider() *ethrpc.Provider
- func (m *Monitor) Run(ctx context.Context) error
- func (m *Monitor) Stop()
- func (m *Monitor) Subscribe() Subscription
- type Options
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFatal = errors.New("ethmonitor: fatal error, stopping.") ErrReorg = errors.New("ethmonitor: block reorg") ErrUnexpectedParentHash = errors.New("ethmonitor: unexpected parent hash") ErrUnexpectedBlockNumber = errors.New("ethmonitor: unexpected block number") ErrQueueFull = errors.New("ethmonitor: publish queue is full") ErrMaxAttempts = errors.New("ethmonitor: max attempts hit") )
View Source
var DefaultOptions = Options{ Logger: util.NewLogger(util.LogLevel_WARN), PollingInterval: 1000 * time.Millisecond, Timeout: 60 * time.Second, StartBlockNumber: nil, TrailNumBlocksBehindHead: 0, BlockRetentionLimit: 200, WithLogs: false, LogTopics: []common.Hash{}, DebugLogging: false, StrictSubscribers: true, }
Functions ¶
Types ¶
type Blocks ¶
type Blocks []*Block
func (Blocks) EventExists ¶ added in v1.3.0
func (Blocks) LatestBlock ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func (*Chain) GetBlockByNumber ¶ added in v1.3.2
func (*Chain) GetTransaction ¶
func (c *Chain) GetTransaction(hash common.Hash) *types.Transaction
func (*Chain) PrintAllBlocks ¶
func (c *Chain) PrintAllBlocks()
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
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) LatestBlock ¶
LatestBlock will return the head block of the retained chain
func (*Monitor) Subscribe ¶
func (m *Monitor) Subscribe() Subscription
type Options ¶
type Options struct { // .. Logger util.Logger // .. PollingInterval time.Duration // .. Timeout time.Duration // .. StartBlockNumber *big.Int // .. TrailNumBlocksBehindHead int // .. BlockRetentionLimit int // .. WithLogs bool // .. LogTopics []common.Hash // .. DebugLogging bool // StrictSubscribers when enabled will force monitor to block if a subscriber doesn't // consume the message from its channel (the default). When false, it means subscribers // will get always the latest information even if another is lagging to consume. StrictSubscribers bool }
type Subscription ¶
type Subscription interface { Blocks() <-chan Blocks Done() <-chan struct{} Unsubscribe() }
Click to show internal directories.
Click to hide internal directories.