diff --git a/x/auth/client/cli/cli_test.go b/x/auth/client/cli/cli_test.go index 134824048..876ab3a74 100644 --- a/x/auth/client/cli/cli_test.go +++ b/x/auth/client/cli/cli_test.go @@ -214,10 +214,10 @@ func (s *IntegrationTestSuite) TestCLISendGenerateSignAndBroadcast() { resp, err := bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), val1.Address) s.Require().NoError(err) - var coins sdk.Coins - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + var balRes banktypes.QueryAllBalancesResponse + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - startTokens := coins.AmountOf(s.cfg.BondDenom) + startTokens := balRes.Balances.AmountOf(s.cfg.BondDenom) // Test generate sendTx, estimate gas finalGeneratedTx, err := bankcli.MsgSendExec( @@ -284,9 +284,9 @@ func (s *IntegrationTestSuite) TestCLISendGenerateSignAndBroadcast() { resp, err = bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), val1.Address) s.Require().NoError(err) - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - s.Require().Equal(startTokens, coins.AmountOf(s.cfg.BondDenom)) + s.Require().Equal(startTokens, balRes.Balances.AmountOf(s.cfg.BondDenom)) // Test broadcast @@ -307,15 +307,15 @@ func (s *IntegrationTestSuite) TestCLISendGenerateSignAndBroadcast() { resp, err = bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), account.GetAddress()) s.Require().NoError(err) - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - s.Require().Equal(sendTokens.Amount, coins.AmountOf(s.cfg.BondDenom)) + s.Require().Equal(sendTokens.Amount, balRes.Balances.AmountOf(s.cfg.BondDenom)) // Ensure origin account state resp, err = bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), val1.Address) s.Require().NoError(err) - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) } @@ -451,10 +451,10 @@ func (s *IntegrationTestSuite) TestCLIMultisignSortSignatures() { resp, err := bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), multisigInfo.GetAddress()) s.Require().NoError(err) - var coins sdk.Coins - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + var balRes banktypes.QueryAllBalancesResponse + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - intialCoins := coins + intialCoins := balRes.Balances // Send coins from validator to multisig. sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) @@ -475,9 +475,9 @@ func (s *IntegrationTestSuite) TestCLIMultisignSortSignatures() { resp, err = bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), multisigInfo.GetAddress()) s.Require().NoError(err) - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - diff, _ := coins.SafeSub(intialCoins) + diff, _ := balRes.Balances.SafeSub(intialCoins) s.Require().Equal(sendTokens.Amount, diff.AmountOf(s.cfg.BondDenom)) // Generate multisig transaction. @@ -567,10 +567,10 @@ func (s *IntegrationTestSuite) TestCLIMultisign() { resp, err := bankcli.QueryBalancesExec(val1.ClientCtx.WithOutputFormat("json"), multisigInfo.GetAddress()) s.Require().NoError(err) - var coins sdk.Coins - err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &coins) + var balRes banktypes.QueryAllBalancesResponse + err = val1.ClientCtx.JSONMarshaler.UnmarshalJSON(resp.Bytes(), &balRes) s.Require().NoError(err) - s.Require().Equal(sendTokens.Amount, coins.AmountOf(s.cfg.BondDenom)) + s.Require().Equal(sendTokens.Amount, balRes.Balances.AmountOf(s.cfg.BondDenom)) // Generate multisig transaction. multiGeneratedTx, err := bankcli.MsgSendExec( diff --git a/x/bank/client/cli/cli_test.go b/x/bank/client/cli/cli_test.go index 70dad17ff..ca4e32800 100644 --- a/x/bank/client/cli/cli_test.go +++ b/x/bank/client/cli/cli_test.go @@ -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 { @@ -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{}, + }, }, { "total account balance of a specific denom", diff --git a/x/bank/client/cli/query.go b/x/bank/client/cli/query.go index d03447fe2..fb00993bb 100644 --- a/x/bank/client/cli/query.go +++ b/x/bank/client/cli/query.go @@ -84,7 +84,7 @@ Example: if err != nil { return err } - return clientCtx.PrintOutput(res.Balances) + return clientCtx.PrintOutput(res) } params := types.NewQueryBalanceRequest(addr, denom) diff --git a/x/distribution/client/cli/cli_test.go b/x/distribution/client/cli/cli_test.go index 87bb5ec1c..7aba70e57 100644 --- a/x/distribution/client/cli/cli_test.go +++ b/x/distribution/client/cli/cli_test.go @@ -299,7 +299,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - "null", + "{\"slashes\":null,\"pagination\":{}}", }, { "text output", @@ -309,7 +309,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() { sdk.ValAddress(val.Address).String(), "1", "3", }, false, - "null", + "pagination: {}\nslashes: null", }, } diff --git a/x/distribution/client/cli/query.go b/x/distribution/client/cli/query.go index cb9ebcb8f..14138e1b8 100644 --- a/x/distribution/client/cli/query.go +++ b/x/distribution/client/cli/query.go @@ -209,7 +209,7 @@ $ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmq return err } - return clientCtx.PrintOutput(res.GetSlashes()) + return clientCtx.PrintOutput(res) }, } diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 90d36a3eb..095cfa5fd 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -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) }, } @@ -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) }, } @@ -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) }, } diff --git a/x/slashing/client/cli/query.go b/x/slashing/client/cli/query.go index 88b58d59a..c174616cf 100644 --- a/x/slashing/client/cli/query.go +++ b/x/slashing/client/cli/query.go @@ -104,7 +104,7 @@ $ query slashing signing-infos return err } - return clientCtx.PrintOutput(res.Info) + return clientCtx.PrintOutput(res) }, } diff --git a/x/staking/client/cli/query.go b/x/staking/client/cli/query.go index 6980d03bb..295ea79cc 100644 --- a/x/staking/client/cli/query.go +++ b/x/staking/client/cli/query.go @@ -179,7 +179,7 @@ $ %s query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj6 return err } - return clientCtx.PrintOutput(res.UnbondingResponses) + return clientCtx.PrintOutput(res) }, } @@ -234,7 +234,7 @@ $ %s query staking redelegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fx return err } - return clientCtx.PrintOutput(res.RedelegationResponses) + return clientCtx.PrintOutput(res) }, } @@ -342,7 +342,7 @@ $ %s query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p return err } - return clientCtx.PrintOutput(res.DelegationResponses) + return clientCtx.PrintOutput(res) }, } @@ -397,7 +397,7 @@ $ %s query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ld return err } - return clientCtx.PrintOutput(res.DelegationResponses) + return clientCtx.PrintOutput(res) }, } @@ -506,7 +506,7 @@ $ %s query staking unbonding-delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld return err } - return clientCtx.PrintOutput(res.UnbondingResponses) + return clientCtx.PrintOutput(res) }, } @@ -621,7 +621,7 @@ $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p return err } - return clientCtx.PrintOutput(res.RedelegationResponses) + return clientCtx.PrintOutput(res) }, }