eth

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 48 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CacheOfEthCallLru = 40960

	FlagEnableMultiCall = "rpc.enable-multi-call"
)
View Source
const (
	FlagEnableTxPool      = "enable-tx-pool"
	TxPoolCap             = "tx-pool-cap"
	BroadcastPeriodSecond = "broadcast-period-second"
)
View Source
const (
	DefaultEVMErrorCode          = -32000
	VMExecuteException           = -32015
	VMExecuteExceptionInEstimate = 3

	RPCEthCall           = "eth_call"
	RPCEthEstimateGas    = "eth_estimateGas"
	RPCEthGetBlockByHash = "eth_getBlockByHash"

	RPCUnknowErr = "unknow"
	RPCNullData  = "null"
)

Variables

This section is empty.

Functions

func CheckError

func CheckError(txRes sdk.TxResponse) (common.Hash, error)

func ParseGasPrice

func ParseGasPrice() *hexutil.Big

gasPrice: to get "minimum-gas-prices" config or to get ethermint.DefaultGasPrice

func TransformDataError

func TransformDataError(err error, method string) error

Types

type DataError

type DataError struct {
	Msg string `json:"msg"`
	// contains filtered or unexported fields
}

func (DataError) Error

func (d DataError) Error() string

func (DataError) ErrorCode

func (d DataError) ErrorCode() int

func (DataError) ErrorData

func (d DataError) ErrorData() interface{}

type PublicEthereumAPI

type PublicEthereumAPI struct {
	Metrics map[string]*monitor.RpcMetrics
	// contains filtered or unexported fields
}

PublicEthereumAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.

func NewAPI

func NewAPI(
	clientCtx clientcontext.CLIContext, log log.Logger, backend backend.Backend, nonceLock *rpctypes.AddrLocker,
	keys ...ethsecp256k1.PrivKey,
) *PublicEthereumAPI

NewAPI creates an instance of the public ETH Web3 API.

func (*PublicEthereumAPI) Accounts

func (api *PublicEthereumAPI) Accounts() ([]common.Address, error)

Accounts returns the list of accounts available to this node.

func (*PublicEthereumAPI) BlockNumber

func (api *PublicEthereumAPI) BlockNumber() (hexutil.Uint64, error)

BlockNumber returns the current block number.

func (*PublicEthereumAPI) Call

Call performs a raw contract call.

func (*PublicEthereumAPI) ChainId

func (api *PublicEthereumAPI) ChainId() (hexutil.Uint, error)

ChainId returns the chain's identifier in hex format

func (*PublicEthereumAPI) ClientCtx

func (api *PublicEthereumAPI) ClientCtx() clientcontext.CLIContext

ClientCtx returns the Cosmos SDK client context.

func (*PublicEthereumAPI) Coinbase

func (api *PublicEthereumAPI) Coinbase() (common.Address, error)

Coinbase is the address that staking rewards will be send to (alias for Etherbase).

func (*PublicEthereumAPI) DeleteTxTrace added in v0.19.14

func (api *PublicEthereumAPI) DeleteTxTrace(txHash common.Hash) string

DeleteTxTrace delete the trace of tx execution by txhash.

func (*PublicEthereumAPI) EstimateGas

func (api *PublicEthereumAPI) EstimateGas(args rpctypes.CallArgs) (hexutil.Uint64, error)

EstimateGas returns an estimate of gas usage for the given smart contract call. It adds 1,000 gas to the returned value instead of using the gas adjustment param from the SDK.

func (*PublicEthereumAPI) GasPrice

func (api *PublicEthereumAPI) GasPrice() *hexutil.Big

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

func (*PublicEthereumAPI) GetAccount added in v0.18.7

func (api *PublicEthereumAPI) GetAccount(address common.Address) (*ethermint.EthAccount, error)

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

func (*PublicEthereumAPI) GetBalance

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

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

func (*PublicEthereumAPI) GetBalanceBatch added in v1.0.0

