Documentation ¶
Index ¶
- func NewSettlement(opts ...Option) settlement.Interface
- func NewTraffic(opts ...Option) traffic.ApiInterface
- type Option
- func WithAddress(f func() common.Address) Option
- func WithAvailableBalance(f func() (*big.Int, error)) Option
- func WithCashCheque(f func(ctx context.Context, peer boson.Address) (common.Hash, error)) Option
- func WithGetPeerBalance(f func(peer boson.Address) (*big.Int, error)) Option
- func WithGetUnPaidBalance(f func(peer boson.Address) (*big.Int, error)) Option
- func WithLastReceivedCheque(f func(peer boson.Address) (*chequePkg.SignedCheque, error)) Option
- func WithLastSentCheque(f func(peer boson.Address) (*chequePkg.Cheque, error)) Option
- func WithPay(...) Option
- func WithPutRetrieveTraffic(f func(peer boson.Address, traffic *big.Int) error) Option
- func WithPutTransferTraffic(f func(peer boson.Address, traffic *big.Int) error) Option
- func WithRetrieveTraffic(f func(peer boson.Address) (traffic *big.Int, err error)) Option
- func WithSetNotifyPaymentFunc(f func(notifyPaymentFunc settlement.NotifyPaymentFunc)) Option
- func WithTrafficCheques(f func() ([]*traffic.TrafficCheque, error)) Option
- func WithTransferTraffic(f func(peer boson.Address) (traffic *big.Int, err error)) Option
- type TraafficMock
- func (s *TraafficMock) Address() common.Address
- func (s *TraafficMock) AvailableBalance() (*big.Int, error)
- func (s *TraafficMock) CashCheque(ctx context.Context, peer boson.Address) (common.Hash, error)
- func (s *TraafficMock) GetPeerBalance(peer boson.Address) (*big.Int, error)
- func (s *TraafficMock) GetUnPaidBalance(peer boson.Address) (*big.Int, error)
- func (s *TraafficMock) LastReceivedCheque(peer boson.Address) (*chequePkg.SignedCheque, error)
- func (s *TraafficMock) LastSentCheque(peer boson.Address) (*chequePkg.Cheque, error)
- func (s *TraafficMock) Pay(ctx context.Context, peer boson.Address, paymentThreshold *big.Int) error
- func (s *TraafficMock) PutRetrieveTraffic(peer boson.Address, traffic *big.Int) error
- func (s *TraafficMock) PutTransferTraffic(peer boson.Address, traffic *big.Int) error
- func (s *TraafficMock) RetrieveTraffic(peer boson.Address) (traffic *big.Int, err error)
- func (s *TraafficMock) SetNotifyPaymentFunc(notifyPaymentFunc settlement.NotifyPaymentFunc)
- func (s *TraafficMock) TrafficCheques() ([]*traffic.TrafficCheque, error)
- func (s *TraafficMock) TrafficInfo() (*traffic.TrafficInfo, error)
- func (s *TraafficMock) TrafficInit() error
- func (s *TraafficMock) TransferTraffic(peer boson.Address) (traffic *big.Int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSettlement ¶
func NewSettlement(opts ...Option) settlement.Interface
NewChequeStore creates the mock chequeStore implementation
func NewTraffic ¶
func NewTraffic(opts ...Option) traffic.ApiInterface
NewChequeStore creates the mock chequeStore implementation
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is the option passed to the mock ChequeStore service
func WithAddress ¶
func WithCashCheque ¶
func WithGetPeerBalance ¶
func WithGetUnPaidBalance ¶
func WithLastReceivedCheque ¶
func WithLastSentCheque ¶
WithsettlementFunc sets the mock settlement function
func WithPutRetrieveTraffic ¶
func WithPutTransferTraffic ¶
func WithRetrieveTraffic ¶
func WithSetNotifyPaymentFunc ¶
func WithSetNotifyPaymentFunc(f func(notifyPaymentFunc settlement.NotifyPaymentFunc)) Option
func WithTrafficCheques ¶
func WithTrafficCheques(f func() ([]*traffic.TrafficCheque, error)) Option
type TraafficMock ¶
type TraafficMock struct {
// contains filtered or unexported fields
}
func (*TraafficMock) Address ¶
func (s *TraafficMock) Address() common.Address
func (*TraafficMock) AvailableBalance ¶
func (s *TraafficMock) AvailableBalance() (*big.Int, error)
AvailableBalance Get actual available balance
func (*TraafficMock) CashCheque ¶
CashCheque sends a cashing transaction for the last cheque of the peer
func (*TraafficMock) GetPeerBalance ¶
func (*TraafficMock) GetUnPaidBalance ¶
func (*TraafficMock) LastReceivedCheque ¶
func (s *TraafficMock) LastReceivedCheque(peer boson.Address) (*chequePkg.SignedCheque, error)
LastReceivedCheques returns the list of last received cheques for all peers
func (*TraafficMock) LastSentCheque ¶
LastSentCheque returns the last sent cheque for the peer
func (*TraafficMock) PutRetrieveTraffic ¶
func (*TraafficMock) PutTransferTraffic ¶
func (*TraafficMock) RetrieveTraffic ¶
func (*TraafficMock) SetNotifyPaymentFunc ¶
func (s *TraafficMock) SetNotifyPaymentFunc(notifyPaymentFunc settlement.NotifyPaymentFunc)
SetNotifyPaymentFunc sets the NotifyPaymentFunc to notify
func (*TraafficMock) TrafficCheques ¶
func (s *TraafficMock) TrafficCheques() ([]*traffic.TrafficCheque, error)
func (*TraafficMock) TrafficInfo ¶
func (s *TraafficMock) TrafficInfo() (*traffic.TrafficInfo, error)
func (*TraafficMock) TrafficInit ¶
func (s *TraafficMock) TrafficInit() error
func (*TraafficMock) TransferTraffic ¶
Click to show internal directories.
Click to hide internal directories.