simplify rcp call methods
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
70083a03c9
commit
9d236b298a
40
client.go
40
client.go
|
@ -16,38 +16,22 @@ func newClient(url string) (*StatusGoClient, error) {
|
||||||
return &StatusGoClient{rpcClient}, nil
|
return &StatusGoClient{rpcClient}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StatusGoClient) nodeInfo() (*NodeInfo, error) {
|
func (c *StatusGoClient) nodeInfo() (info NodeInfo, err error) {
|
||||||
var info NodeInfo
|
err = c.rpcClient.Call(&info, "admin_nodeInfo")
|
||||||
err := c.rpcClient.Call(&info, "admin_nodeInfo")
|
return
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &info, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StatusGoClient) getPeers() ([]Peer, error) {
|
func (c *StatusGoClient) getPeers() (peers []Peer, err error) {
|
||||||
var peers []Peer
|
err = c.rpcClient.Call(&peers, "admin_peers")
|
||||||
err := c.rpcClient.Call(&peers, "admin_peers")
|
return
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return peers, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StatusGoClient) removePeer(enode string) (bool, error) {
|
func (c *StatusGoClient) removePeer(enode string) (success bool, err error) {
|
||||||
var rval bool
|
err = c.rpcClient.Call(&success, "admin_removePeer", enode)
|
||||||
err := c.rpcClient.Call(&rval, "admin_removePeer", enode)
|
return
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return rval, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StatusGoClient) trustPeer(enode string) (bool, error) {
|
func (c *StatusGoClient) trustPeer(enode string) (success bool, err error) {
|
||||||
var rval bool
|
err = c.rpcClient.Call(&success, "shh_markTrustedPeer", enode)
|
||||||
err := c.rpcClient.Call(&rval, "shh_markTrustedPeer", enode)
|
return
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return rval, nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,6 @@ func (s *StateController) GetInfo() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.State.UpdateInfo(*info)
|
s.State.UpdateInfo(info)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue