l1

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(
	l1 Subscriber,
	chain *blockchain.Blockchain,
	logger log.StructuredLogger,
	opts ...Option,
) *Client

func (*Client) CatchUpL1Head added in v0.16.1

func (c *Client) CatchUpL1Head(ctx context.Context) error

CatchUpL1Head verifies the chain ID then writes the L1 head to the database, without entering the live subscription loop. Closes the underlying Subscriber on return; the Client must not be reused.

func (*Client) L1 added in v0.13.0

func (c *Client) L1() Subscriber

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

type EthSubscriber

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

func NewEthSubscriber

func NewEthSubscriber(ethClientAddress string, coreContractAddress common.Address) (*EthSubscriber, error)

func (*EthSubscriber) ChainID

func (s *EthSubscriber) ChainID(ctx context.Context) (*big.Int, error)

func (*EthSubscriber) Close

func (s *EthSubscriber) Close()

func (*EthSubscriber) FilterLogStateUpdate added in v0.16.1

func (s *EthSubscriber) FilterLogStateUpdate(
	ctx context.Context,
	start,
	end uint64,
) ([]*contract.StarknetLogStateUpdate, error)

func (*EthSubscriber) FinalisedHeight

func (s *EthSubscriber) FinalisedHeight(ctx context.Context) (uint64, error)

func (*EthSubscriber) LatestHeight added in v0.15.2

func (s *EthSubscriber) LatestHeight(ctx context.Context) (uint64, error)

func (*EthSubscriber) TransactionReceipt added in v0.13.0

func (s *EthSubscriber) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*EthSubscriber) WatchLogStateUpdate

func (s *EthSubscriber) WatchLogStateUpdate(ctx context.Context, sink chan<- *contract.StarknetLogStateUpdate) (event.Subscription, error)

type EventListener added in v0.7.5

type EventListener interface {
	OnNewL1Head(head *core.L1Head)
	OnL1Call(method string, took time.Duration)
}

type Option added in v0.16.1

type Option func(*options)

Option is a functional option for configuring l1 client options.

func WithCatchUpChunkSize added in v0.16.1

func WithCatchUpChunkSize(size uint64) Option

WithCatchUpChunkSize sets the L1 block range per backward eth_getLogs request during the startup catch-up scan.

func WithEventListener added in v0.16.1

func WithEventListener(l EventListener) Option

func WithPollFinalisedInterval added in v0.16.1

func WithPollFinalisedInterval(d time.Duration) Option

WithPollFinalisedInterval sets the time to wait before checking for an update to the finalised L1 block.

func WithResubscribeDelay added in v0.16.1

func WithResubscribeDelay(d time.Duration) Option

type SelectiveListener added in v0.7.5

type SelectiveListener struct {
	OnNewL1HeadCb func(head *core.L1Head)
	OnL1CallCb    func(method string, took time.Duration)
}

func (SelectiveListener) OnL1Call added in v0.12.3

func (l SelectiveListener) OnL1Call(method string, took time.Duration)

func (SelectiveListener) OnNewL1Head added in v0.7.5

func (l SelectiveListener) OnNewL1Head(head *core.L1Head)

type Subscriber

type Subscriber interface {
	FinalisedHeight(ctx context.Context) (uint64, error)
	LatestHeight(ctx context.Context) (uint64, error)
	WatchLogStateUpdate(ctx context.Context, sink chan<- *contract.StarknetLogStateUpdate) (event.Subscription, error)
	FilterLogStateUpdate(
		ctx context.Context,
		fromBlock,
		toBlock uint64,
	) ([]*contract.StarknetLogStateUpdate, error)
	ChainID(ctx context.Context) (*big.Int, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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