mock

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: BSD-3-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) settlement.Interface

New creates the mock swap implementation

func NewApiInterface

func NewApiInterface(opts ...Option) swap.ApiInterface

Types

type Option

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

Option is the option passed to the mock settlement service

func WithCashChequeFunc

func WithCashChequeFunc(f func(ctx context.Context, peer swarm.Address) (common.Hash, error)) Option

func WithCashoutStatusFunc

func WithCashoutStatusFunc(f func(ctx context.Context, peer swarm.Address) (*chequebook.CashoutStatus, error)) Option

func WithHandshakeFunc

func WithHandshakeFunc(f func(swarm.Address, common.Address) error) Option

func WithLastReceivedChequeFunc

func WithLastReceivedChequeFunc(f func(swarm.Address) (*chequebook.SignedCheque, error)) Option

func WithLastReceivedChequesFunc

func WithLastReceivedChequesFunc(f func() (map[string]*chequebook.SignedCheque, error)) Option

func WithLastSentChequeFunc

func WithLastSentChequeFunc(f func(swarm.Address) (*chequebook.SignedCheque, error)) Option

func WithLastSentChequesFunc

func WithLastSentChequesFunc(f func() (map[string]*chequebook.SignedCheque, error)) Option

func WithPayFunc

func WithPayFunc(f func(context.Context, swarm.Address, uint64) error) Option

func WithReceiveChequeFunc

func WithReceiveChequeFunc(f func(context.Context, swarm.Address, *chequebook.SignedCheque) error) Option

func WithSetPaymentObserverFunc

func WithSetPaymentObserverFunc(f func(observer settlement.PaymentObserver)) Option

WithsettlementsFunc sets the mock settlements function

func WithSettlementRecvFunc

func WithSettlementRecvFunc(f func(swarm.Address) (uint64, error)) Option

func WithSettlementSentFunc

func WithSettlementSentFunc(f func(swarm.Address) (uint64, error)) Option

WithsettlementFunc sets the mock settlement function

func WithSettlementsRecvFunc

func WithSettlementsRecvFunc(f func() (map[string]uint64, error)) Option

func WithSettlementsSentFunc

func WithSettlementsSentFunc(f func() (map[string]uint64, error)) Option

WithsettlementsFunc sets the mock settlements function

type Service

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

func (*Service) CashCheque

func (s *Service) CashCheque(ctx context.Context, peer swarm.Address) (common.Hash, error)

func (*Service) CashoutStatus

func (s *Service) CashoutStatus(ctx context.Context, peer swarm.Address) (*chequebook.CashoutStatus, error)

func (*Service) Handshake

func (s *Service) Handshake(peer swarm.Address, beneficiary common.Address) error

Handshake is called by the swap protocol when a handshake is received.

func (*Service) LastReceivedCheque

func (s *Service) LastReceivedCheque(address swarm.Address) (*chequebook.SignedCheque, error)

func (*Service) LastReceivedCheques

func (s *Service) LastReceivedCheques() (map[string]*chequebook.SignedCheque, error)

func (*Service) LastSentCheque

func (s *Service) LastSentCheque(address swarm.Address) (*chequebook.SignedCheque, error)

func (*Service) LastSentCheques

func (s *Service) LastSentCheques() (map[string]*chequebook.SignedCheque, error)

func (*Service) Pay

func (s *Service) Pay(ctx context.Context, peer swarm.Address, amount uint64) error

Pay is the mock Pay function of swap.

func (*Service) ReceiveCheque

func (s *Service) ReceiveCheque(ctx context.Context, peer swarm.Address, cheque *chequebook.SignedCheque) (err error)

ReceiveCheque is the mock ReceiveCheque function of swap.

func (*Service) SetPaymentObserver

func (s *Service) SetPaymentObserver(observer settlement.PaymentObserver)

SetPaymentObserver is the mock SetPaymentObserver function of swap.

func (*Service) SettlementsReceived

func (s *Service) SettlementsReceived() (map[string]uint64, error)

SettlementsReceived is the mock SettlementsReceived function of swap.

func (*Service) SettlementsSent

func (s *Service) SettlementsSent() (map[string]uint64, error)

SettlementsSent is the mock SettlementsSent function of swap.

func (*Service) TotalReceived

func (s *Service) TotalReceived(peer swarm.Address) (totalReceived uint64, err error)

TotalReceived is the mock TotalReceived function of swap.

func (*Service) TotalSent

func (s *Service) TotalSent(peer swarm.Address) (totalSent uint64, err error)

TotalSent is the mock TotalSent function of swap.

Jump to

Keyboard shortcuts

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