Documentation ¶
Overview ¶
Copyright (c) 2023-2024 Nibi, Inc.
Index ¶
- Constants
- func LoadFirstBlock(db dbm.DB) (int64, error)
- func LoadLastBlock(db dbm.DB) (int64, error)
- func TxHashKey(hash common.Hash) []byte
- func TxIndexKey(blockNumber int64, txIndex int32) []byte
- type EVMTxIndexer
- func (indexer *EVMTxIndexer) CloseDBAndExit() error
- func (indexer *EVMTxIndexer) FirstIndexedBlock() (int64, error)
- func (indexer *EVMTxIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*eth.TxResult, error)
- func (indexer *EVMTxIndexer) GetByTxHash(hash common.Hash) (*eth.TxResult, error)
- func (indexer *EVMTxIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.ResponseDeliverTx) error
- func (indexer *EVMTxIndexer) LastIndexedBlock() (int64, error)
Constants ¶
const ( KeyPrefixTxHash = 1 KeyPrefixTxIndex = 2 // TxIndexKeyLength is the length of tx-index key TxIndexKeyLength = 1 + 8 + 8 )
Variables ¶
This section is empty.
Functions ¶
func LoadFirstBlock ¶
LoadFirstBlock loads the first indexed block, returns -1 if db is empty
func LoadLastBlock ¶
LoadLastBlock returns the latest indexed block number, returns -1 if db is empty
func TxIndexKey ¶
TxIndexKey returns the key for db entry: `(block number, tx index) -> tx hash`
Types ¶
type EVMTxIndexer ¶
type EVMTxIndexer struct {
// contains filtered or unexported fields
}
EVMTxIndexer implements a eth tx indexer on a KV db.
func NewEVMTxIndexer ¶
NewEVMTxIndexer creates the EVMTxIndexer
func (*EVMTxIndexer) CloseDBAndExit ¶
func (indexer *EVMTxIndexer) CloseDBAndExit() error
CloseDBAndExit should be called upon stopping the indexer
func (*EVMTxIndexer) FirstIndexedBlock ¶
func (indexer *EVMTxIndexer) FirstIndexedBlock() (int64, error)
FirstIndexedBlock returns the first indexed block number, returns -1 if db is empty
func (*EVMTxIndexer) GetByBlockAndIndex ¶
func (indexer *EVMTxIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*eth.TxResult, error)
GetByBlockAndIndex finds eth tx by block number and eth tx index
func (*EVMTxIndexer) GetByTxHash ¶
GetByTxHash finds eth tx by eth tx hash
func (*EVMTxIndexer) IndexBlock ¶
func (indexer *EVMTxIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.ResponseDeliverTx) error
IndexBlock index all the eth txs in a block through the following steps: - Iterates over all the Txs in Block - Parses eth Tx infos from cosmos-sdk events for every TxResult - Iterates over all the messages of the Tx - Builds and stores indexer.TxResult based on parsed events for every message
func (*EVMTxIndexer) LastIndexedBlock ¶
func (indexer *EVMTxIndexer) LastIndexedBlock() (int64, error)
LastIndexedBlock returns the latest indexed block number, returns -1 if db is empty