eth

package
Version: v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 10 Imported by: 4

Documentation

Overview

Package eth implements RPC API bindings for methods in the "eth" namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceFactory added in v0.2.0

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

func Balance

func Balance(addr common.Address) *BalanceFactory

Balance requests the balance of the given common.Address addr.

func (*BalanceFactory) AtBlock added in v0.2.0

func (f *BalanceFactory) AtBlock(blockNumber *big.Int) *BalanceFactory

func (*BalanceFactory) CreateRequest added in v0.2.0

func (f *BalanceFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*BalanceFactory) HandleResponse added in v0.2.0

func (f *BalanceFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*BalanceFactory) Returns added in v0.2.0

func (f *BalanceFactory) Returns(balance *big.Int) *BalanceFactory

type BlockByHashFactory added in v0.2.0

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

func BlockByHash added in v0.2.0

func BlockByHash(hash common.Hash) *BlockByHashFactory

BlockByHash requests the block with full transactions with the given hash.

func (*BlockByHashFactory) CreateRequest added in v0.2.0

func (f *BlockByHashFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*BlockByHashFactory) HandleResponse added in v0.2.0

func (f *BlockByHashFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*BlockByHashFactory) Returns added in v0.2.0

func (f *BlockByHashFactory) Returns(block *types.Block) *BlockByHashFactory

func (*BlockByHashFactory) ReturnsRAW added in v0.5.0

func (f *BlockByHashFactory) ReturnsRAW(block *RPCBlock) *BlockByHashFactory

type BlockByNumberFactory added in v0.2.0

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

func BlockByNumber added in v0.2.0

func BlockByNumber(number *big.Int) *BlockByNumberFactory

BlockByNumber requests the block with full transactions with the given number.

func (*BlockByNumberFactory) CreateRequest added in v0.2.0

func (f *BlockByNumberFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*BlockByNumberFactory) HandleResponse added in v0.2.0

func (f *BlockByNumberFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*BlockByNumberFactory) Returns added in v0.2.0

func (*BlockByNumberFactory) ReturnsRAW added in v0.5.0

func (f *BlockByNumberFactory) ReturnsRAW(block *RPCBlock) *BlockByNumberFactory

type BlockNumberFactory

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

func BlockNumber

func BlockNumber() *BlockNumberFactory

BlockNumber requests the number of the most recent block.

func (*BlockNumberFactory) CreateRequest

func (f *BlockNumberFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*BlockNumberFactory) HandleResponse

func (f *BlockNumberFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*BlockNumberFactory) Returns

func (f *BlockNumberFactory) Returns(blockNumber *big.Int) *BlockNumberFactory

type CallFactory

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

func Call

func Call(msg ethereum.CallMsg) *CallFactory

Call requests the output data of the given message.

func (*CallFactory) AtBlock

func (f *CallFactory) AtBlock(blockNumber *big.Int) *CallFactory

func (*CallFactory) CreateRequest

func (f *CallFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*CallFactory) HandleResponse

func (f *CallFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*CallFactory) Returns

func (f *CallFactory) Returns(output *[]byte) *CallFactory

type CallFuncFactory

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

func CallFunc

func CallFunc(fn core.Func, contract common.Address, args ...interface{}) *CallFuncFactory

CallFunc requests the returns of Func fn at common.Address contract with the given args.

func (*CallFuncFactory) AtBlock

func (f *CallFuncFactory) AtBlock(blockNumber *big.Int) *CallFuncFactory

func (*CallFuncFactory) CreateRequest

func (f *CallFuncFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*CallFuncFactory) HandleResponse

func (f *CallFuncFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*CallFuncFactory) Returns

func (f *CallFuncFactory) Returns(returns ...interface{}) *CallFuncFactory

type ChainIDFactory

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

func ChainID

func ChainID() *ChainIDFactory

ChainID requests the chains ID.

func (*ChainIDFactory) CreateRequest

func (f *ChainIDFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*ChainIDFactory) HandleResponse

func (f *ChainIDFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*ChainIDFactory) Returns

func (f *ChainIDFactory) Returns(chainID *uint64) *ChainIDFactory

type CodeFactory added in v0.2.0

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

func Code

func Code(addr common.Address) *CodeFactory

Code requests the contract code of the given common.Address addr.

func (*CodeFactory) AtBlock added in v0.2.0

func (f *CodeFactory) AtBlock(blockNumber *big.Int) *CodeFactory

func (*CodeFactory) CreateRequest added in v0.2.0

func (f *CodeFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*CodeFactory) HandleResponse added in v0.2.0

func (f *CodeFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*CodeFactory) Returns added in v0.2.0

func (f *CodeFactory) Returns(code *[]byte) *CodeFactory

