Versions in this module Expand all Collapse all v0 v0.1.0 Jan 19, 2024 Changes in this version + const FlagApiBackendBlockLruCache + const FlagApiBackendTxLruCache + const FlagLogsLimit + const FlagLogsTimeout + var ErrInvalidBlock = errors.New("invalid block with unknown transactions") + var ErrLruDataNotFound = errors.New("lru : not found") + var ErrLruDataWrongType = errors.New("lru : wrong type") + var ErrLruNotInitialized = errors.New("lru has not been Initialized") + var ErrTimeout = errors.New("query timeout exceeded") + type Backend interface + Block func(height *int64) (*coretypes.ResultBlock, error) + BlockNumber func() int64 + BloomStatus func() (uint64, uint64) + BtcBlockHashByBtcTxid func(string) (string, error) + ConvertToBlockNumber func(rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) + GetBlockByHash func(hash common.Hash, fullTx bool) (*evmtypes.Block, error) + GetBlockByNumber func(blockNum rpctypes.BlockNumber, fullTx bool) (*evmtypes.Block, error) + GetLogs func(height int64) ([][]*ethtypes.Log, error) + GetLogsOptimize func(height int64) ([][]*ethtypes.Log, []common.Hash, error) + GetPendingNonce func(address string) (uint64, bool) + GetTransactionByHash func(hash common.Hash) (*watcher.Transaction, error) + GetTransactionLogs func(txHash common.Hash) ([]*ethtypes.Log, error) + HeaderByHash func(blockHash common.Hash) (*ethtypes.Header, error) + HeaderByNumber func(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error) + HeightByBtcHash func(string) (int64, error) + LatestBlockNumber func() (int64, error) + PendingAddressList func() ([]string, error) + PendingTransactionCnt func() (int, error) + PendingTransactions func() ([]*watcher.Transaction, error) + PendingTransactionsByHash func(target common.Hash) (*watcher.Transaction, error) + PruneEverything func() bool + ServiceFilter func(ctx context.Context, session *bloombits.MatcherSession) + UserPendingTransactions func(address string, limit int) ([]*watcher.Transaction, error) + UserPendingTransactionsCnt func(address string) (int, error) + type Cache interface + AddOrUpdateBlock func(hash common.Hash, block *evmtypes.Block, fullTx bool) + AddOrUpdateBlockHash func(number uint64, hash common.Hash) + AddOrUpdateTransaction func(hash common.Hash, tx *watcher.Transaction) + GetBlockByHash func(hash common.Hash, fullTx bool) (*evmtypes.Block, error) + GetBlockByNumber func(number uint64, fullTx bool) (*evmtypes.Block, error) + GetBlockHash func(number uint64) (common.Hash, error) + GetTransaction func(hash common.Hash) (*watcher.Transaction, error) + type EthermintBackend struct + func New(clientCtx clientcontext.CLIContext, log log.Logger, ...) *EthermintBackend + func (b *EthermintBackend) Block(height *int64) (block *coretypes.ResultBlock, err error) + func (b *EthermintBackend) BlockNumber() int64 + func (b *EthermintBackend) BloomStatus() (uint64, uint64) + func (b *EthermintBackend) BtcBlockHashByBtcHeight(btcHeight int64) (string, error) + func (b *EthermintBackend) BtcBlockHashByBtcTxid(btcTxid string) (string, error) + func (b *EthermintBackend) Close() + func (b *EthermintBackend) ConvertToBlockNumber(blockNumberOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) + func (b *EthermintBackend) GetBlockByHash(hash common.Hash, fullTx bool) (*evmtypes.Block, error) + func (b *EthermintBackend) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (*evmtypes.Block, error) + func (b *EthermintBackend) GetBlockHashByHeight(height rpctypes.BlockNumber) (common.Hash, error) + func (b *EthermintBackend) GetLogs(height int64) ([][]*ethtypes.Log, error) + func (b *EthermintBackend) GetLogsOptimize(height int64) ([][]*ethtypes.Log, []common.Hash, error) + func (b *EthermintBackend) GetPendingNonce(address string) (uint64, bool) + func (b *EthermintBackend) GetRateLimiter(apiName string) *rate.Limiter + func (b *EthermintBackend) GetTransactionByHash(hash common.Hash) (tx *watcher.Transaction, err error) + func (b *EthermintBackend) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) + func (b *EthermintBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) + func (b *EthermintBackend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error) + func (b *EthermintBackend) HeightByBtcHash(btcHash string) (int64, error) + func (b *EthermintBackend) IsDisabled(apiName string) bool + func (b *EthermintBackend) LatestBlockNumber() (int64, error) + func (b *EthermintBackend) LogsLimit() int + func (b *EthermintBackend) LogsTimeout() time.Duration + func (b *EthermintBackend) PendingAddressList() ([]string, error) + func (b *EthermintBackend) PendingTransactionCnt() (int, error) + func (b *EthermintBackend) PendingTransactions() ([]*watcher.Transaction, error) + func (b *EthermintBackend) PendingTransactionsByHash(target common.Hash) (*watcher.Transaction, error) + func (b *EthermintBackend) PruneEverything() bool + func (b *EthermintBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) + func (b *EthermintBackend) StartBloomHandlers(sectionSize uint64, db dbm.DB) + func (b *EthermintBackend) UserPendingTransactions(address string, limit int) ([]*watcher.Transaction, error) + func (b *EthermintBackend) UserPendingTransactionsCnt(address string) (int, error) + type LruCache struct + func NewLruCache() *LruCache + func (lc *LruCache) AddOrUpdateBlock(hash common.Hash, block *evmtypes.Block, fullTx bool) + func (lc *LruCache) AddOrUpdateBlockHash(number uint64, hash common.Hash) + func (lc *LruCache) AddOrUpdateTransaction(hash common.Hash, tx *watcher.Transaction) + func (lc *LruCache) GetBlockByHash(hash common.Hash, fullTx bool) (*evmtypes.Block, error) + func (lc *LruCache) GetBlockByNumber(number uint64, fullTx bool) (*evmtypes.Block, error) + func (lc *LruCache) GetBlockHash(number uint64) (common.Hash, error) + func (lc *LruCache) GetTransaction(hash common.Hash) (*watcher.Transaction, error)