Documentation ¶
Index ¶
- Variables
- type Client
- type MockClient
- func (c *MockClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *MockClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (c *MockClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *MockClient) BlockNumber(context.Context) (uint64, error)
- func (c *MockClient) Close()
- func (c *MockClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *MockClient) DialRPC() (Client, error)
- func (c *MockClient) DialWS() (Client, error)
- func (c *MockClient) DynamicGasPrice(ctx context.Context) (*big.Int, error)
- func (c *MockClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (c *MockClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (c *MockClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (c *MockClient) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *MockClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (c *MockClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (c *MockClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *MockClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *MockClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (c *MockClient) PendingTransactionCount(ctx context.Context) (uint, error)
- func (c *MockClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *MockClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (c *MockClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (c *MockClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (c *MockClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *MockClient) TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (c *MockClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (c *MockClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (c *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
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
type MockClient ¶
type MockClient struct {
Client *backends.SimulatedBackend
}
func (*MockClient) BlockByHash ¶
func (*MockClient) BlockByNumber ¶
func (*MockClient) BlockNumber ¶
func (c *MockClient) BlockNumber(context.Context) (uint64, error)
func (*MockClient) Close ¶
func (c *MockClient) Close()
func (*MockClient) DialRPC ¶
func (c *MockClient) DialRPC() (Client, error)
func (*MockClient) DialWS ¶
func (c *MockClient) DialWS() (Client, error)
func (*MockClient) DynamicGasPrice ¶
func (*MockClient) FilterLogs ¶
func (*MockClient) HeaderByHash ¶
func (*MockClient) HeaderByNumber ¶
func (*MockClient) PendingBalanceAt ¶
func (*MockClient) PendingCodeAt ¶
func (*MockClient) PendingNonceAt ¶
func (*MockClient) PendingStorageAt ¶
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) SubscribeFilterLogs ¶
func (*MockClient) SubscribeNewHead ¶
func (*MockClient) SuggestGasPrice ¶
func (*MockClient) TransactionByHash ¶
func (c *MockClient) TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
func (*MockClient) TransactionCount ¶
func (*MockClient) TransactionInBlock ¶
func (c *MockClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
func (*MockClient) TransactionReceipt ¶
Click to show internal directories.
Click to hide internal directories.