type GasPriceFactory

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

func GasPrice

func GasPrice() *GasPriceFactory

GasPrice requests the current gas price in wei.

func (*GasPriceFactory) CreateRequest

func (f *GasPriceFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*GasPriceFactory) HandleResponse

func (f *GasPriceFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*GasPriceFactory) Returns

func (f *GasPriceFactory) Returns(gasPrice *big.Int) *GasPriceFactory

type HeaderByHashFactory added in v0.2.0

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

func HeaderByHash added in v0.2.0

func HeaderByHash(hash common.Hash) *HeaderByHashFactory

HeaderByHash requests the header with the given hash.

func (*HeaderByHashFactory) CreateRequest added in v0.2.0

func (f *HeaderByHashFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*HeaderByHashFactory) HandleResponse added in v0.2.0

func (f *HeaderByHashFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*HeaderByHashFactory) Returns added in v0.2.0

func (f *HeaderByHashFactory) Returns(header *types.Header) *HeaderByHashFactory

func (*HeaderByHashFactory) ReturnsRAW added in v0.5.0

func (f *HeaderByHashFactory) ReturnsRAW(header *RPCHeader) *HeaderByHashFactory

type HeaderByNumberFactory added in v0.2.0

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

func HeaderByNumber added in v0.2.0

func HeaderByNumber(number *big.Int) *HeaderByNumberFactory

HeaderByNumber requests the header with the given number.

func (*HeaderByNumberFactory) CreateRequest added in v0.2.0

func (f *HeaderByNumberFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*HeaderByNumberFactory) HandleResponse added in v0.2.0

func (f *HeaderByNumberFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*HeaderByNumberFactory) Returns added in v0.2.0

func (*HeaderByNumberFactory) ReturnsRAW added in v0.5.0

func (f *HeaderByNumberFactory) ReturnsRAW(header *RPCHeader) *HeaderByNumberFactory

type LogsFactory added in v0.2.0

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

func Logs added in v0.2.0

func Logs(q ethereum.FilterQuery) *LogsFactory

Logs requests the logs of the given ethereum.FilterQuery q.

func (*LogsFactory) CreateRequest added in v0.2.0

func (f *LogsFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*LogsFactory) HandleResponse added in v0.2.0

func (f *LogsFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*LogsFactory) Returns added in v0.2.0

func (f *LogsFactory) Returns(logs *[]types.Log) *LogsFactory

type NonceFactory added in v0.2.0

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

func Nonce

func Nonce(addr common.Address) *NonceFactory

Nonce requests the nonce of the given common.Address addr.

func (*NonceFactory) AtBlock added in v0.2.0

func (f *NonceFactory) AtBlock(blockNumber *big.Int) *NonceFactory

func (*NonceFactory) CreateRequest added in v0.2.0

func (f *NonceFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*NonceFactory) HandleResponse added in v0.2.0

func (f *NonceFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*NonceFactory) Returns added in v0.2.0

func (f *NonceFactory) Returns(nonce *uint64) *NonceFactory

type RPCBlock added in v0.5.0

type RPCBlock struct {
	Hash         common.Hash      `json:"hash"`
	Transactions []RPCTransaction `json:"transactions"`
	UncleHashes  []common.Hash    `json:"uncles"`

	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       types.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       types.BlockNonce `json:"nonce"`
	BaseFee     *big.Int         `json:"baseFeePerGas" rlp:"optional"`
}

func (RPCBlock) MarshalJSON added in v0.5.0

func (r RPCBlock) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RPCBlock) UnmarshalJSON added in v0.5.0

func (r *RPCBlock) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RPCHeader added in v0.5.0

type RPCHeader struct {
	Hash              common.Hash   `json:"hash"`
	TransactionHashes []common.Hash `json:"transactions"`
	UncleHashes       []common.Hash `json:"uncles"`

	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       types.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       types.BlockNonce `json:"nonce"`
	BaseFee     *big.Int         `json:"baseFeePerGas" rlp:"optional"`
}

func (RPCHeader) MarshalJSON added in v0.5.0

func (r RPCHeader) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RPCHeader) UnmarshalJSON added in v0.5.0

func (r *RPCHeader) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RPCReceipt added in v0.5.0

type RPCReceipt struct {
	TransactionHash   common.Hash     `json:"transactionHash"`
	TransactionIndex  uint64          `json:"transactionIndex"`
	BlockHash         common.Hash     `json:"blockHash"`
	BlockNumber       *big.Int        `json:"blockNumber"`
	From              common.Address  `json:"from"`
	To                *common.Address `json:"to"`
	CumulativeGasUsed uint64          `json:"cumulativeGasUsed"`
	GasUsed           uint64          `json:"gasUsed"`
	ContractAddress   *common.Address `json:"contractAddress"`
	Logs              []*types.Log    `json:"logs"`
	LogsBloom         types.Bloom     `json:"logsBloom"`
	Type              uint64          `json:"type"`
	Status            uint64          `json:"status"` // 1 (success) or 0 (failure)
}

