diff --git a/docs/sdk/clients.md b/docs/sdk/clients.md index 4f0669183..3c0ca5c50 100644 --- a/docs/sdk/clients.md +++ b/docs/sdk/clients.md @@ -341,6 +341,13 @@ Additionally, as you can get all the outgoing redelegations from a particular va To get previous redelegation(s) status on past blocks, try adding the `--height` flag. +##### Query Delegations To Validator + +You can also query all of the delegations to a particular validator: +```bash + gaiacli query delegations-to +``` + ### Governance Governance is the process from which users in the Cosmos Hub can come to consensus on software upgrades, parameters of the mainnet or on custom text proposals. This is done through voting on proposals, which will be submitted by `Atom` holders on the mainnet. diff --git a/x/stake/keeper/delegation_test.go b/x/stake/keeper/delegation_test.go index fcf2f4206..661224621 100644 --- a/x/stake/keeper/delegation_test.go +++ b/x/stake/keeper/delegation_test.go @@ -96,6 +96,13 @@ func TestDelegation(t *testing.T) { resVals = keeper.GetDelegatorValidators(ctx, addrDels[1], 4) require.Equal(t, 3, len(resVals)) + resDels := keeper.GetValidatorDelegations(ctx, addrVals[0]) + require.Len(t, resDels, 2) + resDels = keeper.GetValidatorDelegations(ctx, addrVals[1]) + require.Len(t, resDels, 2) + resDels = keeper.GetValidatorDelegations(ctx, addrVals[2]) + require.Len(t, resDels, 2) + for i := 0; i < 3; i++ { resVal, err := keeper.GetDelegatorValidator(ctx, addrDels[0], addrVals[i])