Documentation
¶
Index ¶
- type Config
- type Indexer
- func (i *Indexer) BlockChannel() <-chan rpctypes.PolyBlock
- func (i *Indexer) GetBaseFee(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetBlock(ctx context.Context, blockHashOrNumber interface{}) (rpctypes.PolyBlock, error)
- func (i *Indexer) GetChainID(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetClientVersion(ctx context.Context) (string, error)
- func (i *Indexer) GetFinalizedBlock(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetGasPrice(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetMetric(name string) (interface{}, bool)
- func (i *Indexer) GetNetPeerCount(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetPendingTransactionCount(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetQueuedTransactionCount(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetRPCURL() string
- func (i *Indexer) GetReceipt(ctx context.Context, txHash common.Hash) (rpctypes.PolyReceipt, error)
- func (i *Indexer) GetSafeBlock(ctx context.Context) (*big.Int, error)
- func (i *Indexer) GetSignature(ctx context.Context, hexSignature string) ([]chainstore.Signature, error)
- func (i *Indexer) GetSyncStatus(ctx context.Context) (interface{}, error)
- func (i *Indexer) GetTransaction(ctx context.Context, txHash common.Hash) (rpctypes.PolyTransaction, error)
- func (i *Indexer) GetTxPoolStatus(ctx context.Context) (map[string]interface{}, error)
- func (i *Indexer) IsMethodSupported(method string) bool
- func (i *Indexer) LatestHeight() int64
- func (i *Indexer) MeasureConnectionLatency(ctx context.Context) (time.Duration, error)
- func (i *Indexer) MetricsChannel() <-chan metrics.MetricUpdate
- func (i *Indexer) Start() error
- func (i *Indexer) Stop() error
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
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 ¶
BlockChannel returns the channel where new blocks are published
func (*Indexer) GetBaseFee ¶
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 ¶
GetChainID retrieves the chain ID
func (*Indexer) GetClientVersion ¶
GetClientVersion retrieves the client version
func (*Indexer) GetFinalizedBlock ¶
GetFinalizedBlock retrieves the finalized block number
func (*Indexer) GetGasPrice ¶
GetGasPrice retrieves the current gas price
func (*Indexer) GetNetPeerCount ¶
GetNetPeerCount retrieves the number of connected peers
func (*Indexer) GetPendingTransactionCount ¶
GetPendingTransactionCount retrieves pending transaction count
func (*Indexer) GetQueuedTransactionCount ¶
GetQueuedTransactionCount retrieves queued transaction count
func (*Indexer) GetReceipt ¶
GetReceipt retrieves a transaction receipt by hash through the store
func (*Indexer) GetSafeBlock ¶
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 ¶
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 ¶
GetTxPoolStatus retrieves the full txpool status
func (*Indexer) IsMethodSupported ¶
IsMethodSupported checks if a method is supported
func (*Indexer) LatestHeight ¶
LatestHeight returns the latest block height that has been indexed
func (*Indexer) MeasureConnectionLatency ¶
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