client

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods to interface with a JSON-RPC Ethereum 1.0 node

func New

func New(cfg *jsonrpchttp.Config) (*Client, error)

NewFromAddress creates a new client connecting to an Ethereum node at addr

func NewFromClient

func NewFromClient(cli jsonrpc.Client) *Client

New creates a new client

func (*Client) BlockNumber

func (c *Client) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber returns current chain head number

func (*Client) CallContract

func (c *Client) CallContract(ctx context.Context, msg geth.CallMsg, blockNumber *big.Int) ([]byte, error)

CallContract executes contract call The block number can be nil, in which case call is executed at the latest block.

func (*Client) ChainID

func (c *Client) ChainID(ctx context.Context) (*big.Int, error)

ChainID returns chain id

func (*Client) CodeAt

func (c *Client) CodeAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) ([]byte, error)

CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest block.

func (*Client) EstimateGas

func (c *Client) EstimateGas(ctx context.Context, msg geth.CallMsg) (uint64, error)

EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the chain.

func (*Client) FilterLogs

func (c *Client) FilterLogs(ctx context.Context, q geth.FilterQuery) ([]gethtypes.Log, error)

FilterLogs executes a filter query.

func (*Client) HeaderByNumber

func (c *Client) HeaderByNumber(ctx context.Context, blockNumber *big.Int) (*gethtypes.Header, error)

HeaderByNumber returns header a given block number

func (*Client) Logger

func (c *Client) Logger() logrus.FieldLogger

func (*Client) NonceAt

func (c *Client) NonceAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) (uint64, error)

NonceAt returns the next nonce for the given account. The block number can be nil, in which case the code is taken from the latest block.

func (*Client) PendingCodeAt

func (c *Client) PendingCodeAt(ctx context.Context, account gethcommon.Address) ([]byte, error)

PendingCodeAt returns the contract code of the given account on pending state

func (*Client) PendingNonceAt

func (c *Client) PendingNonceAt(ctx context.Context, account gethcommon.Address) (uint64, error)

PendingNonceAt returns the next nonce for the given account considering pending transaction.

func (*Client) SendTransaction

func (c *Client) SendTransaction(ctx context.Context, tx *gethtypes.Transaction) error

SendTransaction injects a signed transaction into the pending pool for execution.

func (*Client) SetLogger

func (c *Client) SetLogger(logger logrus.FieldLogger)

func (*Client) SubscribeFilterLogs

func (c *Client) SubscribeFilterLogs(ctx context.Context, _ geth.FilterQuery, _ chan<- gethtypes.Log) (geth.Subscription, error)

SubscribeFilterLogs subscribes to the results of a streaming filter query.

func (*Client) SuggestGasPrice

func (c *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)

SuggestGasPrice returns gas price for a transaction to be included in a miner block in a timely manner considering current network activity

func (*Client) SuggestGasTipCap

func (c *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

SuggestGasPrice returns a gas tip cap after EIP-1559 for a transaction to be included in a miner block in a timely manner considering current network activity

type Config

type Config struct {
	Address string

	HTTP *kilnhttp.ClientConfig
}

func (*Config) SetDefault

func (cfg *Config) SetDefault() *Config

Jump to

Keyboard shortcuts

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