mock

package
v1.13.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChequebook

func NewChequebook(opts ...Option) chequebook.Service

NewChequebook creates the mock chequebook implementation

Types

type Option

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

Option is the option passed to the mock Chequebook service

func WithChequebookAddressFunc

func WithChequebookAddressFunc(f func() common.Address) Option

func WithChequebookAvailableBalanceFunc

func WithChequebookAvailableBalanceFunc(f func(ctx context.Context) (*big.Int, error)) Option

func WithChequebookBalanceFunc

func WithChequebookBalanceFunc(f func(ctx context.Context) (*big.Int, error)) Option

WithChequebook*Functions set the mock chequebook functions

func WithChequebookDepositFunc

func WithChequebookDepositFunc(f func(ctx context.Context, amount *big.Int) (hash common.Hash, err error)) Option

func WithChequebookIssueFunc

func WithChequebookIssueFunc(f func(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc chequebook.SendChequeFunc) (*big.Int, error)) Option

func WithChequebookWithdrawFunc

func WithChequebookWithdrawFunc(f func(ctx context.Context, amount *big.Int) (hash common.Hash, err error)) Option

func WithLastChequeFunc added in v1.0.0

func WithLastChequeFunc(f func(beneficiary common.Address) (*chequebook.SignedCheque, error)) Option

func WithLastChequesFunc added in v1.0.0

func WithLastChequesFunc(f func() (map[common.Address]*chequebook.SignedCheque, error)) Option

type Service

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

Service is the mock chequebook service.

func (*Service) Address

func (s *Service) Address() common.Address

Address mocks the chequebook .Address function

func (*Service) AvailableBalance

func (s *Service) AvailableBalance(ctx context.Context) (bal *big.Int, err error)

func (*Service) Balance

func (s *Service) Balance(ctx context.Context) (bal *big.Int, err error)

Balance mocks the chequebook .Balance function

func (*Service) Deposit

func (s *Service) Deposit(ctx context.Context, amount *big.Int) (hash common.Hash, err error)

Deposit mocks the chequebook .Deposit function

func (*Service) Issue

func (s *Service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc chequebook.SendChequeFunc) (*big.Int, error)

func (*Service) LastCheque

func (s *Service) LastCheque(beneficiary common.Address) (*chequebook.SignedCheque, error)

func (*Service) LastCheques

func (s *Service) LastCheques() (map[common.Address]*chequebook.SignedCheque, error)

func (*Service) WaitForDeposit

func (s *Service) WaitForDeposit(ctx context.Context, txHash common.Hash) error

WaitForDeposit mocks the chequebook .WaitForDeposit function

func (*Service) Withdraw

func (s *Service) Withdraw(ctx context.Context, amount *big.Int) (hash common.Hash, err error)

Jump to

Keyboard shortcuts

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