backend

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: LGPL-3.0 Imports: 54 Imported by: 0

Documentation

Overview

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Copyright 2022 Evmos Foundation This file is part of the Evmos Network packages.

Evmos is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Evmos packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Evmos packages. If not, see https://github.com/evmos/evmos/blob/main/LICENSE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTxLogsFromEvents

func AllTxLogsFromEvents(events []abci.Event) ([][]*ethtypes.Log, error)

AllTxLogsFromEvents parses all ethereum logs from cosmos events

func GetHexProofs

func GetHexProofs(proof *crypto.ProofOps) []string

GetHexProofs returns list of hex data of proof op

func GetLogsFromBlockResults

func GetLogsFromBlockResults(blockRes *tmrpctypes.ResultBlockResults) ([][]*ethtypes.Log, error)

GetLogsFromBlockResults returns the list of event logs from the tendermint block result response

func ParseTxLogsFromEvent

func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error)

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 TxLogsFromEvents

func TxLogsFromEvents(events []abci.Event, msgIndex int) ([]*ethtypes.Log, error)

TxLogsFromEvents parses ethereum logs from cosmos events for specific msg index

Types

type Backend

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

Backend implements the BackendI interface

func NewBackend

func NewBackend(
	ctx *server.Context,
	logger log.Logger,
	clientCtx client.Context,
	allowUnprotectedTxs bool,
	indexer evmostypes.EVMTxIndexer,
) *Backend

NewBackend creates a new Backend instance for cosmos and ethereum namespaces

func (*Backend) Accounts

func (b *Backend) Accounts() ([]common.Address, error)

Accounts returns the list of accounts available to this node.

func (*Backend) BaseFee

func (b *Backend) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error)

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

func (b *Backend) BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error)

BlockBloom query block bloom filter from block results

func (*Backend) BlockNumber

func (b *Backend) BlockNumber() (hexutil.Uint64, error)

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 rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error)

BlockNumberFromTendermint returns the BlockNumber from BlockNumberOrHash

func (*Backend) BlockNumberFromTendermintByHash

func (b *Backend) BlockNumberFromTendermintByHash(blockHash common.Hash) (*big.Int, error)

BlockNumberFromTendermintByHash returns the block height of given block hash

func (*Backend) BloomStatus

func (b *Backend) BloomStatus() (uint64, uint64)

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) ChainID

func (b *Backend) ChainID() (*hexutil.Big, error)

ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config.

func (*Backend) CurrentHeader

func (b *Backend) CurrentHeader() *ethtypes.Header

CurrentHeader returns the latest block header

func (*Backend) DoCall

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 evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error)

EstimateGas returns an estimate of gas usage for the given smart contract call.

func (*Backend) EthBlockByNumber

func (b *Backend) EthBlockByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Block, error)

EthBlockByNumber returns the Ethereum Block identified by number.

func (*Backend) EthBlockFromTendermintBlock

func (b *Backend) EthBlockFromTendermintBlock(
	resBlock *tmrpctypes.ResultBlock,
	blockRes *tmrpctypes.ResultBlockResults,
) (*ethtypes.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,
) []*evmtypes.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 math.HexOrDecimal64,
	lastBlock rpc.BlockNumber,
	rewardPercentiles []float64,
) (*rpctypes.FeeHistoryResult, error)

FeeHistory returns data relevant for fee estimation based on the specified range of blocks.

func (*Backend) GasPrice

func (b *Backend) GasPrice() (*hexutil.Big, error)

GasPrice returns the current gas price based on Ethermint's gas price oracle.

func (*Backend) GetBalance

func (b *Backend) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error)

GetBalance returns the provided account's balance up to the provided block number.

func (*Backend) GetBlockByHash

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

GetBlockByHash returns the JSON-RPC compatible Ethereum block identified by hash.

func (*Backend) GetBlockByNumber

func (b *Backend) GetBlockByNumber(blockNum rpctypes.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 common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of Ethereum transactions in the block identified by hash.

func (*Backend) GetBlockTransactionCountByNumber

func (b *Backend) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of Ethereum transactions in the block identified by number.

func (*Backend) GetCode

func (b *Backend) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error)

GetCode returns the contract code at the given address and block 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) GetGasUsed

