6 dpos "github.com/vapor/consensus/consensus/dpos"
9 func (a *API) listDelegates(ctx context.Context) Response {
10 return NewSuccessResponse(dpos.GDpos.ListDelegates())
13 func (a *API) getDelegateVotes(ctx context.Context, ins struct {
14 DelegateAddress string `json:"delegate_address"`
16 votes := map[string]uint64{"votes": dpos.GDpos.GetDelegateVotes(ins.DelegateAddress)}
17 return NewSuccessResponse(votes)
20 func (a *API) listVotedDelegates(ctx context.Context, ins struct {
21 Voter string `json:"voter"`
23 delegates := make(map[string]string)
24 for _, delegate := range dpos.GDpos.GetVotedDelegates(ins.Voter) {
25 delegates[dpos.GDpos.GetDelegateName(delegate)] = delegate
27 return NewSuccessResponse(delegates)
30 func (a *API) listReceivedVotes(ctx context.Context, ins struct {
31 DelegateAddress string `json:"delegate_address"`
33 return NewSuccessResponse(dpos.GDpos.GetDelegateVoters(ins.DelegateAddress))
36 func (a *API) getAddressBalance(ctx context.Context, ins struct {
37 Address string `json:"address"`
39 return NewSuccessResponse(dpos.GDpos.GetAddressBalance(ins.Address))