LCD and CLI
This commit is contained in:
+16
-1
@@ -538,7 +538,7 @@ func TestBonding(t *testing.T) {
|
||||
|
||||
require.Equal(t, int64(40), coins.AmountOf(denom).Int64())
|
||||
|
||||
// query validator
|
||||
// query delegation
|
||||
bond := getDelegation(t, port, addr, operAddrs[0])
|
||||
require.Equal(t, amt, bond.Shares)
|
||||
|
||||
@@ -546,6 +546,10 @@ func TestBonding(t *testing.T) {
|
||||
require.Len(t, delegatorDels, 1)
|
||||
require.Equal(t, amt, delegatorDels[0].Shares)
|
||||
|
||||
// query all delegations to validator
|
||||
bonds := getValidatorDelegations(t, port, operAddrs[0])
|
||||
require.Len(t, bonds, 2)
|
||||
|
||||
bondedValidators := getDelegatorValidators(t, port, addr)
|
||||
require.Len(t, bondedValidators, 1)
|
||||
require.Equal(t, operAddrs[0], bondedValidators[0].OperatorAddr)
|
||||
@@ -1206,6 +1210,17 @@ func getValidator(t *testing.T, port string, validatorAddr sdk.ValAddress) stake
|
||||
return validator
|
||||
}
|
||||
|
||||
func getValidatorDelegations(t *testing.T, port string, validatorAddr sdk.ValAddress) []stake.Delegation {
|
||||
res, body := Request(t, port, "GET", fmt.Sprintf("/stake/validators/%s/delegations", validatorAddr.String()), nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var delegations []stake.Delegation
|
||||
err := cdc.UnmarshalJSON([]byte(body), &delegations)
|
||||
require.Nil(t, err)
|
||||
|
||||
return delegations
|
||||
}
|
||||
|
||||
func getValidatorUnbondingDelegations(t *testing.T, port string, validatorAddr sdk.ValAddress) []stake.UnbondingDelegation {
|
||||
res, body := Request(t, port, "GET", fmt.Sprintf("/stake/validators/%s/unbonding_delegations", validatorAddr.String()), nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
Reference in New Issue
Block a user