Documentation ¶
Overview ¶
NOTE: Legacy!!!
Index ¶
- Constants
- Variables
- func ContextWithHeight(height int64) context.Context
- func FindAttribute(attrs []abci.EventAttribute, key string) string
- func FindEthereumTxEvent(events []abci.Event, txHash string) (int, *evmtypes.EventEthereumTx)
- func FormatTmHeaderToProto(header *tmtypes.Header) tmproto.Header
- func GetBlockBloom(blockResults *tmrpccoretypes.ResultBlockResults) (ethtypes.Bloom, error)
- func GetBlockCumulativeGas(blockResults *tmrpccoretypes.ResultBlockResults, idx int) uint64
- func GetNonEVMSignatures(sig []byte) (v, r, s *big.Int)
- func GetPendingTxCountByAddress(txDecoder sdk.TxDecoder, mem mempool.Mempool, address common.Address) (total uint64)
- func GetPendingTxsLen(mem mempool.Mempool) int
- func GetProof(height int64, storeKey string, key []byte) ([]byte, *crypto.ProofOps, error)
- func GetTxHash(txDecoder sdk.TxDecoder, tmTx tmtypes.Tx) (common.Hash, error)
- func HashToUint64(s string) uint64
- func IsPruneError(err error) bool
- func RawTxToEthTx(clientCtx client.Context, txBz tmtypes.Tx) ([]*evmtypes.MsgEthereumTx, error)
- type AccountResult
- type AddrLocker
- type Block
- type BlockNumber
- type BlockNumberOrHash
- type DataError
- type FeeHistoryResult
- type Header
- type OneFeeHistory
- type OverrideAccount
- type QueryClient
- type SDKTxLogs
- type SignTransactionResult
- type StateOverride
- type StorageResult
- type Transaction
- func GetPendingTx(txDecoder sdk.TxDecoder, mem mempool.Mempool, hash common.Hash) (*Transaction, error)
- func GetPendingTxs(txDecoder sdk.TxDecoder, mem mempool.Mempool) []*Transaction
- func NewRPCTransaction(tx *ethtypes.Transaction, blockHash *common.Hash, blockNumber, index *uint64) (*Transaction, error)
- func TmTxToEthTx(txDecoder sdk.TxDecoder, tmTx tmtypes.Tx, blockHash *common.Hash, ...) (*Transaction, error)
- type TransactionReceipt
- type Transactions
- type TxByNonce
Constants ¶
const ( EthPendingBlockNumber = BlockNumber(-2) EthLatestBlockNumber = BlockNumber(-1) EthEarliestBlockNumber = BlockNumber(0) EthInitialBlockNumber = BlockNumber(1) )
const ( BlockParamEarliest = "earliest" BlockParamLatest = "latest" BlockParamPending = "pending" )
const LogRevertedFlag = "transaction reverted"
Variables ¶
var ErrNotArchiveNode = fmt.Errorf("the data is available only in the archive node")
var MempoolCapacity = 100
Functions ¶
func ContextWithHeight ¶
ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is 0, it will return an empty context and the gRPC query will use the latest block height for querying. Note that all metadata are processed and removed by tendermint layer, so it wont be accessible at gRPC server level. NOTE: Legacy, should be removed after cli rework
func FindAttribute ¶
func FindAttribute(attrs []abci.EventAttribute, key string) string
FindAttribute find event attribute with specified key, if not found returns nil.
func FindEthereumTxEvent ¶ added in v0.12.0
FindEthereumTxEvent returns the msg index of the eth tx in cosmos tx, and the tx evt, returns -1 and nil if not found.
func FormatTmHeaderToProto ¶ added in v0.10.0
func GetBlockBloom ¶ added in v0.10.0
func GetBlockBloom(blockResults *tmrpccoretypes.ResultBlockResults) (ethtypes.Bloom, error)
func GetBlockCumulativeGas ¶ added in v0.10.0
func GetBlockCumulativeGas(blockResults *tmrpccoretypes.ResultBlockResults, idx int) uint64
GetBlockCumulativeGas returns the cumulative gas used on a block up to a given transaction index. The returned gas used includes the gas from both the SDK and EVM module transactions.
func GetNonEVMSignatures ¶ added in v0.10.0
func GetPendingTxCountByAddress ¶ added in v0.10.0
func GetPendingTxCountByAddress(txDecoder sdk.TxDecoder, mem mempool.Mempool, address common.Address) (total uint64)
GetPendingTxCountByAddress is used to get pending tx count (nonce) for user address
func GetPendingTxsLen ¶ added in v0.10.0
func GetProof ¶ added in v0.10.0
GetProof performs an ABCI query with the given key and returns a merkle proof. The desired tendermint height to perform the query should be set in the client context. The query will be performed at one below this height (at the IAVL version) in order to obtain the correct merkle proof. Proof queries at height less than or equal to 2 are not supported. Issue: https://github.com/cosmos/cosmos-sdk/issues/6567
func GetTxHash ¶ added in v0.10.0
GetTxHash get hash depends on what type, unfortunately system support two tx hash algo in order to have opportunity for off chain tx hash computation
func HashToUint64 ¶ added in v0.10.0
HashToUint64 used to convert string or hash string to uint64
func IsPruneError ¶ added in v0.12.2
func RawTxToEthTx ¶
RawTxToEthTx returns an evm MsgEthereum transaction from raw tx bytes.
Types ¶
type AccountResult ¶
type AccountResult struct { Address common.Address `json:"address"` AccountProof []string `json:"accountProof"` Balance *hexutil.Big `json:"balance"` CodeHash common.Hash `json:"codeHash"` Nonce hexutil.Uint64 `json:"nonce"` StorageHash common.Hash `json:"storageHash"` StorageProof []StorageResult `json:"storageProof"` }
AccountResult struct for account proof
type AddrLocker ¶
type AddrLocker struct {
// contains filtered or unexported fields
}
AddrLocker is a mutex structure used to avoid querying outdated account data
func (*AddrLocker) LockAddr ¶
func (l *AddrLocker) LockAddr(address common.Address)
LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.
func (*AddrLocker) UnlockAddr ¶
func (l *AddrLocker) UnlockAddr(address common.Address)
UnlockAddr unlocks the mutex of the given account.
type Block ¶ added in v0.10.0
type Block struct { Number hexutil.Uint64 `json:"number"` Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` Nonce ethtypes.BlockNonce `json:"nonce"` Sha3Uncles common.Hash `json:"sha3Uncles"` LogsBloom ethtypes.Bloom `json:"logsBloom"` TransactionsRoot common.Hash `json:"transactionsRoot"` StateRoot common.Hash `json:"stateRoot"` Miner common.Address `json:"miner"` MixHash common.Hash `json:"mixHash"` Difficulty hexutil.Uint64 `json:"difficulty"` TotalDifficulty hexutil.Uint64 `json:"totalDifficulty"` ExtraData hexutil.Bytes `json:"extraData"` Size hexutil.Uint64 `json:"size"` GasLimit *hexutil.Big `json:"gasLimit"` GasUsed *hexutil.Big `json:"gasUsed"` Timestamp hexutil.Uint64 `json:"timestamp"` Uncles []common.Hash `json:"uncles"` Withdrawals []common.Hash `json:"withdrawals"` ReceiptsRoot common.Hash `json:"receiptsRoot"` Transactions []interface{} `json:"transactions"` BaseFee *hexutil.Big `json:"baseFeePerGas"` }
Block represents a block returned to RPC clients.
type BlockNumber ¶
type BlockNumber int64
BlockNumber represents decoding hex string to block values
func NewBlockNumber ¶
func NewBlockNumber(n *big.Int) BlockNumber
NewBlockNumber creates a new BlockNumber instance.
func (BlockNumber) Int64 ¶
func (bn BlockNumber) Int64() int64
Int64 converts block number to primitive type
func (BlockNumber) TmHeight ¶
func (bn BlockNumber) TmHeight() *int64
TmHeight is a util function used for the Tendermint RPC client. It returns nil if the block number is "latest". Otherwise, it returns the pointer of the int64 value of the height.
func (*BlockNumber) UnmarshalJSON ¶
func (bn *BlockNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports: - "latest", "earliest" or "pending" as string arguments - the block number Returned errors: - an invalid block number error when the given argument isn't a known strings - an out of range error when the given block number is either too little or too large
type BlockNumberOrHash ¶
type BlockNumberOrHash struct { BlockNumber *BlockNumber `json:"blockNumber,omitempty"` BlockHash *common.Hash `json:"blockHash,omitempty"` }
BlockNumberOrHash represents a block number or a block hash.
func (*BlockNumberOrHash) UnmarshalJSON ¶
func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error
type DataError ¶
type DataError interface { Error() string // returns the message ErrorData() interface{} // returns the error data }
func ErrRevertedWith ¶
type FeeHistoryResult ¶
type Header ¶ added in v0.10.0
type Header struct { Hash common.Hash `json:"hash" gencodec:"required"` ParentHash common.Hash `json:"parentHash" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` Coinbase common.Address `json:"miner" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` Bloom ethtypes.Bloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce ethtypes.BlockNonce `json:"nonce"` Size uint64 `json:"size"` BaseFee *big.Int `json:"baseFeePerGas"` }
Header NOTE: Forked because tendermint block hash calculated in another way default ethereum take rlp from the struct
type OneFeeHistory ¶
type OverrideAccount ¶
type OverrideAccount struct { Nonce *hexutil.Uint64 `json:"nonce"` Code *hexutil.Bytes `json:"code"` Balance **hexutil.Big `json:"balance"` State *map[common.Hash]common.Hash `json:"state"` StateDiff *map[common.Hash]common.Hash `json:"stateDiff"` }
OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.
type QueryClient ¶
type QueryClient struct { tx.ServiceClient evmtypes.QueryClient }
QueryClient defines a gRPC Client used for:
- Transaction simulation
- EVM module queries
- Fee market module queries
func NewQueryClient ¶
func NewQueryClient(clientCtx client.Context) *QueryClient
NewQueryClient creates a new gRPC query client
func (QueryClient) GetProof ¶
func (QueryClient) GetProof(clientCtx client.Context, storeKey string, key []byte) ([]byte, *crypto.ProofOps, error)
GetProof performs an ABCI query with the given key and returns a merkle proof. The desired tendermint height to perform the query should be set in the client context. The query will be performed at one below this height (at the IAVL version) in order to obtain the correct merkle proof. Proof queries at height less than or equal to 2 are not supported. Issue: https://github.com/cosmos/cosmos-sdk/issues/6567
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *ethtypes.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.
type StateOverride ¶
type StateOverride map[common.Address]OverrideAccount
StateOverride is the collection of overridden accounts.
type StorageResult ¶
type StorageResult struct { Key string `json:"key"` Value *hexutil.Big `json:"value"` Proof []string `json:"proof"` }
StorageResult defines the format for storage proof return
type Transaction ¶ added in v0.10.0
type Transaction struct { BlockHash *common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From common.Address `json:"from"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` Hash common.Hash `json:"hash"` Input hexutil.Bytes `json:"input"` Nonce hexutil.Uint64 `json:"nonce"` To *common.Address `json:"to"` TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` Value *hexutil.Big `json:"value"` Type hexutil.Uint64 `json:"type"` Accesses *ethtypes.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
Transaction represents a transaction that will serialize to the RPC representation of a transaction
func GetPendingTx ¶ added in v0.10.0
func GetPendingTxs ¶ added in v0.10.0
func GetPendingTxs(txDecoder sdk.TxDecoder, mem mempool.Mempool) []*Transaction
func NewRPCTransaction ¶
func NewRPCTransaction( tx *ethtypes.Transaction, blockHash *common.Hash, blockNumber, index *uint64, ) (*Transaction, error)
NewRPCTransaction returns a transaction that will serialize to the RPC representation, with the given location metadata set (if available).
type TransactionReceipt ¶ added in v0.10.0
type TransactionReceipt struct { // Consensus fields: These fields are defined by the Yellow Paper Status hexutil.Uint64 `json:"status"` CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed"` LogsBloom ethtypes.Bloom `json:"logsBloom"` Logs []*ethtypes.Log `json:"logs"` // Implementation fields: These fields are added by geth when processing a transaction. // They are stored in the chain database. TransactionHash common.Hash `json:"transactionHash"` ContractAddress *common.Address `json:"contractAddress"` GasUsed hexutil.Uint64 `json:"gasUsed"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. BlockHash common.Hash `json:"blockHash"` BlockNumber hexutil.Big `json:"blockNumber"` TransactionIndex hexutil.Uint64 `json:"transactionIndex"` // sender and receiver (contract or EOA) addresses From common.Address `json:"from"` To *common.Address `json:"to"` }
TransactionReceipt represents a mined transaction returned to RPC clients.
type Transactions ¶ added in v0.10.0
type Transactions []*Transaction
Transactions implements DerivableList for transactions.
func (Transactions) Len ¶ added in v0.10.0
func (s Transactions) Len() int
Len returns the length of s.