func (RPCReceipt) MarshalJSON added in v0.5.0

func (r RPCReceipt) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RPCReceipt) UnmarshalJSON added in v0.5.0

func (r *RPCReceipt) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RPCTransaction added in v0.5.0

type RPCTransaction struct {
	BlockHash        *common.Hash      `json:"blockHash"`
	BlockNumber      *big.Int          `json:"blockNumber"`
	From             common.Address    `json:"from"`
	Gas              uint64            `json:"gas"`
	GasPrice         *big.Int          `json:"gasPrice"`
	GasFeeCap        *big.Int          `json:"maxFeePerGas,omitempty"`
	GasTipCap        *big.Int          `json:"maxPriorityFeePerGas,omitempty"`
	Hash             common.Hash       `json:"hash"`
	Input            []byte            `json:"input"`
	Nonce            uint64            `json:"nonce"`
	To               *common.Address   `json:"to"`
	TransactionIndex *uint64           `json:"transactionIndex"`
	Value            *big.Int          `json:"value"`
	Type             uint64            `json:"type"`
	Accesses         *types.AccessList `json:"accessList,omitempty"`
	ChainID          *big.Int          `json:"chainId,omitempty"`
	V                *big.Int          `json:"v"`
	R                *big.Int          `json:"r"`
	S                *big.Int          `json:"s"`
}

func (RPCTransaction) MarshalJSON added in v0.5.0

func (r RPCTransaction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RPCTransaction) UnmarshalJSON added in v0.5.0

func (r *RPCTransaction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type SendRawTransactionFactory added in v0.2.0

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

func SendRawTransaction added in v0.2.0

func SendRawTransaction(rawTx []byte) *SendRawTransactionFactory

SendRawTransaction sends a raw transaction to the network.

func SendTransaction added in v0.2.0

func SendTransaction(tx *types.Transaction) *SendRawTransactionFactory

SendTransaction sends a signed transaction to the network.

func (*SendRawTransactionFactory) CreateRequest added in v0.2.0

func (f *SendRawTransactionFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*SendRawTransactionFactory) HandleResponse added in v0.2.0

func (f *SendRawTransactionFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*SendRawTransactionFactory) Returns added in v0.2.0

type StorageAtFactory added in v0.2.0

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

func StorageAt

func StorageAt(addr common.Address, slot common.Hash) *StorageAtFactory

StorageAt requests the storage of the given common.Address addr at the given common.Hash slot.

func (*StorageAtFactory) AtBlock added in v0.2.0

func (f *StorageAtFactory) AtBlock(blockNumber *big.Int) *StorageAtFactory

func (*StorageAtFactory) CreateRequest added in v0.2.0

func (f *StorageAtFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*StorageAtFactory) HandleResponse added in v0.2.0

func (f *StorageAtFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*StorageAtFactory) Returns added in v0.2.0

func (f *StorageAtFactory) Returns(storage *common.Hash) *StorageAtFactory

type TransactionByHashFactory added in v0.2.0

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

func TransactionByHash added in v0.2.0

func TransactionByHash(hash common.Hash) *TransactionByHashFactory

TransactionByHash requests the transaction with the given hash.

func (*TransactionByHashFactory) CreateRequest added in v0.2.0

func (f *TransactionByHashFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*TransactionByHashFactory) HandleResponse added in v0.2.0

func (f *TransactionByHashFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*TransactionByHashFactory) Returns added in v0.2.0

func (*TransactionByHashFactory) ReturnsRAW added in v0.5.0

type TransactionReceiptFactory added in v0.2.0

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

func TransactionReceipt added in v0.2.0

func TransactionReceipt(hash common.Hash) *TransactionReceiptFactory

TransactionReceipt requests the receipt of the transaction with the given hash.

func (*TransactionReceiptFactory) CreateRequest added in v0.2.0

func (f *TransactionReceiptFactory) CreateRequest() (rpc.BatchElem, error)

CreateRequest implements the core.RequestCreator interface.

func (*TransactionReceiptFactory) HandleResponse added in v0.2.0

func (f *TransactionReceiptFactory) HandleResponse(elem rpc.BatchElem) error

HandleResponse implements the core.ResponseHandler interface.

func (*TransactionReceiptFactory) Returns added in v0.2.0

func (*TransactionReceiptFactory) ReturnsRAW added in v0.5.0

Jump to

Keyboard shortcuts

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