Documentation ¶
Index ¶
- Variables
- func ImplementMock(client *MockClient)
- func ImplementMockWithMethods(client *MockClient, methods MockMethods)
- func ImplementMockWithOverwrite(client *MockClient, overwrite MockMethods)
- type MockClient
- func (c *MockClient) BalanceAt(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error)
- func (m *MockClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (m *MockClient) GetCode(ctx context.Context, addr common.Address) (string, error)
- func (m *MockClient) GetExpiry(ctx context.Context, addr common.Address) (uint64, error)
- func (m *MockClient) GetPublicKey(ctx context.Context, addr common.Address) (eth.PublicKey, error)
- func (m *MockClient) NonceAt(ctx context.Context, addr common.Address) (uint64, error)
- func (m *MockClient) SendTransaction(ctx context.Context, tx *types.Transaction) (eth.SendTransactionResponse, error)
- func (m *MockClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, c chan<- types.Log) (ethereum.Subscription, error)
- func (m *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type MockMethod
- type MockMethods
- type MockSubscription
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMockMethods = map[string]MockMethod{ "EstimateGas": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{uint64(0), nil}, }, "NonceAt": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{uint64(1), nil}, }, "GetCode": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{"0x0000000000000000000000000000000000000000", nil}, }, "BalanceAt": { Arguments: []interface{}{mock.Anything, mock.Anything, mock.Anything}, Return: []interface{}{big.NewInt(1), nil}, }, "TransactionReceipt": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{ &types.Receipt{ Status: 1, ContractAddress: common.HexToAddress("0x0000000000000000000000000000000000000000"), }, nil, }, }, "GetExpiry": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{uint64(123456789), nil}, }, "GetPublicKey": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{ eth.PublicKey{ Timestamp: 1234, PublicKey: "0x6f6704e5a10332af6672e50b3d9754dc460dfa4d", Signature: "0x6f6704e5a10332af6672e50b3d9754dc460dfa4d", }, nil, }, }, "SendTransaction": { Arguments: []interface{}{mock.Anything, mock.Anything}, Return: []interface{}{ eth.SendTransactionResponse{ Status: 1, Output: "0x73756363657373", Hash: "0x00000000000000000000000000000000000000000000000000000000000000000", }, nil, }, }, "SubscribeFilterLogs": { Arguments: []interface{}{mock.Anything, mock.Anything, mock.Anything}, Return: []interface{}{ &MockSubscription{ErrC: make(chan error)}, nil, }, }, }
Functions ¶
func ImplementMock ¶
func ImplementMock(client *MockClient)
func ImplementMockWithMethods ¶
func ImplementMockWithMethods(client *MockClient, methods MockMethods)
func ImplementMockWithOverwrite ¶
func ImplementMockWithOverwrite(client *MockClient, overwrite MockMethods)
Types ¶
type MockClient ¶
func (*MockClient) EstimateGas ¶
func (*MockClient) GetPublicKey ¶
func (*MockClient) SendTransaction ¶
func (m *MockClient) SendTransaction( ctx context.Context, tx *types.Transaction, ) (eth.SendTransactionResponse, error)
func (*MockClient) SubscribeFilterLogs ¶
func (m *MockClient) SubscribeFilterLogs( ctx context.Context, q ethereum.FilterQuery, c chan<- types.Log, ) (ethereum.Subscription, error)
func (*MockClient) TransactionReceipt ¶
type MockMethod ¶
type MockMethods ¶
type MockMethods map[string]MockMethod
func OverwriteDefaults ¶
func OverwriteDefaults(overwrite MockMethods) MockMethods
type MockSubscription ¶
type MockSubscription struct {
ErrC chan error
}
func (*MockSubscription) Err ¶
func (s *MockSubscription) Err() <-chan error
func (*MockSubscription) Unsubscribe ¶
func (s *MockSubscription) Unsubscribe()
Click to show internal directories.
Click to hide internal directories.