indexer

package
v0.1.87 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// PollingInterval is how often to check for new blocks
	PollingInterval time.Duration

	// LookbackDepth is how many blocks to keep in the store
	// 0 means keep all blocks
	LookbackDepth int64

	// ReorgDepth is how many blocks back to check for reorgs
	// This should be based on the chain's finality assumptions
	ReorgDepth int64

	// MaxConcurrency limits the number of concurrent requests
	MaxConcurrency int
}

Config holds the configuration for the indexer

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

type Indexer

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

Indexer is responsible for fetching blockchain data and populating the store

func NewIndexer

func NewIndexer(store chainstore.ChainStore, cfg *Config) *Indexer

NewIndexer creates a new indexer with the given store and configuration

func (*Indexer) BlockChannel

func (i *Indexer) BlockChannel() <-chan rpctypes.PolyBlock

BlockChannel returns the channel where new blocks are published

func (*Indexer) GetBaseFee

func (i *Indexer) GetBaseFee(ctx context.Context) (*big.Int, error)

GetBaseFee retrieves the current base fee

func (*Indexer) GetBlock

func (i *Indexer) GetBlock(ctx context.Context, blockHashOrNumber interface{}) (rpctypes.PolyBlock, error)

GetBlock retrieves a block by hash or number through the store

func (*Indexer) GetChainID

func (i *Indexer) GetChainID(ctx context.Context) (*big.Int, error)

GetChainID retrieves the chain ID

func (*Indexer) GetClientVersion

func (i *Indexer) GetClientVersion(ctx context.Context) (string, error)

GetClientVersion retrieves the client version

func (*Indexer) GetFinalizedBlock

func (i *Indexer) GetFinalizedBlock(ctx context.Context) (*big.Int, error)

GetFinalizedBlock retrieves the finalized block number

func (*Indexer) GetGasPrice

func (i *Indexer) GetGasPrice(ctx context.Context) (*big.Int, error)

GetGasPrice retrieves the current gas price

func (*Indexer) GetMetric

func (i *Indexer) GetMetric(name string) (interface{}, bool)

GetMetric returns the current value of a specific metric

func (*Indexer) GetNetPeerCount

func (i *Indexer) GetNetPeerCount(ctx context.Context) (*big.Int, error)

GetNetPeerCount retrieves the number of connected peers

func (*Indexer) GetPendingTransactionCount

func (i *Indexer) GetPendingTransactionCount(ctx context.Context) (*big.Int, error)

GetPendingTransactionCount retrieves pending transaction count

func (*Indexer) GetQueuedTransactionCount

func (i *Indexer) GetQueuedTransactionCount(ctx context.Context) (*big.Int, error)

GetQueuedTransactionCount retrieves queued transaction count

func (*Indexer) GetRPCURL

func (i *Indexer) GetRPCURL() string

GetRPCURL returns the RPC endpoint URL

func (*Indexer) GetReceipt

func (i *Indexer) GetReceipt(ctx context.Context, txHash common.Hash) (rpctypes.PolyReceipt, error)

GetReceipt retrieves a transaction receipt by hash through the store

func (*Indexer) GetSafeBlock

func (i *Indexer) GetSafeBlock(ctx context.Context) (*big.Int, error)

GetSafeBlock retrieves the safe block number

func (*Indexer) GetSignature

func (i *Indexer) GetSignature(ctx context.Context, hexSignature string) ([]chainstore.Signature, error)

GetSignature retrieves function/event signatures from 4byte.directory

func (*Indexer) GetSyncStatus

func (i *Indexer) GetSyncStatus(ctx context.Context) (interface{}, error)

GetSyncStatus retrieves the sync status

func (*Indexer) GetTransaction

func (i *Indexer) GetTransaction(ctx context.Context, txHash common.Hash) (rpctypes.PolyTransaction, error)

GetTransaction retrieves a transaction by hash through the store

func (*Indexer) GetTxPoolStatus

func (i *Indexer) GetTxPoolStatus(ctx context.Context) (map[string]interface{}, error)

GetTxPoolStatus retrieves the full txpool status

func (*Indexer) IsMethodSupported

func (i *Indexer) IsMethodSupported(method string) bool

IsMethodSupported checks if a method is supported

func (*Indexer) LatestHeight

func (i *Indexer) LatestHeight() int64

LatestHeight returns the latest block height that has been indexed

func (*Indexer) MeasureConnectionLatency

func (i *Indexer) MeasureConnectionLatency(ctx context.Context) (time.Duration, error)

MeasureConnectionLatency measures the connection latency to the RPC endpoint

func (*Indexer) MetricsChannel

func (i *Indexer) MetricsChannel() <-chan metrics.MetricUpdate

MetricsChannel returns the channel where metrics updates are published

func (*Indexer) Start

func (i *Indexer) Start() error

Start begins the indexing process

func (*Indexer) Stop

func (i *Indexer) Stop() error

Stop gracefully stops the indexer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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