l2

package
v0.0.0-...-412688d Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConnectionTimeout        = 20 * time.Second
	DefaultConfDepth         uint64 = 20
	DefaultMaxBatchSize             = 50
)

Variables

This section is empty.

Functions

func HeaderByNumberWithRetry

func HeaderByNumberWithRetry(ctx context.Context,
	client *l2ethclient.Client) (*types.Header, error)

HeaderByNumberWithRetry retries the given func until it succeeds, waiting for clientRetryInterval duration after every call.

func HeadersByRange

func HeadersByRange(ctx context.Context, client *l2rpc.Client, startHeight uint64, count int) ([]*types.Header, error)

func QueryERC20

func QueryERC20(address l2common.Address, client *l2ethclient.Client) (*db.Token, error)

Types

type ConfirmedHeaderSelector

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

func NewConfirmedHeaderSelector

func NewConfirmedHeaderSelector(cfg HeaderSelectorConfig) (*ConfirmedHeaderSelector,
	error)

func (*ConfirmedHeaderSelector) NewHead

func (f *ConfirmedHeaderSelector) NewHead(
	ctx context.Context,
	lowest uint64,
	header *types.Header,
	client *l2rpc.Client,
) ([]*types.Header, error)

type HeaderSelectorConfig

type HeaderSelectorConfig struct {
	ConfDepth    uint64
	MaxBatchSize uint64
}

type IndexerStatus

type IndexerStatus struct {
	Synced  float64           `json:"synced"`
	Highest db.L2BlockLocator `json:"highest_block"`
}

type Service

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

func NewService

func NewService(cfg ServiceConfig) (*Service, error)

func (*Service) GetIndexerStatus

func (s *Service) GetIndexerStatus(w http.ResponseWriter, r *http.Request)

func (*Service) GetWithdrawalBatch

func (s *Service) GetWithdrawalBatch(w http.ResponseWriter, r *http.Request)

func (*Service) GetWithdrawals

func (s *Service) GetWithdrawals(w http.ResponseWriter, r *http.Request)

func (*Service) Loop

func (s *Service) Loop(ctx context.Context)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Update

func (s *Service) Update(newHeader *types.Header) error

type ServiceConfig

type ServiceConfig struct {
	Context            context.Context
	Metrics            *metrics.Metrics
	L2RPC              *l2rpc.Client
	L2Client           *l2ethclient.Client
	ChainID            *big.Int
	ConfDepth          uint64
	MaxHeaderBatchSize uint64
	StartBlockNumber   uint64
	StartBlockHash     string
	DB                 *db.Database
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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