l1access

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type L1Accessor

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

L1Accessor provides access to the L1 chain. it wraps an L1 source in order to pass calls to the L1 chain and manages the finality and latest block subscriptions. The finality subscription is hooked to a finality handler function provided by the caller. and the latest block subscription is used to monitor the tip height of the L1 chain. L1Accessor has the concept of confirmation depth, which is used to block access to requests to blocks which are too recent. When requests for blocks are more recent than the tip minus the confirmation depth, a NotFound error is returned.

func NewL1Accessor

func NewL1Accessor(sysCtx context.Context, log log.Logger, client L1Source) *L1Accessor

func (*L1Accessor) AttachClient

func (p *L1Accessor) AttachClient(client L1Source, subscribe bool)

AttachClient attaches a new client to the processor. If an existing client was attached, the old subscriptions are unsubscribed. New subscriptions are created if subscribe is true. If subscribe is false, L1 status has to be fetched manually with PullFinalized and PullLatest.

func (*L1Accessor) AttachEmitter

func (p *L1Accessor) AttachEmitter(em event.Emitter)

func (*L1Accessor) L1BlockRefByNumber

func (p *L1Accessor) L1BlockRefByNumber(ctx context.Context, number uint64) (eth.L1BlockRef, error)

func (*L1Accessor) OnEvent

func (p *L1Accessor) OnEvent(ev event.Event) bool

func (*L1Accessor) PullFinalized

func (p *L1Accessor) PullFinalized() error

func (*L1Accessor) PullLatest

func (p *L1Accessor) PullLatest() error

func (*L1Accessor) SetConfDepth

func (p *L1Accessor) SetConfDepth(depth uint64)

func (*L1Accessor) SubscribeFinalityHandler

func (p *L1Accessor) SubscribeFinalityHandler()

func (*L1Accessor) SubscribeLatestHandler

func (p *L1Accessor) SubscribeLatestHandler()

type L1Source

type L1Source interface {
	L1BlockRefByNumber(ctx context.Context, number uint64) (eth.L1BlockRef, error)
	L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
}

Jump to

Keyboard shortcuts

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