func (b *Backend) GetGasUsed(res *types.TxResult, price *big.Int, gas uint64) uint64

GetGasUsed returns gasUsed from transaction

func (*Backend) GetLogs

func (b *Backend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error)

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

func (*Backend) GetLogsByHeight

func (b *Backend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error)

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

func (*Backend) GetProof

func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error)

GetProof returns an account object with proof and any storage proofs

func (*Backend) GetStorageAt

func (b *Backend) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.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) (*rpctypes.RPCTransaction, error)

GetTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`.

func (*Backend) GetTransactionByBlockHashAndIndex

func (b *Backend) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)

GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index.

func (*Backend) GetTransactionByBlockNumberAndIndex

func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)

GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.

func (*Backend) GetTransactionByHash

func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error)

GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash

func (*Backend) GetTransactionCount

func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes.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 common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt identified by hash.

func (*Backend) GetTxByEthHash

func (b *Backend) GetTxByEthHash(hash common.Hash) (*types.TxResult, error)

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

func (b *Backend) GetTxByTxIndex(height int64, index uint) (*types.TxResult, error)

GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs

func (*Backend) GlobalMinGasPrice

func (b *Backend) GlobalMinGasPrice() (sdk.Dec, error)

GlobalMinGasPrice returns MinGasPrice param from FeeMarket

func (*Backend) HeaderByHash

func (b *Backend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)

HeaderByHash returns the block header identified by hash.

func (*Backend) HeaderByNumber

func (b *Backend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error)

HeaderByNumber returns the block header identified by height.

func (*Backend) ImportRawKey

func (b *Backend) ImportRawKey(privkey, password string) (common.Address, error)

ImportRawKey armors and encrypts a given raw hex encoded ECDSA key and stores it into the key directory. The name of the key will have the format "personal_<length-keys>", where <length-keys> is the total number of keys stored on the keyring.

NOTE: The key will be both armored and encrypted using the same passphrase.

func (*Backend) ListAccounts

func (b *Backend) ListAccounts() ([]common.Address, error)

ListAccounts will return a list of addresses for accounts this node manages.

func (*Backend) NewMnemonic

func (b *Backend) NewMnemonic(uid string,
	_ keyring.Language,
	hdPath,
	bip39Passphrase string,
	algo keyring.SignatureAlgo,
) (*keyring.Record, error)

NewAccount will create a new account and returns the address for the new account.

func (*Backend) PendingTransactions

func (b *Backend) PendingTransactions() ([]*sdk.Tx, 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.

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

func (b *Backend) RPCBlockRangeCap() int32

RPCBlockRangeCap defines the max block range allowed for `eth_getLogs` query.

func (*Backend) RPCEVMTimeout

func (b *Backend) RPCEVMTimeout() time.Duration

RPCEVMTimeout is the global evm timeout for eth-call variants.

func (*Backend) RPCFeeHistoryCap

func (b *Backend) RPCFeeHistoryCap() int32

RPCFeeHistoryCap is the limit for total number of blocks that can be fetched

func (*Backend) RPCFilterCap

func (b *Backend) RPCFilterCap() int32

RPCFilterCap is the limit for total number of filters that can be created

func (*Backend) RPCGasCap

func (b *Backend) RPCGasCap() uint64

RPCGasCap is the global gas cap for eth-call variants.

func (*Backend) RPCLogsCap

func (b *Backend) RPCLogsCap() int32

RPCLogsCap defines the max number of results can be returned from single `eth_getLogs` query.

func (*Backend) RPCMinGasPrice

func (b *Backend) RPCMinGasPrice() int64

func (*Backend) RPCTxFeeCap

func (b *Backend) RPCTxFeeCap() float64

RPCGasCap is the global gas cap for eth-call variants.

func (*Backend) Resend

func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)

Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.

func (*Backend) SendRawTransaction

func (b *Backend) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)

SendRawTransaction send a raw Ethereum transaction.

func (*Backend) SendTransaction

func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)

SendTransaction sends transaction based on received args using Node's key to sign it

func (*Backend) SetEtherbase

func (b *Backend) SetEtherbase(etherbase common.Address) bool

SetEtherbase sets the etherbase of the miner

func (*Backend) SetGasPrice

func (b *Backend) SetGasPrice(gasPrice hexutil.Big) bool

SetGasPrice sets the minimum accepted gas price for the miner. NOTE: this function accepts only integers to have the same interface than go-eth to use float values, the gas prices must be configured using the configuration file

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

func (*Backend) Sign

func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

Sign signs the provided data using the private key of address via Geth's signature standard.

func (*Backend) SignTypedData

func (b *Backend) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error)

SignTypedData signs EIP-712 conformant typed data

func (*Backend) SuggestGasTipCap

func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error)

SuggestGasTipCap returns the suggested tip cap Although we don't support tx prioritization yet, but we return a positive value to help client to mitigate the base fee changes.

func (*Backend) Syncing

func (b *Backend) Syncing() (interface{}, error)

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 pears. 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 common.Hash) (*tmrpctypes.ResultBlock, error)

TendermintBlockByHash returns a Tendermint-formatted block by block number

func (*Backend) TendermintBlockByNumber

func (b *Backend) TendermintBlockByNumber(blockNum rpctypes.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 rpctypes.BlockNumber,
	config *evmtypes.TraceConfig,
	block *tmrpctypes.ResultBlock,
) ([]*evmtypes.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) TraceTransaction

func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) (interface{}, error)

TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (Backend) UnprotectedAllowed

func (b Backend) UnprotectedAllowed() bool

UnprotectedAllowed returns the node configuration value for allowing unprotected transactions (i.e not replay-protected)

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 {
	// Node specific queries
	Accounts() ([]common.Address, error)
	Syncing() (interface{}, error)
	SetEtherbase(etherbase common.Address) bool
	SetGasPrice(gasPrice hexutil.Big) bool
	ImportRawKey(privkey, password string) (common.Address, error)
	ListAccounts() ([]common.Address, error)
	NewMnemonic(uid string, language keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo) (*keyring.Record, error)
	UnprotectedAllowed() bool
	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

	// Sign Tx
	Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
	SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)
	SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error)

	// Blocks Info
	BlockNumber() (hexutil.Uint64, error)
	GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error)
	GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)
	GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint
	GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint
	TendermintBlockByNumber(blockNum rpctypes.BlockNumber) (*tmrpctypes.ResultBlock, error)
	TendermintBlockResultByNumber(height *int64) (*tmrpctypes.ResultBlockResults, error)
	TendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error)
	BlockNumberFromTendermint(blockNrOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error)
	BlockNumberFromTendermintByHash(blockHash common.Hash) (*big.Int, error)
	EthMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx
	BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error)
	HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error)
	HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)
	RPCBlockFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults, fullTx bool) (map[string]interface{}, error)
	EthBlockByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Block, error)
	EthBlockFromTendermintBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*ethtypes.Block, error)

	// Account Info
	GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error)
	GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error)
	GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error)
	GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error)
	GetTransactionCount(address common.Address, blockNum rpctypes.BlockNumber) (*hexutil.Uint64, error)

	// Chain Info
	ChainID() (*hexutil.Big, error)
	ChainConfig() *params.ChainConfig
	GlobalMinGasPrice() (sdk.Dec, error)
	BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error)
	CurrentHeader() *ethtypes.Header
	PendingTransactions() ([]*sdk.Tx, error)
	GetCoinbase() (sdk.AccAddress, error)
	FeeHistory(blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error)
	SuggestGasTipCap(baseFee *big.Int) (*big.Int, error)

	// Tx Info
	GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error)
	GetTxByEthHash(txHash common.Hash) (*evmostypes.TxResult, error)
	GetTxByTxIndex(height int64, txIndex uint) (*evmostypes.TxResult, error)
	GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
	GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error)
	GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
	GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)

	// Send Transaction
	Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)
	SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
	SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error)
	EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error)
	DoCall(args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber) (*evmtypes.MsgEthereumTxResponse, error)
	GasPrice() (*hexutil.Big, error)

	// Filter API
	GetLogs(hash common.Hash) ([][]*ethtypes.Log, error)
	GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error)
	BloomStatus() (uint64, uint64)

	// Tracing
	TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) (interface{}, error)
	TraceBlock(height rpctypes.BlockNumber, config *evmtypes.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error)
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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