2022-02-10 15:15:27 +00:00
|
|
|
package chat
|
|
|
|
|
|
|
|
import (
|
2022-02-25 17:52:03 +00:00
|
|
|
"database/sql"
|
|
|
|
|
2022-02-10 15:15:27 +00:00
|
|
|
"github.com/ethereum/go-ethereum/p2p"
|
|
|
|
gethrpc "github.com/ethereum/go-ethereum/rpc"
|
|
|
|
|
2022-02-25 17:52:03 +00:00
|
|
|
"github.com/status-im/status-go/multiaccounts/accounts"
|
2022-02-10 15:15:27 +00:00
|
|
|
"github.com/status-im/status-go/protocol"
|
|
|
|
)
|
|
|
|
|
2022-02-25 17:52:03 +00:00
|
|
|
func NewService(appDB *sql.DB) *Service {
|
|
|
|
return &Service{
|
|
|
|
accountsDB: accounts.NewDB(appDB),
|
|
|
|
}
|
2022-02-10 15:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Service struct {
|
2022-02-25 17:52:03 +00:00
|
|
|
messenger *protocol.Messenger
|
|
|
|
accountsDB *accounts.Database
|
2022-02-10 15:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Service) Init(messenger *protocol.Messenger) {
|
|
|
|
s.messenger = messenger
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Service) Start() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Service) Stop() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Service) APIs() []gethrpc.API {
|
|
|
|
return []gethrpc.API{
|
|
|
|
{
|
|
|
|
Namespace: "chat",
|
|
|
|
Version: "0.1.0",
|
|
|
|
Service: NewAPI(s),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Service) Protocols() []p2p.Protocol {
|
|
|
|
return nil
|
|
|
|
}
|