corethclient

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package corethclient provides an RPC client for coreth-specific APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountResult

type AccountResult struct {
	Address      common.Address  `json:"address"`
	AccountProof []string        `json:"accountProof"`
	Balance      *big.Int        `json:"balance"`
	CodeHash     common.Hash     `json:"codeHash"`
	Nonce        uint64          `json:"nonce"`
	StorageHash  common.Hash     `json:"storageHash"`
	StorageProof []StorageResult `json:"storageProof"`
}

AccountResult is the result of a GetProof operation.

type Client

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

Client is a wrapper around rpc.Client that implements geth-specific functionality.

If you want to use the standardized Ethereum RPC functionality, use ethclient.Client instead.

func New

func New(c *rpc.Client) *Client

New creates a client that uses the given RPC client.

func (*Client) CallContract

func (ec *Client) CallContract(ctx context.Context, msg interfaces.CallMsg, blockNumber *big.Int, overrides *map[common.Address]OverrideAccount) ([]byte, error)

CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.

blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.

overrides specifies a map of contract states that should be overwritten before executing the message call. Please use ethclient.CallContract instead if you don't need the override functionality.

func (*Client) CreateAccessList

func (ec *Client) CreateAccessList(ctx context.Context, msg interfaces.CallMsg) (*types.AccessList, uint64, string, error)

CreateAccessList tries to create an access list for a specific transaction based on the current pending state of the blockchain.

func (*Client) GCStats

func (ec *Client) GCStats(ctx context.Context) (*debug.GCStats, error)

GCStats retrieves the current garbage collection stats from a geth node.

func (*Client) GetProof

func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []string, blockNumber *big.Int) (*AccountResult, error)

GetProof returns the account and storage values of the specified account including the Merkle-proof. The block number can be nil, in which case the value is taken from the latest known block.

func (*Client) MemStats

func (ec *Client) MemStats(ctx context.Context) (*runtime.MemStats, error)

MemStats retrieves the current memory stats from a geth node.

func (*Client) SubscribePendingTransactions

func (ec *Client) SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error)

SubscribePendingTransactions subscribes to new pending transactions.

type OverrideAccount

type OverrideAccount struct {
	Nonce     uint64                      `json:"nonce"`
	Code      []byte                      `json:"code"`
	Balance   *big.Int                    `json:"balance"`
	State     map[common.Hash]common.Hash `json:"state"`
	StateDiff map[common.Hash]common.Hash `json:"stateDiff"`
}

OverrideAccount specifies the state of an account to be overridden.

type StorageResult

type StorageResult struct {
	Key   string   `json:"key"`
	Value *big.Int `json:"value"`
	Proof []string `json:"proof"`
}

StorageResult provides a proof for a key-value pair.

Jump to

Keyboard shortcuts

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