Documentation
¶
Index ¶
Constants ¶
const (
AutomaticBlockInterval = time.Second * 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockNotifierManager ¶
type BlockNotifierManager struct {
// contains filtered or unexported fields
}
BlockNotifierManager manages multiple BlockNotifiers for different finality types. implements BlockNotifierGetter interface.
func NewBlockNotifierManager ¶
func NewBlockNotifierManager(logger aggkitcommon.Logger, constructorFunc func(aggkittypes.BlockNumberFinality) (ethermantypes.BlockNotifier, error)) *BlockNotifierManager
func (*BlockNotifierManager) GetBlockNotifier ¶
func (bnm *BlockNotifierManager) GetBlockNotifier(ctx context.Context, blockFinality aggkittypes.BlockNumberFinality) (ethermantypes.BlockNotifier, error)
TODO: You must only have real blockNotifiers for latest, safe, finalized... the rest (that are offsets) must use the principal ones to reduce the numbers of RPC requests and goroutines
func (*BlockNotifierManager) GetCurrentBlockNumber ¶
func (bnm *BlockNotifierManager) GetCurrentBlockNumber(ctx context.Context, blockFinality aggkittypes.BlockNumberFinality) (uint64, error)
type BlockNotifierPolling ¶
type BlockNotifierPolling struct {
aggkitcommon.PubSub[ethmantypes.EventNewBlock]
// contains filtered or unexported fields
}
func NewBlockNotifierPolling ¶
func NewBlockNotifierPolling(ethClient aggkittypes.BaseEthereumClienter, config ConfigBlockNotifierPolling, logger aggkitcommon.Logger, subscriber aggkitcommon.PubSub[ethmantypes.EventNewBlock]) (*BlockNotifierPolling, error)
NewBlockNotifierPolling creates a new BlockNotifierPolling. if param `subscriber` is nil a new GenericSubscriber[types.EventNewBlock] will be created. To use this class you need to subscribe and each time that a new block appear the subscriber will be notified through the channel. (check unit tests TestExploratoryBlockNotifierPolling for more information)
func (*BlockNotifierPolling) GetCurrentBlockNumber ¶
func (b *BlockNotifierPolling) GetCurrentBlockNumber() uint64
func (*BlockNotifierPolling) Initialize ¶
func (b *BlockNotifierPolling) Initialize(ctx context.Context) error
func (*BlockNotifierPolling) Start ¶
func (b *BlockNotifierPolling) Start(ctx context.Context)
Start starts the BlockNotifierPolling blocking the current goroutine
func (*BlockNotifierPolling) String ¶
func (b *BlockNotifierPolling) String() string
type ConfigBlockNotifierPolling ¶
type ConfigBlockNotifierPolling struct {
// BlockFinalityType is the finality of the block to be notified
BlockFinalityType aggkittypes.BlockNumberFinality
// CheckNewBlockInterval is the interval at which the AggSender will check for new blocks
// if is 0 it will be calculated automatically
CheckNewBlockInterval time.Duration
}