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) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (mock *ClientMock) TransactionReceiptCalls() []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{ ... }
- func (mock *EthereumJSONRPCClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (mock *EthereumJSONRPCClientMock) TransactionReceiptCalls() []struct{ ... }
- type JSONRPCClientMock
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) // TransactionReceiptFunc mocks the TransactionReceipt method. TransactionReceiptFunc func(ctx context.Context, txHash common.Hash) (*types.Receipt, 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") }, TransactionReceiptFunc: func(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { panic("mock out the TransactionReceipt 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) TransactionReceipt ¶
func (mock *ClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt calls TransactionReceiptFunc.
func (*ClientMock) TransactionReceiptCalls ¶
func (mock *ClientMock) TransactionReceiptCalls() []struct { Ctx context.Context TxHash common.Hash }
TransactionReceiptCalls gets all the calls that were made to TransactionReceipt. Check the length with:
len(mockedClient.TransactionReceiptCalls())
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) // TransactionReceiptFunc mocks the TransactionReceipt method. TransactionReceiptFunc func(ctx context.Context, txHash common.Hash) (*types.Receipt, error) // contains filtered or unexported fields }
EthereumJSONRPCClientMock is a mock implementation of rpc.EthereumJSONRPCClient.
func TestSomethingThatUsesEthereumJSONRPCClient(t *testing.T) { // make and configure a mocked rpc.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") }, TransactionReceiptFunc: func(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { panic("mock out the TransactionReceipt method") }, } // use mockedEthereumJSONRPCClient in code that requires rpc.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())
func (*EthereumJSONRPCClientMock) TransactionReceipt ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt calls TransactionReceiptFunc.
func (*EthereumJSONRPCClientMock) TransactionReceiptCalls ¶ added in v0.31.0
func (mock *EthereumJSONRPCClientMock) TransactionReceiptCalls() []struct { Ctx context.Context TxHash common.Hash }
TransactionReceiptCalls gets all the calls that were made to TransactionReceipt. Check the length with:
len(mockedEthereumJSONRPCClient.TransactionReceiptCalls())
type JSONRPCClientMock ¶ added in v0.31.0
type JSONRPCClientMock struct { // 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 rpc.JSONRPCClient.
func TestSomethingThatUsesJSONRPCClient(t *testing.T) { // make and configure a mocked rpc.JSONRPCClient mockedJSONRPCClient := &JSONRPCClientMock{ CallContextFunc: func(ctx context.Context, result interface{}, method string, args ...interface{}) error { panic("mock out the CallContext method") }, } // use mockedJSONRPCClient in code that requires rpc.JSONRPCClient // and then make assertions. }
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())