eth

package
v0.0.0-...-add777e Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

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 {
	// 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) 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) GetBalance

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

GetBalance 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, blockNumber rpctypes.BlockNumber) (hexutil.Bytes, error)

GetCode 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, block rpctypes.BlockNumber) (*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, blockNum rpctypes.BlockNumber) (hexutil.Bytes, error)

GetStorageAt 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, blockNum rpctypes.BlockNumber) (*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) (interface{}, error)

GetTransactionReceipt returns the transaction receipt identified by hash.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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