mock

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChequeStore

func NewChequeStore(opts ...Option) cheque.ChequeStore

NewChequeStore creates the mock chequeStore implementation

Types

type ChequeStoreMock

type ChequeStoreMock struct {
	// contains filtered or unexported fields
}

Service is the mock chequeStore service.

func (*ChequeStoreMock) GetRetrieveTraffic

func (s *ChequeStoreMock) GetRetrieveTraffic(chainAddress common.Address) (traffic *big.Int, err error)

func (*ChequeStoreMock) GetTransferTraffic

func (s *ChequeStoreMock) GetTransferTraffic(chainAddress common.Address) (traffic *big.Int, err error)

func (*ChequeStoreMock) LastReceivedCheque

func (s *ChequeStoreMock) LastReceivedCheque(chainAddress common.Address) (*cheque.SignedCheque, error)

LastReceivedCheque returns the last cheque we received from a specific chainAddress.

func (*ChequeStoreMock) LastReceivedCheques

func (s *ChequeStoreMock) LastReceivedCheques() (map[common.Address]*cheque.SignedCheque, error)

LastReceivedCheques returns the last received cheques from every known chainAddress.

func (*ChequeStoreMock) LastSendCheque

func (s *ChequeStoreMock) LastSendCheque(chainAddress common.Address) (*cheque.Cheque, error)

func (*ChequeStoreMock) LastSendCheques

func (s *ChequeStoreMock) LastSendCheques() (map[common.Address]*cheque.Cheque, error)

func (*ChequeStoreMock) PutReceivedCheques

func (s *ChequeStoreMock) PutReceivedCheques(chainAddress common.Address, cheque cheque.SignedCheque) error

func (*ChequeStoreMock) PutRetrieveTraffic

func (s *ChequeStoreMock) PutRetrieveTraffic(chainAddress common.Address, traffic *big.Int) error

func (*ChequeStoreMock) PutSendCheque

func (s *ChequeStoreMock) PutSendCheque(ctx context.Context, cheque *cheque.Cheque, chainAddress common.Address) error

func (*ChequeStoreMock) PutTransferTraffic

func (s *ChequeStoreMock) PutTransferTraffic(chainAddress common.Address, traffic *big.Int) error

func (*ChequeStoreMock) ReceiveCheque

func (s *ChequeStoreMock) ReceiveCheque(ctx context.Context, cheque *cheque.SignedCheque) (*big.Int, error)

ReceiveCheque verifies and stores a cheque. It returns the totam amount earned.

func (*ChequeStoreMock) VerifyCheque

func (s *ChequeStoreMock) VerifyCheque(cheque *cheque.SignedCheque, chainID int64) (common.Address, error)

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is the option passed to the mock ChequeStore service

func WithLastReceivedCheque

func WithLastReceivedCheque(f func(chainAddress common.Address) (*cheque.SignedCheque, error)) Option

func WithLastReceivedCheques

func WithLastReceivedCheques(f func() (map[common.Address]*cheque.SignedCheque, error)) Option

func WithLastSendCheque

func WithLastSendCheque(f func(chainAddress common.Address) (*cheque.Cheque, error)) Option

func WithLastSendCheques

func WithLastSendCheques(f func() (map[common.Address]*cheque.Cheque, error)) Option

func WithPutReceivedCheques

func WithPutReceivedCheques(f func(chainAddress common.Address, cheque cheque.SignedCheque) error) Option

func WithPutRetrieveTraffic

func WithPutRetrieveTraffic(f func(chainAddress common.Address, traffic *big.Int) error) Option

func WithPutSendCheque

func WithPutSendCheque(f func(ctx context.Context, cheque *cheque.Cheque, chainAddress common.Address) error) Option

func WithPutTransferTraffic

func WithPutTransferTraffic(f func(chainAddress common.Address, traffic *big.Int) error) Option

func WithRetrieveChequeFunc

func WithRetrieveChequeFunc(f func(ctx context.Context, cheque *cheque.SignedCheque) (*big.Int, error)) Option

Jump to

Keyboard shortcuts

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