-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathget_vote_accounts.go
40 lines (32 loc) · 1.61 KB
/
get_vote_accounts.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
package rpc
import "context"
type GetVoteAccountsResponse JsonRpcResponse[GetVoteAccounts]
type GetVoteAccounts struct {
Current VoteAccounts `json:"current"`
Deliquent VoteAccounts `json:"delinquent"`
}
type VoteAccounts []VoteAccount
type VoteAccount struct {
VotePubkey string `json:"votePubkey"`
NodePubkey string `json:"nodePubkey"`
ActivatedStake uint64 `json:"activatedStake"`
Commission uint8 `json:"commission"`
EpochVoteAccount bool `json:"epochVoteAccount"`
LastVote uint64 `json:"lastVote"`
EpochCredits [][3]uint64 `json:"epochCredits"`
RootSlot uint64 `json:"rootSlot"`
}
type GetVoteAccountsConfig struct {
Commitment Commitment `json:"commitment,omitempty"`
VotePubkey string `json:"votePubkey,omitempty"`
KeepUnstakedDelinquents bool `json:"keepUnstakedDelinquents,omitempty"`
DelinquentSlotDistance uint64 `json:"delinquentSlotDistance,omitempty"`
}
// GetVoteAccounts returns the account info and associated stake for all the voting accounts in the current bank.
func (c *RpcClient) GetVoteAccounts(ctx context.Context) (JsonRpcResponse[GetVoteAccounts], error) {
return call[JsonRpcResponse[GetVoteAccounts]](c, ctx, "getVoteAccounts")
}
// GetVoteAccountsWithConfig returns the account info and associated stake for all the voting accounts in the current bank.
func (c *RpcClient) GetVoteAccountsWithConfig(ctx context.Context, cfg GetVoteAccountsConfig) (JsonRpcResponse[GetVoteAccounts], error) {
return call[JsonRpcResponse[GetVoteAccounts]](c, ctx, "getVoteAccounts", cfg)
}