native

package
v0.0.0-...-cd1f6ea Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MPL-2.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 Blockchain

type Blockchain interface {
	Close(ctx context.Context) error
	ChainID() string
	ChainHeader() (chainID string, height uint64, err error)
	SetChainHeader(*tmtypes.Block)
	DecodeTx(tx tmtypes.Tx) (sdktypes.Tx, error)
	SubscribeNewBlock(ctx context.Context) (<-chan *tmtypes.Block, error)
	Block(ctx context.Context, height int64) (blk *tmtypes.Block, minimumBlkHeight int, err error)
	CheckTx(ctx context.Context, tx tmtypes.Tx) error
	LightProvider() provtypes.Provider
}

Blockchain is the expected blockchain interface the indexer needs to store data in the database.

type Indexer

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

Indexer struct responsible for calling blockchain rpc/websocket for data and storing that into the database.

func NewIndexer

func NewIndexer(ctx context.Context, b Blockchain, logger zerolog.Logger,
	startBlockHeight int, ika *ika.Client) (*Indexer, error)

NewIndexer returns a new indexer struct with open connections.

func (*Indexer) Close

func (i *Indexer) Close(ctx context.Context) error

Close closes all the open connections.

func (*Indexer) HandleBlock

func (i *Indexer) HandleBlock(ctx context.Context, blk *tmtypes.Block) error

HandleBlock handles the receive of a block from the chain.

func (*Indexer) HandleNewBlock

func (i *Indexer) HandleNewBlock(ctx context.Context, blk *tmtypes.Block) error

HandleNewBlock handles the receive of new block from the chain.

func (*Indexer) HandleTx

func (i *Indexer) HandleTx(ctx context.Context, blockHeight, blockTimeUnix int, tmTx tmtypes.Tx) error

HandleTx handles the receive of new Tx from the chain.

func (*Indexer) IndexBlocksFromTo

func (i *Indexer) IndexBlocksFromTo(ctx context.Context, from, to int)

IndexBlocksFromTo index blocks from specific heights.

func (*Indexer) IndexOldBlocks

func (i *Indexer) IndexOldBlocks(ctx context.Context)

IndexOldBlocks checks if it is needed to index old blocks and index them as needed.

func (*Indexer) Start

func (i *Indexer) Start(ctx context.Context) error

Start indexing

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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