Documentation ¶
Index ¶
- type ClientMock
- func (mock *ClientMock) Close()
- func (mock *ClientMock) CloseCalls() []struct{}
- func (mock *ClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*rpc.Header, error)
- func (mock *ClientMock) HeaderByNumberCalls() []struct{ ... }
- func (mock *ClientMock) LatestFinalizedBlockNumber(ctx context.Context, confirmations uint64) (*big.Int, error)
- func (mock *ClientMock) LatestFinalizedBlockNumberCalls() []struct{ ... }
- func (mock *ClientMock) TransactionReceipts(ctx context.Context, txHashes []common.Hash) ([]rpc.Result, error)
- func (mock *ClientMock) TransactionReceiptsCalls() []struct{ ... }
- type EthereumJSONRPCClientMock
- func (mock *EthereumJSONRPCClientMock) BlockNumber(ctx context.Context) (uint64, error)
- func (mock *EthereumJSONRPCClientMock) BlockNumberCalls() []struct{ ... }
- func (mock *EthereumJSONRPCClientMock) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (mock *EthereumJSONRPCClientMock) CallContractCalls() []struct{ ... }
- func (mock *EthereumJSONRPCClientMock) Close()
- func (mock *EthereumJSONRPCClientMock) CloseCalls() []struct{}
- func (mock *EthereumJSONRPCClientMock) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (mock *EthereumJSONRPCClientMock) FilterLogsCalls() []struct{ ... }
- type JSONRPCClientMock
- func (mock *JSONRPCClientMock) BatchCallContext(ctx context.Context, b []ethereumrpc.BatchElem) error
- func (mock *JSONRPCClientMock) BatchCallContextCalls() []struct{ ... }
- func (mock *JSONRPCClientMock) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (mock *JSONRPCClientMock) CallContextCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMock ¶
type ClientMock struct { // CloseFunc mocks the Close method. CloseFunc func() // HeaderByNumberFunc mocks the HeaderByNumber method. HeaderByNumberFunc func(ctx context.Context, number *big.Int) (*rpc.Header, error) // LatestFinalizedBlockNumberFunc mocks the LatestFinalizedBlockNumber method. LatestFinalizedBlockNumberFunc func(ctx context.Context, confirmations uint64) (*big.Int, error) // TransactionReceiptsFunc mocks the TransactionReceipts method. TransactionReceiptsFunc func(ctx context.Context, txHashes []common.Hash) ([]rpc.Result, error) // contains filtered or unexported fields }
ClientMock is a mock implementation of rpc.Client.
func TestSomethingThatUsesClient(t *testing.T) { // make and configure a mocked rpc.Client mockedClient := &ClientMock{ CloseFunc: func() { panic("mock out the Close method") }, HeaderByNumberFunc: func(ctx context.Context, number *big.Int) (*rpc.Header, error) { panic("mock out the HeaderByNumber method") }, LatestFinalizedBlockNumberFunc: func(ctx context.Context, confirmations uint64) (*big.Int, error) { panic("mock out the LatestFinalizedBlockNumber method") }, TransactionReceiptsFunc: func(ctx context.Context, txHashes []common.Hash) ([]rpc.Result, error) { panic("mock out the TransactionReceipts method") }, } // use mockedClient in code that requires rpc.Client // and then make assertions. }
func (*ClientMock) CloseCalls ¶
func (mock *ClientMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedClient.CloseCalls())
func (*ClientMock) HeaderByNumber ¶ added in v0.26.4
HeaderByNumber calls HeaderByNumberFunc.
func (*ClientMock) HeaderByNumberCalls ¶ added in v0.26.4
func (mock *ClientMock) HeaderByNumberCalls() []struct { Ctx context.Context Number *big.Int }
HeaderByNumberCalls gets all the calls that were made to HeaderByNumber. Check the length with:
len(mockedClient.HeaderByNumberCalls())
func (*ClientMock) LatestFinalizedBlockNumber ¶ added in v0.33.1
func (mock *ClientMock) LatestFinalizedBlockNumber(ctx context.Context, confirmations uint64) (*big.Int, error)
LatestFinalizedBlockNumber calls LatestFinalizedBlockNumberFunc.
func (*ClientMock) LatestFinalizedBlockNumberCalls ¶ added in v0.33.1
func (mock *ClientMock) LatestFinalizedBlockNumberCalls() []struct { Ctx context.Context Confirmations uint64 }
LatestFinalizedBlockNumberCalls gets all the calls that were made to LatestFinalizedBlockNumber. Check the length with:
len(mockedClient.LatestFinalizedBlockNumberCalls())
func (*ClientMock) TransactionReceipts ¶ added in v0.34.0
func (mock *ClientMock) TransactionReceipts(ctx context.Context, txHashes []common.Hash) ([]rpc.Result, error)
TransactionReceipts calls TransactionReceiptsFunc.
func (*ClientMock) TransactionReceiptsCalls ¶ added in v0.34.0
func (mock *ClientMock) TransactionReceiptsCalls() []struct { Ctx context.Context TxHashes []common.Hash }
TransactionReceiptsCalls gets all the calls that were made to TransactionReceipts. Check the length with:
len(mockedClient.TransactionReceiptsCalls())
type EthereumJSONRPCClientMock ¶ added in v0.31.0
type EthereumJSONRPCClientMock struct { // BlockNumberFunc mocks the BlockNumber method. BlockNumberFunc func(ctx context.Context) (uint64, error) // CallContractFunc mocks the CallContract method. CallContractFunc func(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) // CloseFunc mocks the Close method. CloseFunc func() // FilterLogsFunc mocks the FilterLogs method. FilterLogsFunc func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) // contains filtered or unexported fields }
EthereumJSONRPCClientMock is a mock implementation of evmrpc.EthereumJSONRPCClient.
func TestSomethingThatUsesEthereumJSONRPCClient(t *testing.T) { // make and configure a mocked evmrpc.EthereumJSONRPCClient mockedEthereumJSONRPCClient := &EthereumJSONRPCClientMock{ BlockNumberFunc: func(ctx context.Context) (uint64, error) { panic("mock out the BlockNumber method") }, CallContractFunc: func(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) { panic("mock out the CallContract method") }, CloseFunc: func() { panic("mock out the Close method") }, FilterLogsFunc: func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { panic("mock out the FilterLogs method") }, } // use mockedEthereumJSONRPCClient in code that requires evmrpc.EthereumJSONRPCClient // and then make assertions. }
func (*EthereumJSONRPCClientMock) BlockNumber ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) BlockNumber(ctx context.Context) (uint64, error)
BlockNumber calls BlockNumberFunc.
func (*EthereumJSONRPCClientMock) BlockNumberCalls ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) BlockNumberCalls() []struct { Ctx context.Context }
BlockNumberCalls gets all the calls that were made to BlockNumber. Check the length with:
len(mockedEthereumJSONRPCClient.BlockNumberCalls())
func (*EthereumJSONRPCClientMock) CallContract ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract calls CallContractFunc.
func (*EthereumJSONRPCClientMock) CallContractCalls ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) CallContractCalls() []struct { Ctx context.Context Msg ethereum.CallMsg BlockNumber *big.Int }
CallContractCalls gets all the calls that were made to CallContract. Check the length with:
len(mockedEthereumJSONRPCClient.CallContractCalls())
func (*EthereumJSONRPCClientMock) Close ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) Close()
Close calls CloseFunc.
func (*EthereumJSONRPCClientMock) CloseCalls ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedEthereumJSONRPCClient.CloseCalls())
func (*EthereumJSONRPCClientMock) FilterLogs ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
FilterLogs calls FilterLogsFunc.
func (*EthereumJSONRPCClientMock) FilterLogsCalls ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) FilterLogsCalls() []struct { Ctx context.Context Q ethereum.FilterQuery }
FilterLogsCalls gets all the calls that were made to FilterLogs. Check the length with:
len(mockedEthereumJSONRPCClient.FilterLogsCalls())
type JSONRPCClientMock ¶ added in v0.31.0
type JSONRPCClientMock struct { // BatchCallContextFunc mocks the BatchCallContext method. BatchCallContextFunc func(ctx context.Context, b []ethereumrpc.BatchElem) error // CallContextFunc mocks the CallContext method. CallContextFunc func(ctx context.Context, result interface{}, method string, args ...interface{}) error // contains filtered or unexported fields }
JSONRPCClientMock is a mock implementation of evmrpc.JSONRPCClient.
func TestSomethingThatUsesJSONRPCClient(t *testing.T) { // make and configure a mocked evmrpc.JSONRPCClient mockedJSONRPCClient := &JSONRPCClientMock{ BatchCallContextFunc: func(ctx context.Context, b []ethereumrpc.BatchElem) error { panic("mock out the BatchCallContext method") }, CallContextFunc: func(ctx context.Context, result interface{}, method string, args ...interface{}) error { panic("mock out the CallContext method") }, } // use mockedJSONRPCClient in code that requires evmrpc.JSONRPCClient // and then make assertions. }
func (*JSONRPCClientMock) BatchCallContext ¶ added in v0.34.0
func (mock *JSONRPCClientMock) BatchCallContext(ctx context.Context, b []ethereumrpc.BatchElem) error
BatchCallContext calls BatchCallContextFunc.
func (*JSONRPCClientMock) BatchCallContextCalls ¶ added in v0.34.0
func (mock *JSONRPCClientMock) BatchCallContextCalls() []struct { Ctx context.Context B []ethereumrpc.BatchElem }
BatchCallContextCalls gets all the calls that were made to BatchCallContext. Check the length with:
len(mockedJSONRPCClient.BatchCallContextCalls())
func (*JSONRPCClientMock) CallContext ¶ added in v0.31.0
func (mock *JSONRPCClientMock) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
CallContext calls CallContextFunc.
func (*JSONRPCClientMock) CallContextCalls ¶ added in v0.31.0
func (mock *JSONRPCClientMock) CallContextCalls() []struct { Ctx context.Context Result interface{} Method string Args []interface{} }
CallContextCalls gets all the calls that were made to CallContext. Check the length with:
len(mockedJSONRPCClient.CallContextCalls())