Add pagination response for commands (#6825)

* migrated auth cli to use grpc query client

* unpacker added for account command

* fxed tests

* added grpc register in module.go

* fixed grpc failing issue

* page resonse added for console

* added reference

* paginations res added for commands

* Fix auth cli tests

Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
atheeshp
2020-08-07 10:20:22 +00:00
committed by GitHub
co-authored by SaReN Federico Kunze mergify[bot]
parent ceba0cb45d
commit 3322e269a1
8 changed files with 43 additions and 36 deletions
+16 -16
View File
@@ -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(