func (api *PublicEthereumAPI) GetBalanceBatch(addresses []common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (interface{}, error)

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

func (*PublicEthereumAPI) GetBlockByHash

func (api *PublicEthereumAPI) GetBlockByHash(hash common.Hash, fullTx bool) (interface{}, error)

GetBlockByHash returns the block identified by hash.

func (*PublicEthereumAPI) GetBlockByNumber

func (api *PublicEthereumAPI) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (interface{}, error)

GetBlockByNumber returns the block identified by number.

func (*PublicEthereumAPI) GetBlockTransactionCountByHash

func (api *PublicEthereumAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint

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

func (*PublicEthereumAPI) GetBlockTransactionCountByNumber

func (api *PublicEthereumAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block identified by its height.

func (*PublicEthereumAPI) GetCode

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

GetCode returns the contract code at the given address and block number.

func (*PublicEthereumAPI) GetCodeByHash added in v0.18.7

func (api *PublicEthereumAPI) GetCodeByHash(hash common.Hash) (hexutil.Bytes, error)

GetCodeByHash returns the contract code at the given address and block number.

func (*PublicEthereumAPI) GetKeyringInfo

func (api *PublicEthereumAPI) GetKeyringInfo() error

GetKeyringInfo checks if the keyring is present on the client context. If not, it creates a new instance and sets it to the client context for later usage.

func (*PublicEthereumAPI) GetKeys

func (api *PublicEthereumAPI) GetKeys() []ethsecp256k1.PrivKey

GetKeys returns the Cosmos SDK client context.

func (*PublicEthereumAPI) GetProof

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

GetProof returns an account object with proof and any storage proofs

func (*PublicEthereumAPI) GetStorageAt

func (api *PublicEthereumAPI) 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 (*PublicEthereumAPI) GetStorageAtInternal added in v0.18.7

func (api *PublicEthereumAPI) GetStorageAtInternal(address common.Address, key []byte) (hexutil.Bytes, error)

GetStorageAtInternal returns the contract storage at the given address, block number, and key.

func (*PublicEthereumAPI) GetTransactionByBlockHashAndIndex

func (api *PublicEthereumAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.Transaction, error)

GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index.

func (*PublicEthereumAPI) GetTransactionByBlockNumberAndIndex

func (api *PublicEthereumAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.Transaction, error)

GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.

func (*PublicEthereumAPI) GetTransactionByHash

func (api *PublicEthereumAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.Transaction, error)

GetTransactionByHash returns the transaction identified by hash.

func (*PublicEthereumAPI) GetTransactionCount

func (api *PublicEthereumAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions at the given address up to the given block number.

func (*PublicEthereumAPI) GetTransactionLogs

func (api *PublicEthereumAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)

GetTransactionLogs returns the logs given a transaction hash.

func (*PublicEthereumAPI) GetTransactionReceipt

func (api *PublicEthereumAPI) GetTransactionReceipt(hash common.Hash) (*watcher.TransactionReceipt, error)

GetTransactionReceipt returns the transaction receipt identified by hash.

func (*PublicEthereumAPI) GetTransactionReceiptsByBlock added in v0.19.14

func (api *PublicEthereumAPI) GetTransactionReceiptsByBlock(blockNrOrHash rpctypes.BlockNumberOrHash, offset, limit hexutil.Uint) ([]*watcher.TransactionReceipt, error)

GetTransactionReceiptsByBlock returns the transaction receipt identified by block hash or number.

func (*PublicEthereumAPI) GetTransactionsByBlock added in v0.19.14

func (api *PublicEthereumAPI) GetTransactionsByBlock(blockNrOrHash rpctypes.BlockNumberOrHash, offset, limit hexutil.Uint) ([]*rpctypes.Transaction, error)

GetTransactionsByBlock returns some transactions identified by number or hash.

func (*PublicEthereumAPI) GetTxTrace added in v0.19.14

func (api *PublicEthereumAPI) GetTxTrace(txHash common.Hash) json.RawMessage

GetTxTrace returns the trace of tx execution by txhash.

func (*PublicEthereumAPI) GetUncleByBlockHashAndIndex

func (api *PublicEthereumAPI) GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{}

GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil.

func (*PublicEthereumAPI) GetUncleByBlockNumberAndIndex

func (api *PublicEthereumAPI) GetUncleByBlockNumberAndIndex(number hexutil.Uint, idx hexutil.Uint) map[string]interface{}

GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil.

func (*PublicEthereumAPI) GetUncleCountByBlockHash

func (api *PublicEthereumAPI) GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint

GetUncleCountByBlockHash returns the number of uncles in the block idenfied by hash. Always zero.

func (*PublicEthereumAPI) GetUncleCountByBlockNumber

func (api *PublicEthereumAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.Uint

GetUncleCountByBlockNumber returns the number of uncles in the block idenfied by number. Always zero.

func (*PublicEthereumAPI) Hashrate

func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64

Hashrate returns the current node's hashrate. Always 0.

func (*PublicEthereumAPI) Mining

func (api *PublicEthereumAPI) Mining() bool

Mining returns whether or not this node is currently mining. Always false.

func (*PublicEthereumAPI) MultiCall added in v0.19.2

func (api *PublicEthereumAPI) MultiCall(args []rpctypes.CallArgs, blockNr rpctypes.BlockNumber, _ *map[common.Address]rpctypes.Account) ([]hexutil.Bytes, error)

MultiCall performs multiple raw contract call.

func (*PublicEthereumAPI) PendingTransactions

func (api *PublicEthereumAPI) PendingTransactions() ([]*rpctypes.Transaction, 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 (*PublicEthereumAPI) PendingTransactionsByHash added in v0.17.5

func (api *PublicEthereumAPI) PendingTransactionsByHash(target common.Hash) (*rpctypes.Transaction, error)

func (*PublicEthereumAPI) ProtocolVersion

func (api *PublicEthereumAPI) ProtocolVersion() hexutil.Uint

ProtocolVersion returns the supported Ethereum protocol version.

func (*PublicEthereumAPI) SendRawTransaction

func (api *PublicEthereumAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)

SendRawTransaction send a raw Ethereum transaction.

func (*PublicEthereumAPI) SendTransaction

func (api *PublicEthereumAPI) SendTransaction(args rpctypes.SendTxArgs) (common.Hash, error)

SendTransaction sends an Ethereum transaction.

func (*PublicEthereumAPI) SetKeys

func (api *PublicEthereumAPI) SetKeys(keys []ethsecp256k1.PrivKey)

SetKeys sets the given key slice to the set of private keys

func (*PublicEthereumAPI) Sign

func (api *PublicEthereumAPI) 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 (*PublicEthereumAPI) Syncing

func (api *PublicEthereumAPI) Syncing() (interface{}, error)

Syncing returns whether or not the current node is syncing with other peers. Returns false if not, or a struct outlining the state of the sync if it is.

type TxPool added in v0.18.8

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

func NewTxPool added in v0.18.8

func NewTxPool(clientCtx clientcontext.CLIContext, api *PublicEthereumAPI) *TxPool

func (*TxPool) CacheAndBroadcastTx added in v0.18.8

func (pool *TxPool) CacheAndBroadcastTx(api *PublicEthereumAPI, address common.Address, tx *evmtypes.MsgEthereumTx) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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