Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination response for commands #6825

Merged
merged 24 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1c2fa93
migrated auth cli to use grpc query client
atheeshp Jul 21, 2020
212cec0
unpacker added for account command
atheeshp Jul 21, 2020
569c7e8
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 21, 2020
79f67a7
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 21, 2020
c83e93d
fxed tests
atheeshp Jul 21, 2020
d0d90e5
added grpc register in module.go
atheeshp Jul 23, 2020
360577f
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 23, 2020
2617f95
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 23, 2020
6a498f3
fixed grpc failing issue
atheeshp Jul 23, 2020
ba024de
page resonse added for console
atheeshp Jul 23, 2020
087a37b
added reference
atheeshp Jul 23, 2020
93daaee
paginations res added for commands
atheeshp Jul 23, 2020
65059c1
Merge branch 'master' into atheesh/5921-missing-grpc
sahith-narahari Jul 28, 2020
94af6c3
Merge branch 'master' into atheesh/5921-missing-grpc
sahith-narahari Jul 30, 2020
c5a21ab
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 30, 2020
d2bb085
Merge branch 'atheesh/5921-missing-grpc' of github.com:cosmos/cosmos-…
atheeshp Jul 30, 2020
0b50cea
Merge branch 'master' into atheesh/5921-missing-grpc
sahith-narahari Aug 6, 2020
02af509
Merge branch 'master' into atheesh/5921-missing-grpc
fedekunze Aug 6, 2020
da6870c
Merge branch 'master' into atheesh/5921-missing-grpc
sahith-narahari Aug 6, 2020
da9f472
Merge branch 'master' into atheesh/5921-missing-grpc
mergify[bot] Aug 6, 2020
cfead25
Merge branch 'master' into atheesh/5921-missing-grpc
mergify[bot] Aug 7, 2020
6011036
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
sahith-narahari Aug 7, 2020
9260879
Merge branch 'atheesh/5921-missing-grpc' of github.com:cosmos/cosmos-…
sahith-narahari Aug 7, 2020
4830366
Fix auth cli tests
sahith-narahari Aug 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions x/bank/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/x/bank/client/cli"
banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil"
"github.com/cosmos/cosmos-sdk/x/bank/types"
)

type IntegrationTestSuite struct {
Expand Down Expand Up @@ -62,11 +64,14 @@ func (s *IntegrationTestSuite) TestGetBalancesCmd() {
fmt.Sprintf("--%s=1", flags.FlagHeight),
},
false,
&sdk.Coins{},
sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)),
),
&types.QueryAllBalancesResponse{},
&types.QueryAllBalancesResponse{
Balances: sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)),
),
Pagination: &query.PageResponse{},
},
sahith-narahari marked this conversation as resolved.
Show resolved Hide resolved
},
{
"total account balance of a specific denom",
Expand Down
2 changes: 1 addition & 1 deletion x/bank/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Example:
if err != nil {
return err
}
return clientCtx.PrintOutput(res.Balances)
return clientCtx.PrintOutput(res)
}

params := types.NewQueryBalanceRequest(addr, denom)
Expand Down
4 changes: 2 additions & 2 deletions x/distribution/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
"null",
"{\"slashes\":null,\"pagination\":{}}",
},
{
"text output",
Expand All @@ -309,7 +309,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() {
sdk.ValAddress(val.Address).String(), "1", "3",
},
false,
"null",
"pagination: {}\nslashes: null",
anilcse marked this conversation as resolved.
Show resolved Hide resolved
},
}

Expand Down
2 changes: 1 addition & 1 deletion x/distribution/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ $ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmq
return err
}

return clientCtx.PrintOutput(res.GetSlashes())
return clientCtx.PrintOutput(res)
},
}

Expand Down
10 changes: 6 additions & 4 deletions x/gov/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ $ %s query gov proposals --page=2 --limit=100
}

if len(res.GetProposals()) == 0 {
return fmt.Errorf("no matching proposals found")
return fmt.Errorf("no proposals found")
}

return clientCtx.PrintOutput(res.GetProposals())
return clientCtx.PrintOutput(res)
},
}

Expand Down Expand Up @@ -311,11 +311,12 @@ $ %[1]s query gov votes 1 --page=2 --limit=100
context.Background(),
&types.QueryVotesRequest{ProposalId: proposalID, Pagination: pageReq},
)

if err != nil {
return err
}

return clientCtx.PrintOutput(res.GetVotes())
return clientCtx.PrintOutput(res)

},
}
Expand Down Expand Up @@ -458,11 +459,12 @@ $ %s query gov deposits 1
context.Background(),
&types.QueryDepositsRequest{ProposalId: proposalID, Pagination: pageReq},
)

if err != nil {
return err
}

return clientCtx.PrintOutput(res.GetDeposits())
return clientCtx.PrintOutput(res)
},
}

Expand Down
2 changes: 1 addition & 1 deletion x/slashing/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ $ <appcli> query slashing signing-infos
return err
}

return clientCtx.PrintOutput(res.Info)
return clientCtx.PrintOutput(res)
},
}

Expand Down
12 changes: 6 additions & 6 deletions x/staking/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ $ %s query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj6
return err
}

return clientCtx.PrintOutput(res.UnbondingResponses)
return clientCtx.PrintOutput(res)
},
}

Expand Down Expand Up @@ -234,7 +234,7 @@ $ %s query staking redelegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fx
return err
}

return clientCtx.PrintOutput(res.RedelegationResponses)
return clientCtx.PrintOutput(res)
},
}

Expand Down Expand Up @@ -342,7 +342,7 @@ $ %s query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
return err
}

return clientCtx.PrintOutput(res.DelegationResponses)
return clientCtx.PrintOutput(res)
Copy link
Collaborator

@anilcse anilcse Aug 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add cli-tests for these queries, I remember @sahith-narahari working on querier tests?

},
}

Expand Down Expand Up @@ -397,7 +397,7 @@ $ %s query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ld
return err
}

return clientCtx.PrintOutput(res.DelegationResponses)
return clientCtx.PrintOutput(res)
},
}

Expand Down Expand Up @@ -506,7 +506,7 @@ $ %s query staking unbonding-delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld
return err
}

return clientCtx.PrintOutput(res.UnbondingResponses)
return clientCtx.PrintOutput(res)
},
}

Expand Down Expand Up @@ -621,7 +621,7 @@ $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
return err
}

return clientCtx.PrintOutput(res.RedelegationResponses)
return clientCtx.PrintOutput(res)
},
}

Expand Down