eth

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalError        = errors.New("internal error")
	ErrIndexOutOfRange      = errors.New("index out of range")
	ErrMalformedTransaction = errors.New("malformed transaction")
	ErrMalformedBlockNumber = errors.New("malformed blocknumber")
	ErrInvalidRequest       = errors.New("invalid request")
)

Functions

This section is empty.

Types

type PublicAPI

type PublicAPI struct {
	Logger *logging.Logger
	// contains filtered or unexported fields
}

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

func NewPublicAPI

func NewPublicAPI(
	ctx context.Context,
	client client.RuntimeClient,
	logger *logging.Logger,
	chainID uint32,
	backend indexer.Backend,
	methodLimits *conf.MethodLimits,
) *PublicAPI

NewPublicAPI creates an instance of the public ETH Web3 API.

func (*PublicAPI) Accounts

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

Accounts returns the list of accounts available to this node.

func (*PublicAPI) BlockNumber

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

BlockNumber returns the latest block number.

func (*PublicAPI) Call

Call executes the given transaction on the state for the given block number. This function doesn't make any changes in the evm state of blockchain.

func (*PublicAPI) ChainId

func (api *PublicAPI) ChainId() (*hexutil.Big, error)

nolint:revive,stylecheck ChainId return the EIP-155 chain id for the current network.

func (*PublicAPI) EstimateGas

func (api *PublicAPI) EstimateGas(args utils.TransactionArgs, blockNum *ethrpc.BlockNumber) (hexutil.Uint64, error)

EstimateGas returns an estimate of gas usage for the given transaction .

func (*PublicAPI) GasPrice

func (api *PublicAPI) GasPrice() (*hexutil.Big, error)

GasPrice returns a suggestion for a gas price for legacy transactions.

func (*PublicAPI) GetBalance

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

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

func (*PublicAPI) GetBlockByHash

func (api *PublicAPI) GetBlockByHash(blockHash common.Hash, fullTx bool) (map[string]interface{}, error)

GetBlockByHash returns the block identified by hash.

func (*PublicAPI) GetBlockByNumber

func (api *PublicAPI) GetBlockByNumber(blockNum ethrpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber returns the block identified by number.

func (*PublicAPI) GetBlockHash

func (api *PublicAPI) GetBlockHash(blockNum ethrpc.BlockNumber, _ bool) (common.Hash, error)

GetBlockHash returns the block hash by the given number.

func (*PublicAPI) GetBlockTransactionCountByHash

func (api *PublicAPI) GetBlockTransactionCountByHash(blockHash common.Hash) (hexutil.Uint, error)

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

func (*PublicAPI) GetBlockTransactionCountByNumber

func (api *PublicAPI) GetBlockTransactionCountByNumber(blockNum ethrpc.BlockNumber) (hexutil.Uint, error)

GetBlockTransactionCountByNumber returns the number of transactions in the block.

func (*PublicAPI) GetCode

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

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

func (*PublicAPI) GetLogs

func (api *PublicAPI) GetLogs(filter filters.FilterCriteria) ([]*ethtypes.Log, error)

GetLogs returns the ethereum logs.

func (*PublicAPI) GetStorageAt

func (api *PublicAPI) GetStorageAt(address common.Address, position hexutil.Big, blockNrOrHash ethrpc.BlockNumberOrHash) (hexutil.Big, error)

func (*PublicAPI) GetTransactionByBlockHashAndIndex

func (api *PublicAPI) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*utils.RPCTransaction, error)

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

func (*PublicAPI) GetTransactionByBlockNumberAndIndex

func (api *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum ethrpc.BlockNumber, index hexutil.Uint) (*utils.RPCTransaction, error)

GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.

func (*PublicAPI) GetTransactionByHash

func (api *PublicAPI) GetTransactionByHash(hash common.Hash) (*utils.RPCTransaction, error)

GetTransactionByHash returns the transaction identified by hash.

func (*PublicAPI) GetTransactionCount

func (api *PublicAPI) GetTransactionCount(ethAddr common.Address, blockNrOrHash ethrpc.BlockNumberOrHash) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions the given address has sent for the given block number.

func (*PublicAPI) GetTransactionReceipt

func (api *PublicAPI) GetTransactionReceipt(txHash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt by hash.

func (*PublicAPI) Hashrate

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

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

func (*PublicAPI) Mining

func (api *PublicAPI) Mining() bool

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

func (*PublicAPI) NewRevertError

func (api *PublicAPI) NewRevertError(revertErr error) *RevertError

NewRevertError returns an revert error with ABI encoded revert reason.

func (*PublicAPI) SendRawTransaction

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

SendRawTransaction send a raw Ethereum transaction.

type RevertError

type RevertError struct {
	Reason string `json:"reason"`
	// contains filtered or unexported fields
}

func (*RevertError) ErrorData

func (e *RevertError) ErrorData() interface{}

ErrorData returns the ABI encoded error reason.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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