client

package
v0.0.0-...-fd10465 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDialFirst = errors.New("client instance is nil, call dial function first")

Functions

This section is empty.

Types

type Client

type Client interface {
	DialWS() (Client, error)
	DialRPC() (Client, error)
	NetworkID(context.Context) (*big.Int, error)
	Close()
	BlockNumber(context.Context) (uint64, error)
	DynamicGasPrice(ctx context.Context) (*big.Int, error)
	ethereum.LogFilterer
	ethereum.TransactionSender
	ethereum.TransactionReader
	ethereum.ChainStateReader
	ethereum.PendingStateReader
	ethereum.GasPricer
	ethereum.ChainReader
}

Client is a wrapper of ethclient (normal usage) and simulated backend (test usage) The goal is providing a simple way for services can do reconnecting

func New

func New(config *config.Server) Client

New returns a ethclient wrapper structure and dialed a connection with the server

type MockClient

type MockClient struct {
	Client *backends.SimulatedBackend
}

func (*MockClient) BalanceAt

func (c *MockClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*MockClient) BlockByHash

func (c *MockClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*MockClient) BlockByNumber

func (c *MockClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*MockClient) BlockNumber

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

func (*MockClient) Close

func (c *MockClient) Close()

func (*MockClient) CodeAt

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

func (*MockClient) DialRPC

func (c *MockClient) DialRPC() (Client, error)

func (*MockClient) DialWS

func (c *MockClient) DialWS() (Client, error)

func (*MockClient) DynamicGasPrice

func (c *MockClient) DynamicGasPrice(ctx context.Context) (*big.Int, error)

func (*MockClient) FilterLogs

func (c *MockClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

func (*MockClient) HeaderByHash

func (c *MockClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*MockClient) HeaderByNumber

func (c *MockClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*MockClient) NetworkID

func (c *MockClient) NetworkID(ctx context.Context) (*big.Int, error)

func (*MockClient) NonceAt

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

func (*MockClient) PendingBalanceAt

func (c *MockClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

func (*MockClient) PendingCodeAt

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

func (*MockClient) PendingNonceAt

func (c *MockClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*MockClient) PendingStorageAt

func (c *MockClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

func (*MockClient) PendingTransactionCount

func (c *MockClient) PendingTransactionCount(ctx context.Context) (uint, error)

func (*MockClient) SendTransaction

func (c *MockClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*MockClient) StorageAt

func (c *MockClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

func (*MockClient) SubscribeFilterLogs

func (c *MockClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*MockClient) SubscribeNewHead

func (c *MockClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (*MockClient) SuggestGasPrice

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

func (*MockClient) TransactionByHash

func (c *MockClient) TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)

func (*MockClient) TransactionCount

func (c *MockClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

func (*MockClient) TransactionInBlock

func (c *MockClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

func (*MockClient) TransactionReceipt

func (c *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

Jump to

Keyboard shortcuts

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