mock

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller struct {
	AddressFn         func() types.Address
	CallDataFn        func() ([]byte, error)
	ClientFn          func() rpc.RPC
	CallFn            func(ctx context.Context, number types.BlockNumber, res any) error
	GasFn             func(ctx context.Context, number types.BlockNumber) (uint64, error)
	SendTransactionFn func(ctx context.Context) (*types.Hash, *types.Transaction, error)
	DecodeToFn        func(bytes []byte, a any) error
}

func NewCaller

func NewCaller(t *testing.T) *Caller

func (*Caller) Address

func (m *Caller) Address() types.Address

func (*Caller) Call

func (m *Caller) Call(ctx context.Context, number types.BlockNumber, res any) error

func (*Caller) CallData

func (m *Caller) CallData() ([]byte, error)

func (*Caller) Client

func (m *Caller) Client() rpc.RPC

func (*Caller) DecodeTo

func (m *Caller) DecodeTo(bytes []byte, a any) error

func (*Caller) Gas

func (m *Caller) Gas(ctx context.Context, number types.BlockNumber) (uint64, error)

func (*Caller) MockAllowAllCalls

func (m *Caller) MockAllowAllCalls() *Caller

func (*Caller) MockReset

func (m *Caller) MockReset(t *testing.T) *Caller

func (*Caller) MockResult

func (m *Caller) MockResult(result any, err error) *Caller

func (*Caller) SendTransaction

func (m *Caller) SendTransaction(ctx context.Context) (*types.Hash, *types.Transaction, error)

type TypedCaller

type TypedCaller[T any] struct {
	Caller

	CallFn   func(ctx context.Context, number types.BlockNumber) (T, error)
	DecodeFn func(bytes []byte) (T, error)
}

func NewTypedCaller

func NewTypedCaller[T any](t *testing.T) *TypedCaller[T]

func (*TypedCaller[T]) Call

func (m *TypedCaller[T]) Call(ctx context.Context, number types.BlockNumber) (T, error)

func (*TypedCaller[T]) Decode

func (m *TypedCaller[T]) Decode(bytes []byte) (T, error)

func (*TypedCaller[T]) MockReset

func (m *TypedCaller[T]) MockReset(t *testing.T) *TypedCaller[T]

func (*TypedCaller[T]) MockResult

func (m *TypedCaller[T]) MockResult(result T, err error) *TypedCaller[T]

Jump to

Keyboard shortcuts

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