backend

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Used by block filter; also used for polling
	BlockNumber() (hexutil.Uint64, error)
	HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error)
	HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)
	GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error)
	GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)

	// returns the logs of a given block
	GetLogs(blockHash common.Hash) ([][]*ethtypes.Log, error)

	// Used by pending transaction filter
	PendingTransactions() ([]*types.RPCTransaction, error)

	// Used by log filter
	GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)
	BloomStatus() (uint64, uint64)

	ChainConfig() *params.ChainConfig
}

Backend implements the functionality needed to filter changes. Implemented by EVMBackend.

type EVMBackend

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

EVMBackend implements the Backend interface

func NewEVMBackend

func NewEVMBackend(clientCtx client.Context) *EVMBackend

NewEVMBackend creates a new EVMBackend instance

func (*EVMBackend) BlockNumber

func (e *EVMBackend) BlockNumber() (hexutil.Uint64, error)

BlockNumber returns the current block number.

func (*EVMBackend) BloomStatus

func (e *EVMBackend) BloomStatus() (uint64, uint64)

BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained by the chain indexer.

func (*EVMBackend) ChainConfig

func (e *EVMBackend) ChainConfig() *params.ChainConfig

ChainConfig returns the chain configuration for the chain. This method returns a nil pointer if the query fails.

func (*EVMBackend) EthBlockFromTendermint

func (e *EVMBackend) EthBlockFromTendermint(
	clientCtx client.Context,
	queryClient evmtypes.QueryClient,
	block *tmtypes.Block,
	fullTx bool,
) (map[string]interface{}, error)

EthBlockFromTendermint returns a JSON-RPC compatible Ethereum block from a given Tendermint block.

func (*EVMBackend) GetBlockByHash

func (e *EVMBackend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)

GetBlockByHash returns the block identified by hash.

func (*EVMBackend) GetBlockByNumber

func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber returns the block identified by number.

func (*EVMBackend) GetLogs

func (e *EVMBackend) GetLogs(blockHash common.Hash) ([][]*ethtypes.Log, error)

GetLogs returns all the logs from all the ethereum transactions in a block.

func (*EVMBackend) GetLogsByNumber

func (e *EVMBackend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.Log, error)

func (*EVMBackend) GetTransactionLogs

func (e *EVMBackend) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)

GetTransactionLogs returns the logs given a transaction hash. It returns an error if there's an encoding error. If no logs are found for the tx hash, the error is nil.

func (*EVMBackend) HeaderByHash

func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)

HeaderByHash returns the block header identified by hash.

func (*EVMBackend) HeaderByNumber

func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error)

HeaderByNumber returns the block header identified by height.

func (*EVMBackend) PendingTransactions

func (e *EVMBackend) PendingTransactions() ([]*types.RPCTransaction, error)

PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.

Jump to

Keyboard shortcuts

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