func New(proto swapprotocol.Interface, logger logging.Logger, store storage.StateStorer, chequebook chequebook.Service, chequeStore chequebook.ChequeStore, addressbook Addressbook, networkID uint64, cashout chequebook.CashoutService, accounting settlement.Accounting) *Service {
	return &Service{
		proto:       proto,
		logger:      logger,
		store:       store,
		metrics:     newMetrics(),
		chequebook:  chequebook,
		chequeStore: chequeStore,
		addressbook: addressbook,
		networkID:   networkID,
		cashout:     cashout,
		accounting:  accounting,
	}
}
New creates a new swap Service.
package swap
import (
	"context"
	"errors"
	"fmt"
	"math/big"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethsana/sana/pkg/logging"
	"github.com/ethsana/sana/pkg/settlement"
	"github.com/ethsana/sana/pkg/settlement/swap/chequebook"
	"github.com/ethsana/sana/pkg/settlement/swap/swapprotocol"
	"github.com/ethsana/sana/pkg/storage"
	"github.com/ethsana/sana/pkg/swarm"
)
var (
	ErrWrongChequebook = errors.New("wrong chequebook")
	ErrUnknownBeneficary = errors.New("unknown beneficiary for peer")
	ErrChequeValueTooLow = errors.New("cheque value too low")
)
type Interface interface {
	settlement.Interface
	LastSentCheque(peer swarm.Address) (*chequebook.SignedCheque, error)
	LastSentCheques() (map[string]*chequebook.SignedCheque, error)
	LastReceivedCheque(peer swarm.Address) (*chequebook.SignedCheque, error)
	LastReceivedCheques() (map[string]*chequebook.SignedCheque, error)
	CashCheque(ctx context.Context, peer swarm.Address) (common.Hash, error)
	CashoutStatus(ctx context.Context, peer swarm.Address) (*chequebook.CashoutStatus, error)
}
type Service struct {
	proto       swapprotocol.Interface
	logger      logging.Logger
	store       storage.StateStorer
	accounting  settlement.Accounting
	metrics     metrics
	chequebook  chequebook.Service
	chequeStore chequebook.ChequeStore
	cashout     chequebook.CashoutService
	addressbook Addressbook
	networkID   uint64
}