forked from blocto/solana-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_cluster_nodes.go
32 lines (29 loc) · 878 Bytes
/
get_cluster_nodes.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
package rpc
import (
"context"
"errors"
)
type GetClusterNodesResponse struct {
FeatureSet *uint64 `json:"featureSet"`
Gossip string `json:"gossip"`
Pubkey string `json:"pubkey"`
RPC string `json:"rpc"`
ShredVersion int `json:"shredVersion"`
Tpu string `json:"tpu"`
Version *string `json:"version"`
}
// GetClusterNodes returns information about all the nodes participating in the cluster
func (s *RpcClient) GetClusterNodes(ctx context.Context) ([]GetClusterNodesResponse, error) {
res := struct {
GeneralResponse
Result []GetClusterNodesResponse `json:"result"`
}{}
err := s.request(ctx, "getClusterNodes", []interface{}{}, &res)
if err != nil {
return []GetClusterNodesResponse{}, err
}
if res.Error != nil {
return []GetClusterNodesResponse{}, errors.New(res.Error.Message)
}
return res.Result, nil
}