github.com/status-im/status-go@v1.1.0/services/personal/service.go (about) 1 package personal 2 3 import ( 4 "github.com/ethereum/go-ethereum/accounts" 5 "github.com/ethereum/go-ethereum/ethapi" 6 "github.com/ethereum/go-ethereum/node" 7 "github.com/ethereum/go-ethereum/p2p" 8 "github.com/ethereum/go-ethereum/rpc" 9 ) 10 11 // Make sure that Service implements node.Service interface. 12 var _ node.Lifecycle = (*Service)(nil) 13 14 // Service represents out own implementation of personal sign operations. 15 type Service struct { 16 am *accounts.Manager 17 } 18 19 // New returns a new Service. 20 func New(am *accounts.Manager) *Service { 21 return &Service{am} 22 } 23 24 // Protocols returns a new protocols list. In this case, there are none. 25 func (s *Service) Protocols() []p2p.Protocol { 26 return []p2p.Protocol{} 27 } 28 29 // APIs returns a list of new APIs. 30 func (s *Service) APIs() []rpc.API { 31 return []rpc.API{ 32 { 33 Namespace: "personal", 34 Version: "1.0", 35 Service: ethapi.NewLimitedPersonalAPI(s.am), 36 Public: false, 37 }, 38 } 39 } 40 41 // Start is run when a service is started. 42 // It does nothing in this case but is required by `node.Service` interface. 43 func (s *Service) Start() error { 44 return nil 45 } 46 47 // Stop is run when a service is stopped. 48 // It does nothing in this case but is required by `node.Service` interface. 49 func (s *Service) Stop() error { 50 return nil 51 }