Documentation ¶
Index ¶
- Constants
- func AllTxLogsFromEvents(events []abci.Event) ([][]*ethtypes.Log, error)
- func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error)
- func ShouldIgnoreGasUsed(res *abci.ResponseDeliverTx) bool
- func TxExceedBlockGasLimit(res *abci.ResponseDeliverTx) bool
- func TxLogsFromEvents(events []abci.Event, msgIndex int) ([]*ethtypes.Log, error)
- func TxSuccessOrExceedsBlockGasLimit(res *abci.ResponseDeliverTx) bool
- type Backend
- func (b *Backend) BaseFee(height int64) (*big.Int, error)
- func (b *Backend) BlockBloom(height *int64) (ethtypes.Bloom, error)
- func (b *Backend) BlockByHash(hash common.Hash) (*ethtypes.Block, error)
- func (b *Backend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error)
- func (b *Backend) BlockNumber() (hexutil.Uint64, error)
- func (b *Backend) BloomStatus() (uint64, uint64)
- func (b *Backend) ChainConfig() *params.ChainConfig
- func (b *Backend) CurrentHeader() *ethtypes.Header
- func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error)
- func (b *Backend) EthBlockFromTendermint(resBlock *tmrpctypes.ResultBlock, fullTx bool) (map[string]interface{}, error)
- func (b *Backend) EthBlockFromTm(resBlock *tmrpctypes.ResultBlock) (*ethtypes.Block, error)
- func (b *Backend) FeeHistory(userBlockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, ...) (*types.FeeHistoryResult, error)
- func (b *Backend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (b *Backend) GetCoinbase() (sdk.AccAddress, error)
- func (b *Backend) GetEthereumMsgsFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx
- func (b *Backend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error)
- func (b *Backend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error)
- func (b *Backend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error)
- func (b *Backend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error)
- func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error)
- func (b *Backend) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error)
- func (b *Backend) GetTxByEthHash(hash common.Hash) (*tmrpctypes.ResultTx, error)
- func (b *Backend) GetTxByTxIndex(height int64, index uint) (*tmrpctypes.ResultTx, error)
- func (b *Backend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)
- func (b *Backend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error)
- func (b *Backend) PendingTransactions() ([]*sdk.Tx, error)
- func (b *Backend) RPCBlockRangeCap() int32
- func (b *Backend) RPCEVMTimeout() time.Duration
- func (b *Backend) RPCFeeHistoryCap() int32
- func (b *Backend) RPCFilterCap() int32
- func (b *Backend) RPCGasCap() uint64
- func (b *Backend) RPCLogsCap() int32
- func (b *Backend) RPCMinGasPrice() int64
- func (b *Backend) RPCTxFeeCap() float64
- func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)
- func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error)
- func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error)
- type BackendI
- type CosmosBackend
- type EVMBackend
Constants ¶
const ExceedBlockGasLimitError = "out of gas in location: block gas meter; gasWanted:"
ExceedBlockGasLimitError defines the error message when tx execution exceeds the block gas limit. The tx fee is deducted in ante handler, so it shouldn't be ignored in JSON-RPC API.
Variables ¶
This section is empty.
Functions ¶
func AllTxLogsFromEvents ¶
AllTxLogsFromEvents parses all ethereum logs from cosmos events
func ParseTxLogsFromEvent ¶
ParseTxLogsFromEvent parse tx logs from one event
func ShouldIgnoreGasUsed ¶
func ShouldIgnoreGasUsed(res *abci.ResponseDeliverTx) bool
ShouldIgnoreGasUsed returns true if the gasUsed in result should be ignored workaround for issue: https://github.com/cosmos/cosmos-sdk/issues/10832
func TxExceedBlockGasLimit ¶
func TxExceedBlockGasLimit(res *abci.ResponseDeliverTx) bool
TxExceedBlockGasLimit returns true if the tx exceeds block gas limit.
func TxLogsFromEvents ¶
TxLogsFromEvents parses ethereum logs from cosmos events for specific msg index
func TxSuccessOrExceedsBlockGasLimit ¶
func TxSuccessOrExceedsBlockGasLimit(res *abci.ResponseDeliverTx) bool
TxSuccessOrExceedsBlockGasLimit returns if the tx should be included in json-rpc responses
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements the BackendI interface
func NewBackend ¶
NewBackend creates a new Backend instance for cosmos and ethereum namespaces
func (*Backend) BaseFee ¶
BaseFee returns the base fee tracked by the Fee Market module. If the base fee is not enabled globally, the query returns nil. If the London hard fork is not activated at the current height, the query will return nil.
func (*Backend) BlockBloom ¶
BlockBloom query block bloom filter from block results
func (*Backend) BlockByHash ¶
BlockByHash returns the block identified by hash.
func (*Backend) BlockByNumber ¶
BlockByNumber returns the block identified by number.
func (*Backend) BlockNumber ¶
BlockNumber returns the current block number in abci app state. Because abci app state could lag behind from tendermint latest block, it's more stable for the client to use the latest block number in abci app state than tendermint rpc.
func (*Backend) BloomStatus ¶
BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained by the chain indexer.
func (*Backend) ChainConfig ¶
func (b *Backend) ChainConfig() *params.ChainConfig
ChainConfig returns the latest ethereum chain configuration
func (*Backend) CurrentHeader ¶
CurrentHeader returns the latest block header
func (*Backend) EstimateGas ¶
func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error)
EstimateGas returns an estimate of gas usage for the given smart contract call.
func (*Backend) EthBlockFromTendermint ¶
func (b *Backend) EthBlockFromTendermint( resBlock *tmrpctypes.ResultBlock, fullTx bool, ) (map[string]interface{}, error)
EthBlockFromTendermint returns a JSON-RPC compatible Ethereum block from a given Tendermint block and its block result.
func (*Backend) EthBlockFromTm ¶
func (b *Backend) EthBlockFromTm(resBlock *tmrpctypes.ResultBlock) (*ethtypes.Block, error)
func (*Backend) FeeHistory ¶
func (b *Backend) FeeHistory( userBlockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64, ) (*types.FeeHistoryResult, error)
FeeHistory returns data relevant for fee estimation based on the specified range of blocks.
func (*Backend) GetBlockByHash ¶
GetBlockByHash returns the block identified by hash.
func (*Backend) GetBlockByNumber ¶
func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the block identified by number.
func (*Backend) GetCoinbase ¶
func (b *Backend) GetCoinbase() (sdk.AccAddress, error)
GetCoinbase is the address that staking rewards will be send to (alias for Etherbase).
func (*Backend) GetEthereumMsgsFromTendermintBlock ¶
func (b *Backend) GetEthereumMsgsFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx
GetEthereumMsgsFromTendermintBlock returns all real MsgEthereumTxs from a Tendermint block. It also ensures consistency over the correct txs indexes across RPC endpoints
func (*Backend) GetLogs ¶
GetLogs returns all the logs from all the ethereum transactions in a block.
func (*Backend) GetLogsByHeight ¶
GetLogsByHeight returns all the logs from all the ethereum transactions in a block.
func (*Backend) GetTendermintBlockByHash ¶
func (b *Backend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error)
GetTendermintBlockByHash returns a Tendermint format block by block number
func (*Backend) GetTendermintBlockByNumber ¶
func (b *Backend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error)
GetTendermintBlockByNumber returns a Tendermint format block by block number
func (*Backend) GetTransactionByHash ¶
GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash
func (*Backend) GetTransactionCount ¶
func (b *Backend) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error)
GetTransactionCount returns the number of transactions at the given address up to the given block number.
func (*Backend) GetTxByEthHash ¶
GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash TODO: Don't need to convert once hashing is fixed on Tendermint https://github.com/tendermint/tendermint/issues/6539
func (*Backend) GetTxByTxIndex ¶
GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs
func (*Backend) HeaderByHash ¶
HeaderByHash returns the block header identified by hash.
func (*Backend) HeaderByNumber ¶
HeaderByNumber returns the block header identified by height.
func (*Backend) PendingTransactions ¶
PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
func (*Backend) RPCBlockRangeCap ¶
RPCBlockRangeCap defines the max block range allowed for `eth_getLogs` query.
func (*Backend) RPCEVMTimeout ¶
RPCEVMTimeout is the global evm timeout for eth-call variants.
func (*Backend) RPCFeeHistoryCap ¶
RPCFeeHistoryCap is the limit for total number of blocks that can be fetched
func (*Backend) RPCFilterCap ¶
RPCFilterCap is the limit for total number of filters that can be created
func (*Backend) RPCLogsCap ¶
RPCLogsCap defines the max number of results can be returned from single `eth_getLogs` query.
func (*Backend) RPCMinGasPrice ¶
func (*Backend) RPCTxFeeCap ¶
RPCGasCap is the global gas cap for eth-call variants.
func (*Backend) SendTransaction ¶
func (*Backend) SetTxDefaults ¶
func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error)
SetTxDefaults populates tx message with default values in case they are not provided on the args
type BackendI ¶
type BackendI interface { CosmosBackend EVMBackend }
BackendI implements the Cosmos and EVM backend.
type CosmosBackend ¶
type CosmosBackend interface { }
CosmosBackend implements the functionality shared within cosmos namespaces as defined by Wallet Connect V2: https://docs.walletconnect.com/2.0/json-rpc/cosmos. Implemented by Backend.
type EVMBackend ¶
type EVMBackend interface { // General Ethereum API RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection RPCTxFeeCap() float64 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for send-transaction variants. The unit is ether. RPCMinGasPrice() int64 SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) // Blockchain API BlockNumber() (hexutil.Uint64, error) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) BlockByHash(blockHash common.Hash) (*ethtypes.Block, error) CurrentHeader() *ethtypes.Header HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) PendingTransactions() ([]*sdk.Tx, error) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) GetCoinbase() (sdk.AccAddress, error) GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) GetTxByEthHash(txHash common.Hash) (*tmrpctypes.ResultTx, error) GetTxByTxIndex(height int64, txIndex uint) (*tmrpctypes.ResultTx, error) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) BaseFee(height int64) (*big.Int, error) // Fee API FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) // Filter API BloomStatus() (uint64, uint64) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) ChainConfig() *params.ChainConfig SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx }
EVMBackend implements the functionality shared within ethereum namespaces as defined by EIP-1474: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md Implemented by Backend.