2019-08-20 15:38:40 +00:00
|
|
|
package accounts
|
|
|
|
|
|
|
|
import (
|
2019-08-28 07:49:03 +00:00
|
|
|
"github.com/ethereum/go-ethereum/event"
|
2019-08-20 15:38:40 +00:00
|
|
|
"github.com/ethereum/go-ethereum/p2p"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
2020-01-02 09:10:19 +00:00
|
|
|
|
2019-08-20 15:38:40 +00:00
|
|
|
"github.com/status-im/status-go/account"
|
|
|
|
"github.com/status-im/status-go/multiaccounts"
|
|
|
|
"github.com/status-im/status-go/multiaccounts/accounts"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewService initializes service instance.
|
2019-08-28 07:49:03 +00:00
|
|
|
func NewService(db *accounts.Database, mdb *multiaccounts.Database, manager *account.Manager, feed *event.Feed) *Service {
|
|
|
|
return &Service{db, mdb, manager, feed}
|
2019-08-20 15:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Service is a browsers service.
|
|
|
|
type Service struct {
|
|
|
|
db *accounts.Database
|
|
|
|
mdb *multiaccounts.Database
|
|
|
|
manager *account.Manager
|
2019-08-28 07:49:03 +00:00
|
|
|
feed *event.Feed
|
2019-08-20 15:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Start a service.
|
2021-06-30 11:40:54 +00:00
|
|
|
func (s *Service) Start() error {
|
2019-08-20 15:38:40 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop a service.
|
|
|
|
func (s *Service) Stop() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// APIs returns list of available RPC APIs.
|
|
|
|
func (s *Service) APIs() []rpc.API {
|
|
|
|
return []rpc.API{
|
|
|
|
{
|
|
|
|
Namespace: "settings",
|
|
|
|
Version: "0.1.0",
|
|
|
|
Service: NewSettingsAPI(s.db),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Namespace: "accounts",
|
|
|
|
Version: "0.1.0",
|
2019-08-28 07:49:03 +00:00
|
|
|
Service: NewAccountsAPI(s.db, s.feed),
|
2019-08-20 15:38:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Namespace: "multiaccounts",
|
|
|
|
Version: "0.1.0",
|
|
|
|
Service: NewMultiAccountsAPI(s.mdb, s.manager),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Protocols returns list of p2p protocols.
|
|
|
|
func (s *Service) Protocols() []p2p.Protocol {
|
|
|
|
return nil
|
|
|
|
}
|