Documentation ¶
Overview ¶
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Index ¶
- func AllTxLogsFromEvents(events []abci.Event) ([][]*gethcore.Log, error)
- func GetHexProofs(proofOps *crypto.ProofOps) []string
- func GetLogsFromBlockResults(blockRes *tmrpctypes.ResultBlockResults) ([][]*gethcore.Log, error)
- func ParseTxLogsFromEvent(event abci.Event) ([]*gethcore.Log, error)
- func ShouldIgnoreGasUsed(res *abci.ResponseDeliverTx) bool
- func TxLogsFromEvents(events []abci.Event, msgIndex int) ([]*gethcore.Log, error)
- type Backend
- func (b *Backend) Accounts() ([]gethcommon.Address, error)
- func (b *Backend) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (baseFee *big.Int, err error)
- func (b *Backend) BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (gethcore.Bloom, error)
- func (b *Backend) BlockNumber() (hexutil.Uint64, error)
- func (b *Backend) BlockNumberFromTendermint(blockNrOrHash rpc.BlockNumberOrHash) (rpc.BlockNumber, error)
- func (b *Backend) BlockNumberFromTendermintByHash(blockHash gethcommon.Hash) (*big.Int, error)
- func (b *Backend) ChainConfig() *params.ChainConfig
- func (b *Backend) ChainID() *hexutil.Big
- func (b *Backend) CurrentHeader() (*gethcore.Header, error)
- func (b *Backend) DoCall(args evm.JsonTxArgs, blockNr rpc.BlockNumber) (*evm.MsgEthereumTxResponse, error)
- func (b *Backend) EstimateGas(args evm.JsonTxArgs, blockNrOptional *rpc.BlockNumber) (hexutil.Uint64, error)
- func (b *Backend) EthBlockByNumber(blockNum rpc.BlockNumber) (*gethcore.Block, error)
- func (b *Backend) EthBlockFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*gethcore.Block, error)
- func (b *Backend) EthMsgsFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evm.MsgEthereumTx
- func (b *Backend) FeeHistory(userBlockCount gethrpc.DecimalOrHex, lastBlock gethrpc.BlockNumber, ...) (*rpc.FeeHistoryResult, error)
- func (b *Backend) GasPrice() (*hexutil.Big, error)
- func (b *Backend) GetBalance(address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
- func (b *Backend) GetBlockByHash(hash gethcommon.Hash, fullTx bool) (map[string]interface{}, error)
- func (b *Backend) GetBlockByNumber(blockNum rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (b *Backend) GetBlockTransactionCount(block *tmrpctypes.ResultBlock) *hexutil.Uint
- func (b *Backend) GetBlockTransactionCountByHash(hash gethcommon.Hash) *hexutil.Uint
- func (b *Backend) GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) *hexutil.Uint
- func (b *Backend) GetCode(address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (b *Backend) GetProof(address gethcommon.Address, storageKeys []string, ...) (*rpc.AccountResult, error)
- func (b *Backend) GetStorageAt(address gethcommon.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
- func (b *Backend) GetTransactionByBlockHashAndIndex(hash gethcommon.Hash, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
- func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpc.BlockNumber, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
- func (b *Backend) GetTransactionByHash(txHash gethcommon.Hash) (*rpc.EthTxJsonRPC, error)
- func (b *Backend) GetTransactionCount(address gethcommon.Address, blockNum rpc.BlockNumber) (*hexutil.Uint64, error)
- func (b *Backend) GetTransactionReceipt(hash gethcommon.Hash) (*TransactionReceipt, error)
- func (b *Backend) GetTxByEthHash(hash gethcommon.Hash) (*eth.TxResult, error)
- func (b *Backend) GetTxByTxIndex(height int64, index uint) (*eth.TxResult, error)
- func (b *Backend) GlobalMinGasPrice() (*big.Int, error)
- func (b *Backend) HeaderByNumber(blockNum rpc.BlockNumber) (*gethcore.Header, error)
- func (b *Backend) PendingTransactions() ([]*sdk.Tx, error)
- func (b *Backend) RPCBlockFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, ...) (map[string]interface{}, error)
- func (b *Backend) RPCBlockRangeCap() int32
- func (b *Backend) RPCEVMTimeout() time.Duration
- func (b *Backend) RPCFilterCap() int32
- func (b *Backend) RPCGasCap() uint64
- func (b *Backend) RPCLogsCap() int32
- func (b *Backend) RPCMinGasPrice() int64
- func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
- func (b *Backend) SetTxDefaults(args evm.JsonTxArgs) (evm.JsonTxArgs, error)
- func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error)
- func (b *Backend) Syncing() (interface{}, error)
- func (b *Backend) TendermintBlockByHash(blockHash gethcommon.Hash) (*tmrpctypes.ResultBlock, error)
- func (b *Backend) TendermintBlockByNumber(blockNum rpc.BlockNumber) (*tmrpctypes.ResultBlock, error)
- func (b *Backend) TendermintBlockResultByNumber(height *int64) (*tmrpctypes.ResultBlockResults, error)
- func (b *Backend) TraceBlock(height rpc.BlockNumber, config *evm.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evm.TxTraceResult, error)
- func (b *Backend) TraceCall(txArgs evm.JsonTxArgs, contextBlock rpc.BlockNumber, config *evm.TraceConfig) (interface{}, error)
- func (b *Backend) TraceTransaction(hash gethcommon.Hash, config *evm.TraceConfig) (interface{}, error)
- type CosmosBackend
- type TransactionReceipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllTxLogsFromEvents ¶
AllTxLogsFromEvents parses all ethereum logs from cosmos events
func GetHexProofs ¶
GetHexProofs returns list of hex data of proof op
func GetLogsFromBlockResults ¶
func GetLogsFromBlockResults(blockRes *tmrpctypes.ResultBlockResults) ([][]*gethcore.Log, error)
GetLogsFromBlockResults returns the list of event logs from the tendermint block result response
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
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements implements the functionality shared within ethereum namespaces as defined by EIP-1474.
func NewBackend ¶
func NewBackend( ctx *server.Context, logger log.Logger, clientCtx client.Context, allowUnprotectedTxs bool, evmTxIndexer eth.EVMTxIndexer, ) *Backend
NewBackend creates a new Backend instance for cosmos and ethereum namespaces
func (*Backend) Accounts ¶
func (b *Backend) Accounts() ([]gethcommon.Address, error)
Accounts returns the list of accounts available to this node.
func (*Backend) BaseFee ¶
func (b *Backend) BaseFee( blockRes *tmrpctypes.ResultBlockResults, ) (baseFee *big.Int, err error)
BaseFee returns the base fee tracked by the Fee Market module. If the base fee is not enabled globally, the query returns nil.
func (*Backend) BlockBloom ¶
func (b *Backend) BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (gethcore.Bloom, error)
BlockBloom query block bloom filter from block results
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) BlockNumberFromTendermint ¶
func (b *Backend) BlockNumberFromTendermint(blockNrOrHash rpc.BlockNumberOrHash) (rpc.BlockNumber, error)
BlockNumberFromTendermint returns the BlockNumber from BlockNumberOrHash
func (*Backend) BlockNumberFromTendermintByHash ¶
BlockNumberFromTendermintByHash returns the block height of given block hash
func (*Backend) ChainConfig ¶
func (b *Backend) ChainConfig() *params.ChainConfig
ChainConfig returns the latest ethereum chain configuration
func (*Backend) ChainID ¶
ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (*Backend) CurrentHeader ¶
CurrentHeader returns the latest block header This will return error as per node configuration if the ABCI responses are discarded ('discard_abci_responses' config param)
func (*Backend) DoCall ¶
func (b *Backend) DoCall( args evm.JsonTxArgs, blockNr rpc.BlockNumber, ) (*evm.MsgEthereumTxResponse, error)
DoCall performs a simulated call operation through the evmtypes. It returns the estimated gas used on the operation or an error if fails.
func (*Backend) EstimateGas ¶
func (b *Backend) EstimateGas( args evm.JsonTxArgs, blockNrOptional *rpc.BlockNumber, ) (hexutil.Uint64, error)
EstimateGas returns an estimate of gas usage for the given smart contract call.
func (*Backend) EthBlockByNumber ¶
EthBlockByNumber returns the Ethereum Block identified by number.
func (*Backend) EthBlockFromTendermintBlock ¶
func (b *Backend) EthBlockFromTendermintBlock( resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, ) (*gethcore.Block, error)
EthBlockFromTendermintBlock returns an Ethereum Block type from Tendermint block EthBlockFromTendermintBlock
func (*Backend) EthMsgsFromTendermintBlock ¶
func (b *Backend) EthMsgsFromTendermintBlock( resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, ) []*evm.MsgEthereumTx
EthMsgsFromTendermintBlock returns all real MsgEthereumTxs from a Tendermint block. It also ensures consistency over the correct txs indexes across RPC endpoints
func (*Backend) FeeHistory ¶
func (b *Backend) FeeHistory( userBlockCount gethrpc.DecimalOrHex, lastBlock gethrpc.BlockNumber, rewardPercentiles []float64, ) (*rpc.FeeHistoryResult, error)
FeeHistory returns data relevant for fee estimation based on the specified range of blocks.
func (*Backend) GasPrice ¶
GasPrice returns the current gas price based on Ethermint's gas price oracle.
func (*Backend) GetBalance ¶
func (b *Backend) GetBalance( address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash, ) (*hexutil.Big, error)
GetBalance returns the provided account's balance up to the provided block number.
func (*Backend) GetBlockByHash ¶
GetBlockByHash returns the JSON-RPC compatible Ethereum block identified by hash.
func (*Backend) GetBlockByNumber ¶
func (b *Backend) GetBlockByNumber(blockNum rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the JSON-RPC compatible Ethereum block identified by block number. Depending on fullTx it either returns the full transaction objects or if false only the hashes of the transactions.
func (*Backend) GetBlockTransactionCount ¶
func (b *Backend) GetBlockTransactionCount(block *tmrpctypes.ResultBlock) *hexutil.Uint
GetBlockTransactionCount returns the number of Ethereum transactions in a given block.
func (*Backend) GetBlockTransactionCountByHash ¶
func (b *Backend) GetBlockTransactionCountByHash(hash gethcommon.Hash) *hexutil.Uint
GetBlockTransactionCountByHash returns the number of Ethereum transactions in the block identified by hash.
func (*Backend) GetBlockTransactionCountByNumber ¶
func (b *Backend) GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) *hexutil.Uint
GetBlockTransactionCountByNumber returns the number of Ethereum transactions in the block identified by number.
func (*Backend) GetCode ¶
func (b *Backend) GetCode( address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash, ) (hexutil.Bytes, error)
GetCode returns the contract code at the given address and block number.
func (*Backend) GetProof ¶
func (b *Backend) GetProof( address gethcommon.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash, ) (*rpc.AccountResult, error)
GetProof returns an account object with proof and any storage proofs
func (*Backend) GetStorageAt ¶
func (b *Backend) GetStorageAt(address gethcommon.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetStorageAt returns the contract storage at the given address, block number, and key.
func (*Backend) GetTransactionByBlockAndIndex ¶
func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
GetTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`.
func (*Backend) GetTransactionByBlockHashAndIndex ¶
func (b *Backend) GetTransactionByBlockHashAndIndex(hash gethcommon.Hash, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index.
func (*Backend) GetTransactionByBlockNumberAndIndex ¶
func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpc.BlockNumber, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.
func (*Backend) GetTransactionByHash ¶
func (b *Backend) GetTransactionByHash(txHash gethcommon.Hash) (*rpc.EthTxJsonRPC, error)
GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash. If the transaction is not found or has been discarded from a pruning node, this resolves to nil.
func (*Backend) GetTransactionCount ¶
func (b *Backend) GetTransactionCount(address gethcommon.Address, blockNum rpc.BlockNumber) (*hexutil.Uint64, error)
GetTransactionCount returns the number of transactions at the given address up to the given block number.
func (*Backend) GetTransactionReceipt ¶
func (b *Backend) GetTransactionReceipt(hash gethcommon.Hash) (*TransactionReceipt, error)
GetTransactionReceipt returns the transaction receipt identified by hash.
func (*Backend) GetTxByEthHash ¶
GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash
func (*Backend) GetTxByTxIndex ¶
GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs
func (*Backend) GlobalMinGasPrice ¶
GlobalMinGasPrice returns the minimum gas price for all nodes. This is distinct from the individual configuration set by the validator set.
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) RPCBlockFromTendermintBlock ¶
func (b *Backend) RPCBlockFromTendermintBlock( resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, fullTx bool, ) (map[string]interface{}, error)
RPCBlockFromTendermintBlock returns a JSON-RPC compatible Ethereum block from a given Tendermint block and its block result.
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) 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 ¶
RPCMinGasPrice returns the minimum gas price for a transaction obtained from the node config. If set value is 0, it will default to 20.
func (*Backend) SendRawTransaction ¶
SendRawTransaction send a raw Ethereum transaction.
func (*Backend) SetTxDefaults ¶
func (b *Backend) SetTxDefaults(args evm.JsonTxArgs) (evm.JsonTxArgs, error)
SetTxDefaults populates tx message with default values in case they are not provided on the args
func (*Backend) SuggestGasTipCap ¶
SuggestGasTipCap Not yet supported. Returns 0 as the suggested tip cap. After implementing tx prioritization, this function can come to life.
func (*Backend) Syncing ¶
Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its peers. In case it is synchronizing: - startingBlock: block number this node started to synchronize from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled
func (*Backend) TendermintBlockByHash ¶
func (b *Backend) TendermintBlockByHash(blockHash gethcommon.Hash) (*tmrpctypes.ResultBlock, error)
TendermintBlockByHash returns a Tendermint-formatted block by block number
func (*Backend) TendermintBlockByNumber ¶
func (b *Backend) TendermintBlockByNumber(blockNum rpc.BlockNumber) (*tmrpctypes.ResultBlock, error)
TendermintBlockByNumber returns a Tendermint-formatted block for a given block number
func (*Backend) TendermintBlockResultByNumber ¶
func (b *Backend) TendermintBlockResultByNumber(height *int64) (*tmrpctypes.ResultBlockResults, error)
TendermintBlockResultByNumber returns a Tendermint-formatted block result by block number
func (*Backend) TraceBlock ¶
func (b *Backend) TraceBlock(height rpc.BlockNumber, config *evm.TraceConfig, block *tmrpctypes.ResultBlock, ) ([]*evm.TxTraceResult, error)
TraceBlock configures a new tracer according to the provided configuration, and executes all the transactions contained within. The return value will be one item per transaction, dependent on the requested tracer.
func (*Backend) TraceCall ¶
func (b *Backend) TraceCall( txArgs evm.JsonTxArgs, contextBlock rpc.BlockNumber, config *evm.TraceConfig, ) (interface{}, error)
TraceCall implements eth debug_traceCall method which lets you run an eth_call within the context of the given block execution using the final state of parent block as the base. Method returns the structured logs created during the execution of EVM. The method returns the same output as debug_traceTransaction. https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracecall
func (*Backend) TraceTransaction ¶
func (b *Backend) TraceTransaction(hash gethcommon.Hash, config *evm.TraceConfig) (interface{}, error)
TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type CosmosBackend ¶
type CosmosBackend interface { }
CosmosBackend: Currently unused. Backend functionality for the shared "cosmos" RPC namespace. Implements [BackendI] in combination with Backend. TODO: feat(eth): Implement the cosmos JSON-RPC defined by Wallet Connect V2: https://docs.walletconnect.com/2.0/json-rpc/cosmos.
type TransactionReceipt ¶
type TransactionReceipt struct { gethcore.Receipt ContractAddress *gethcommon.Address `json:"contractAddress,omitempty"` From gethcommon.Address To *gethcommon.Address EffectiveGasPrice *big.Int }
TransactionReceipt represents the results of a transaction. TransactionReceipt is an extension of gethcore.Receipt, the response type for the "eth_getTransactionReceipt" JSON-RPC method. Reason being, the gethcore.Receipt struct has an incorrect JSON struct tag on one field and doesn't marshal JSON as expected, so we embed and extend it here.