Versions in this module Expand all Collapse all v0 v0.1.0 Aug 3, 2021 Changes in this version + var BonusPeerAdress swarm.Address + var BonusSwapService *Service + var ErrChequeValueTooLow = errors.New("cheque value too low") + var ErrUnknownBeneficary = errors.New("unknown beneficiary for peer") + var ErrWrongChequebook = errors.New("wrong chequebook") + type Addressbook interface + AddDeductionBy func(peer swarm.Address) error + AddDeductionFor func(peer swarm.Address) error + Beneficiary func(peer swarm.Address) (beneficiary common.Address, known bool, err error) + BeneficiaryPeer func(beneficiary common.Address) (peer swarm.Address, known bool, err error) + Chequebook func(peer swarm.Address) (chequebookAddress common.Address, known bool, err error) + ChequebookPeer func(chequebook common.Address) (peer swarm.Address, known bool, err error) + GetDeductionBy func(peer swarm.Address) (bool, error) + GetDeductionFor func(peer swarm.Address) (bool, error) + MigratePeer func(oldPeer, newPeer swarm.Address) error + PutBeneficiary func(peer swarm.Address, beneficiary common.Address) error + PutChequebook func(peer swarm.Address, chequebook common.Address) error + func NewAddressbook(store storage.StateStorer) Addressbook + type Interface interface + BonusReceivedUncashedCheques func() ([]*chequebook.SignedCheque, error) + CashBonusCheque func(ctx context.Context, peer swarm.Address) (common.Hash, error) + CashCheque func(ctx context.Context, peer swarm.Address) (common.Hash, error) + CashoutStatus func(ctx context.Context, peer swarm.Address) (*chequebook.CashoutStatus, error) + LastReceivedCheque func(peer swarm.Address) (*chequebook.SignedCheque, error) + LastReceivedCheques func() (map[string]*chequebook.SignedCheque, error) + LastSentCheque func(peer swarm.Address) (*chequebook.SignedCheque, error) + LastSentCheques func() (map[string]*chequebook.SignedCheque, error) + type Service struct + func New(proto swapprotocol.Interface, logger logging.Logger, store storage.StateStorer, ...) *Service + func (s *Service) AddDeductionByPeer(peer swarm.Address) error + func (s *Service) BonusReceivedUncashedCheques() ([]*chequebook.SignedCheque, error) + func (s *Service) CashBonusCheque(ctx context.Context, peer swarm.Address) (common.Hash, error) + func (s *Service) CashCheque(ctx context.Context, peer swarm.Address) (common.Hash, error) + func (s *Service) CashoutStatus(ctx context.Context, peer swarm.Address) (*chequebook.CashoutStatus, error) + func (s *Service) GetDeductionByPeer(peer swarm.Address) (bool, error) + func (s *Service) GetDeductionForPeer(peer swarm.Address) (bool, error) + func (s *Service) Handshake(peer swarm.Address, beneficiary common.Address) error + func (s *Service) LastReceivedCheque(peer swarm.Address) (*chequebook.SignedCheque, error) + func (s *Service) LastReceivedCheques() (map[string]*chequebook.SignedCheque, error) + func (s *Service) LastSentCheque(peer swarm.Address) (*chequebook.SignedCheque, error) + func (s *Service) LastSentCheques() (map[string]*chequebook.SignedCheque, error) + func (s *Service) Metrics() []prometheus.Collector + func (s *Service) Pay(ctx context.Context, peer swarm.Address, amount *big.Int) + func (s *Service) ReceiveBonusCheque(ctx context.Context, peer swarm.Address, cheque *chequebook.SignedCheque) (err error) + func (s *Service) ReceiveCheque(ctx context.Context, peer swarm.Address, cheque *chequebook.SignedCheque, ...) (err error) + func (s *Service) SetAccounting(accounting settlement.Accounting) + func (s *Service) SettlementsReceived() (map[string]*big.Int, error) + func (s *Service) SettlementsSent() (map[string]*big.Int, error) + func (s *Service) TotalReceived(peer swarm.Address) (totalReceived *big.Int, err error) + func (s *Service) TotalSent(peer swarm.Address) (totalSent *big.Int, err error)