-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfo.go
41 lines (34 loc) · 941 Bytes
/
info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package eclair
import "encoding/json"
const (
infoPath = "/getinfo"
)
type Info struct {
Version string `json:"version"`
NodeId string `json:"nodeId"`
Alias string `json:"alias"`
Color string `json:"color"`
Features Features `json:"features"`
ChainHash string `json:"chainHash"`
Network string `json:"network"`
BlockHeight int `json:"blockHeight"`
PublicAddresses []string `json:"publicAddresses"`
InstanceId string `json:"instanceId"`
}
type Features struct {
Activated map[string]string `json:"activated"`
Unknown []interface{} `json:"unknown"`
}
// GetInfo returns information about the node.
func (c *Client) GetInfo() (*Info, error) {
info := Info{}
data, err := c.Post(infoPath, nil, nil)
if err != nil {
return nil, err
}
err = json.Unmarshal(data, &info)
if err != nil {
return nil, err
}
return &info, nil
}