You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
package newclientsupport
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
|
msg_pb "github.com/harmony-one/harmony/api/proto/message"
|
|
)
|
|
|
|
// Service is the client support service.
|
|
type Service struct {
|
|
server *msg_pb.Server
|
|
messageChan chan *msg_pb.Message
|
|
}
|
|
|
|
// New returns new client support service.
|
|
func New(
|
|
CreateTransactionForEnterMethod func(int64, string) error,
|
|
GetResult func(string) ([]string, []*big.Int),
|
|
CreateTransactionForPickWinner func() error,
|
|
) *Service {
|
|
return &Service{
|
|
server: msg_pb.NewServer(CreateTransactionForEnterMethod, GetResult, CreateTransactionForPickWinner),
|
|
}
|
|
}
|
|
|
|
// StartService starts client support service.
|
|
func (s *Service) StartService() {
|
|
s.server.Start()
|
|
}
|
|
|
|
// StopService stops client support service.
|
|
func (s *Service) StopService() {
|
|
s.server.Stop()
|
|
}
|
|
|
|
// SetMessageChan sets up message channel to service.
|
|
func (s *Service) SetMessageChan(messageChan chan *msg_pb.Message) {
|
|
s.messageChan = messageChan
|
|
}
|
|
|
|
// NotifyService notify service
|
|
func (s *Service) NotifyService(params map[string]interface{}) {
|
|
return
|
|
}
|
|
|
|
// APIs for the services.
|
|
func (s *Service) APIs() []rpc.API {
|
|
return nil
|
|
}
|
|
|