[validator] Turn int into string in JSON representation (#2454)

pull/2485/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent 2baab4864c
commit 51d5280e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      staking/effective/eligible.go
  2. 2
      staking/types/validator.go

@ -20,3 +20,16 @@ const (
// it can never be undone
Banned
)
func (e Eligibility) String() string {
switch e {
case Active:
return "active"
case Inactive:
return "inactive"
case Banned:
return "banned"
default:
return "nil"
}
}

@ -109,11 +109,13 @@ func (w ValidatorWrapper) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Validator
Address string `json:"address"`
EPOSStatus string `json:"epos-eligibility-status"`
Delegations Delegations `json:"delegations"`
Counters counters `json:"availability"`
}{
w.Validator,
common2.MustAddressToBech32(w.Address),
w.EPOSStatus.String(),
w.Delegations,
w.Counters,
})

Loading…
Cancel
Save