2018-04-10 10:02:54 +00:00
|
|
|
package personal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/accounts"
|
|
|
|
"github.com/ethereum/go-ethereum/ethapi"
|
|
|
|
"github.com/ethereum/go-ethereum/node"
|
|
|
|
"github.com/ethereum/go-ethereum/p2p"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Make sure that Service implements node.Service interface.
|
2021-06-30 11:40:54 +00:00
|
|
|
var _ node.Lifecycle = (*Service)(nil)
|
2018-04-10 10:02:54 +00:00
|
|
|
|
|
|
|
// Service represents out own implementation of personal sign operations.
|
|
|
|
type Service struct {
|
|
|
|
am *accounts.Manager
|
|
|
|
}
|
|
|
|
|
|
|
|
// New returns a new Service.
|
|
|
|
func New(am *accounts.Manager) *Service {
|
|
|
|
return &Service{am}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Protocols returns a new protocols list. In this case, there are none.
|
|
|
|
func (s *Service) Protocols() []p2p.Protocol {
|
|
|
|
return []p2p.Protocol{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// APIs returns a list of new APIs.
|
|
|
|
func (s *Service) APIs() []rpc.API {
|
|
|
|
return []rpc.API{
|
|
|
|
{
|
|
|
|
Namespace: "personal",
|
|
|
|
Version: "1.0",
|
|
|
|
Service: ethapi.NewLimitedPersonalAPI(s.am),
|
|
|
|
Public: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start is run when a service is started.
|
|
|
|
// It does nothing in this case but is required by `node.Service` interface.
|
2021-06-30 11:40:54 +00:00
|
|
|
func (s *Service) Start() error {
|
2018-04-10 10:02:54 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop is run when a service is stopped.
|
|
|
|
// It does nothing in this case but is required by `node.Service` interface.
|
|
|
|
func (s *Service) Stop() error {
|
|
|
|
return nil
|
|
|
|
}
|