From 79976604a9350c279edc212c7c837b92a345e7e0 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Tue, 11 Jun 2019 11:24:51 -0700 Subject: [PATCH 1/4] return account queries with height --- x/auth/client/rest/query.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 68f58aecbab2..90a28c1d2bbf 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -12,6 +12,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" ) +// AccountWithQueryHeight wraps the embedded Account +// with the height it was queried at +type AccountWithQueryHeight struct { + types.Account + Height int64 `json:"height"` +} + // register REST routes func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) { r.HandleFunc( @@ -64,7 +71,12 @@ func QueryAccountRequestHandlerFn( return } - rest.PostProcessResponse(w, cliCtx, account) + if cliCtx.Height > 0 { + accountWithHeight := AccountWithQueryHeight{account, cliCtx.Height} + rest.PostProcessResponse(w, cliCtx, accountWithHeight) + } else { + rest.PostProcessResponse(w, cliCtx, account) + } } } From ef7aede597450a75d3bbcb11f3d4ddac6fdd3557 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Tue, 11 Jun 2019 17:34:34 -0700 Subject: [PATCH 2/4] update clictx to return height on account query --- client/context/query.go | 41 +++++++++++++++++++++++-------------- x/auth/client/rest/query.go | 10 +++------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/client/context/query.go b/client/context/query.go index fa1cceb5bb2c..6d65d9209c03 100644 --- a/client/context/query.go +++ b/client/context/query.go @@ -31,24 +31,33 @@ func (ctx CLIContext) GetNode() (rpcclient.Client, error) { // Query performs a query for information about the connected node. func (ctx CLIContext) Query(path string, data cmn.HexBytes) (res []byte, err error) { - return ctx.query(path, data) + resp, err := ctx.query(path, data) + return resp.Value, err } // Query information about the connected node with a data payload func (ctx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error) { - return ctx.query(path, data) + resp, err := ctx.query(path, data) + return resp.Value, err } // QueryStore performs a query from a Tendermint node with the provided key and // store name. func (ctx CLIContext) QueryStore(key cmn.HexBytes, storeName string) (res []byte, err error) { + res, _, err = ctx.queryStore(key, storeName, "key") + return res, err +} + +// QueryStoreWithHeight performs a query from a Tendermint node with the provided key and +// store name. Returns the queried data along with the height the query was performed at. +func (ctx CLIContext) QueryStoreWithHeight(key cmn.HexBytes, storeName string) (res []byte, height int64, err error) { return ctx.queryStore(key, storeName, "key") } // QuerySubspace performs a query from a Tendermint node with the provided // store name and subspace. func (ctx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error) { - resRaw, err := ctx.queryStore(subspace, storeName, "subspace") + resRaw, _, err := ctx.queryStore(subspace, storeName, "subspace") if err != nil { return res, err } @@ -126,6 +135,7 @@ func (ctx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error { // queryAccount queries an account using custom query endpoint of auth module // returns an error if result is `null` otherwise account data +// returns the height the account was queried at func (ctx CLIContext) queryAccount(addr sdk.AccAddress) ([]byte, error) { bz, err := ctx.Codec.MarshalJSON(authtypes.NewQueryAccountParams(addr)) if err != nil { @@ -134,20 +144,20 @@ func (ctx CLIContext) queryAccount(addr sdk.AccAddress) ([]byte, error) { route := fmt.Sprintf("custom/%s/%s", ctx.AccountStore, authtypes.QueryAccount) - res, err := ctx.QueryWithData(route, bz) + resp, err := ctx.query(route, bz) if err != nil { return nil, err } - return res, nil + return resp.Value, nil } // query performs a query from a Tendermint node with the provided store name // and path. -func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, err error) { +func (ctx CLIContext) query(path string, key cmn.HexBytes) (resp abci.ResponseQuery, err error) { node, err := ctx.GetNode() if err != nil { - return res, err + return resp, err } opts := rpcclient.ABCIQueryOptions{ @@ -157,25 +167,25 @@ func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, err erro result, err := node.ABCIQueryWithOptions(path, key, opts) if err != nil { - return res, err + return resp, err } - resp := result.Response + resp = result.Response if !resp.IsOK() { - return res, errors.New(resp.Log) + return resp, errors.New(resp.Log) } // data from trusted node or subspace query doesn't need verification if ctx.TrustNode || !isQueryStoreWithProof(path) { - return resp.Value, nil + return resp, nil } err = ctx.verifyProof(path, resp) if err != nil { - return nil, err + return abci.ResponseQuery{}, err } - return resp.Value, nil + return resp, nil } // Verify verifies the consensus proof at given height. @@ -233,9 +243,10 @@ func (ctx CLIContext) verifyProof(queryPath string, resp abci.ResponseQuery) err // queryStore performs a query from a Tendermint node with the provided a store // name and path. -func (ctx CLIContext) queryStore(key cmn.HexBytes, storeName, endPath string) ([]byte, error) { +func (ctx CLIContext) queryStore(key cmn.HexBytes, storeName, endPath string) ([]byte, int64, error) { path := fmt.Sprintf("/store/%s/%s", storeName, endPath) - return ctx.query(path, key) + resp, err := ctx.query(path, key) + return resp.Value, resp.Height, err } // isQueryStoreWithProof expects a format like /// diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 90a28c1d2bbf..4045dfb6fa50 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -52,7 +52,7 @@ func QueryAccountRequestHandlerFn( return } - res, err := cliCtx.QueryStore(types.AddressStoreKey(addr), storeName) + res, height, err := cliCtx.QueryStoreWithHeight(types.AddressStoreKey(addr), storeName) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -71,12 +71,8 @@ func QueryAccountRequestHandlerFn( return } - if cliCtx.Height > 0 { - accountWithHeight := AccountWithQueryHeight{account, cliCtx.Height} - rest.PostProcessResponse(w, cliCtx, accountWithHeight) - } else { - rest.PostProcessResponse(w, cliCtx, account) - } + accountWithHeight := AccountWithQueryHeight{account, height} + rest.PostProcessResponse(w, cliCtx, accountWithHeight) } } From 02b4ad3419ade2282a2b4a0a6213090317e015d0 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Wed, 12 Jun 2019 16:19:49 -0700 Subject: [PATCH 3/4] Query, QueryStore and QueryWithData return query height --- client/context/query.go | 77 +++++++++++++------------- client/rpc/root.go | 2 +- client/utils/utils.go | 4 +- client/utils/utils_test.go | 8 +-- x/auth/client/rest/query.go | 11 ++-- x/distribution/client/cli/query.go | 6 +- x/distribution/client/common/common.go | 20 ++++--- x/distribution/client/rest/query.go | 6 +- x/gov/client/cli/query.go | 20 +++---- x/gov/client/rest/rest.go | 24 ++++---- x/gov/client/utils/query.go | 2 +- x/ibc/client/cli/relay.go | 3 +- x/mint/client/cli/query.go | 6 +- x/mint/client/rest/query.go | 6 +- x/slashing/client/cli/query.go | 4 +- x/slashing/client/rest/query.go | 6 +- x/staking/client/cli/query.go | 26 ++++----- x/staking/client/rest/query.go | 8 +-- x/staking/client/rest/utils.go | 6 +- 19 files changed, 123 insertions(+), 122 deletions(-) diff --git a/client/context/query.go b/client/context/query.go index 6d65d9209c03..6153baca4424 100644 --- a/client/context/query.go +++ b/client/context/query.go @@ -29,37 +29,34 @@ func (ctx CLIContext) GetNode() (rpcclient.Client, error) { return ctx.Client, nil } -// Query performs a query for information about the connected node. -func (ctx CLIContext) Query(path string, data cmn.HexBytes) (res []byte, err error) { - resp, err := ctx.query(path, data) - return resp.Value, err +// Query performs a query to a Tendermint node with the provided path. +// It returns the result and height of the query upon success +// or an error if the query fails. +func (ctx CLIContext) Query(path string, data cmn.HexBytes) ([]byte, int64, error) { + return ctx.query(path, data) } -// Query information about the connected node with a data payload -func (ctx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error) { - resp, err := ctx.query(path, data) - return resp.Value, err +// QueryWithData performs a query to a Tendermint node with the provided path +// and a data payload. It returns the result and height of the query upon success +// or an error if the query fails. +func (ctx CLIContext) QueryWithData(path string, data []byte) ([]byte, int64, error) { + return ctx.query(path, data) } -// QueryStore performs a query from a Tendermint node with the provided key and -// store name. -func (ctx CLIContext) QueryStore(key cmn.HexBytes, storeName string) (res []byte, err error) { - res, _, err = ctx.queryStore(key, storeName, "key") - return res, err -} - -// QueryStoreWithHeight performs a query from a Tendermint node with the provided key and -// store name. Returns the queried data along with the height the query was performed at. -func (ctx CLIContext) QueryStoreWithHeight(key cmn.HexBytes, storeName string) (res []byte, height int64, err error) { +// QueryStore performs a query to a Tendermint node with the provided key and +// store name. It returns the result and height of the query upon success +// or an error if the query fails. +func (ctx CLIContext) QueryStore(key cmn.HexBytes, storeName string) ([]byte, int64, error) { return ctx.queryStore(key, storeName, "key") } -// QuerySubspace performs a query from a Tendermint node with the provided -// store name and subspace. -func (ctx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error) { - resRaw, _, err := ctx.queryStore(subspace, storeName, "subspace") +// QuerySubspace performs a query to a Tendermint node with the provided +// store name and subspace. It returns key value pair and height of the query +// upon success or an error if the query fails. +func (ctx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, height int64, err error) { + resRaw, height, err := ctx.queryStore(subspace, storeName, "subspace") if err != nil { - return res, err + return res, height, err } ctx.Codec.MustUnmarshalBinaryLengthPrefixed(resRaw, &res) @@ -135,7 +132,6 @@ func (ctx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error { // queryAccount queries an account using custom query endpoint of auth module // returns an error if result is `null` otherwise account data -// returns the height the account was queried at func (ctx CLIContext) queryAccount(addr sdk.AccAddress) ([]byte, error) { bz, err := ctx.Codec.MarshalJSON(authtypes.NewQueryAccountParams(addr)) if err != nil { @@ -144,20 +140,21 @@ func (ctx CLIContext) queryAccount(addr sdk.AccAddress) ([]byte, error) { route := fmt.Sprintf("custom/%s/%s", ctx.AccountStore, authtypes.QueryAccount) - resp, err := ctx.query(route, bz) + res, _, err := ctx.query(route, bz) if err != nil { return nil, err } - return resp.Value, nil + return res, nil } -// query performs a query from a Tendermint node with the provided store name -// and path. -func (ctx CLIContext) query(path string, key cmn.HexBytes) (resp abci.ResponseQuery, err error) { +// query performs a query to a Tendermint node with the provided store name +// and path. It returns the result and height of the query upon success +// or an error if the query fails. +func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, height int64, err error) { node, err := ctx.GetNode() if err != nil { - return resp, err + return res, height, err } opts := rpcclient.ABCIQueryOptions{ @@ -167,25 +164,25 @@ func (ctx CLIContext) query(path string, key cmn.HexBytes) (resp abci.ResponseQu result, err := node.ABCIQueryWithOptions(path, key, opts) if err != nil { - return resp, err + return res, height, err } - resp = result.Response + resp := result.Response if !resp.IsOK() { - return resp, errors.New(resp.Log) + return res, height, errors.New(resp.Log) } // data from trusted node or subspace query doesn't need verification if ctx.TrustNode || !isQueryStoreWithProof(path) { - return resp, nil + return resp.Value, resp.Height, nil } err = ctx.verifyProof(path, resp) if err != nil { - return abci.ResponseQuery{}, err + return res, height, err } - return resp, nil + return resp.Value, resp.Height, nil } // Verify verifies the consensus proof at given height. @@ -241,12 +238,12 @@ func (ctx CLIContext) verifyProof(queryPath string, resp abci.ResponseQuery) err return nil } -// queryStore performs a query from a Tendermint node with the provided a store -// name and path. +// queryStore performs a query to a Tendermint node with the provided a store +// name and path. It returns the result and height of the query upon success +// or an error if the query fails. func (ctx CLIContext) queryStore(key cmn.HexBytes, storeName, endPath string) ([]byte, int64, error) { path := fmt.Sprintf("/store/%s/%s", storeName, endPath) - resp, err := ctx.query(path, key) - return resp.Value, resp.Height, err + return ctx.query(path, key) } // isQueryStoreWithProof expects a format like /// diff --git a/client/rpc/root.go b/client/rpc/root.go index 889fbc3a4d2b..eb4b36820d33 100644 --- a/client/rpc/root.go +++ b/client/rpc/root.go @@ -35,7 +35,7 @@ func CLIVersionRequestHandler(w http.ResponseWriter, r *http.Request) { // connected node version REST handler endpoint func NodeVersionRequestHandler(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - version, err := cliCtx.Query("/app/version", nil) + version, _, err := cliCtx.Query("/app/version", nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/client/utils/utils.go b/client/utils/utils.go index 12e6a5bc4622..da9170f9dbb8 100644 --- a/client/utils/utils.go +++ b/client/utils/utils.go @@ -127,12 +127,12 @@ func EnrichWithGas(txBldr authtypes.TxBuilder, cliCtx context.CLIContext, msgs [ // CalculateGas simulates the execution of a transaction and returns // both the estimate obtained by the query and the adjusted amount. -func CalculateGas(queryFunc func(string, common.HexBytes) ([]byte, error), +func CalculateGas(queryFunc func(string, common.HexBytes) ([]byte, int64, error), cdc *codec.Codec, txBytes []byte, adjustment float64) (estimate, adjusted uint64, err error) { // run a simulation (via /app/simulate query) to // estimate gas and update TxBuilder accordingly - rawRes, err := queryFunc("/app/simulate", txBytes) + rawRes, _, err := queryFunc("/app/simulate", txBytes) if err != nil { return } diff --git a/client/utils/utils_test.go b/client/utils/utils_test.go index 94df3e797d0d..ef666c9edb5c 100644 --- a/client/utils/utils_test.go +++ b/client/utils/utils_test.go @@ -36,12 +36,12 @@ func TestParseQueryResponse(t *testing.T) { func TestCalculateGas(t *testing.T) { cdc := makeCodec() - makeQueryFunc := func(gasUsed uint64, wantErr bool) func(string, common.HexBytes) ([]byte, error) { - return func(string, common.HexBytes) ([]byte, error) { + makeQueryFunc := func(gasUsed uint64, wantErr bool) func(string, common.HexBytes) ([]byte, int64, error) { + return func(string, common.HexBytes) ([]byte, int64, error) { if wantErr { - return nil, errors.New("") + return nil, 0, errors.New("") } - return cdc.MustMarshalBinaryLengthPrefixed(sdk.Result{GasUsed: gasUsed}), nil + return cdc.MustMarshalBinaryLengthPrefixed(sdk.Result{GasUsed: gasUsed}), 0, nil } } type args struct { diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 4045dfb6fa50..81bffe65ac04 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -12,9 +12,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// AccountWithQueryHeight wraps the embedded Account +// AccountWithHeight wraps the embedded Account // with the height it was queried at -type AccountWithQueryHeight struct { +type AccountWithHeight struct { types.Account Height int64 `json:"height"` } @@ -52,7 +52,7 @@ func QueryAccountRequestHandlerFn( return } - res, height, err := cliCtx.QueryStoreWithHeight(types.AddressStoreKey(addr), storeName) + res, height, err := cliCtx.QueryStore(types.AddressStoreKey(addr), storeName) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -71,8 +71,7 @@ func QueryAccountRequestHandlerFn( return } - accountWithHeight := AccountWithQueryHeight{account, height} - rest.PostProcessResponse(w, cliCtx, accountWithHeight) + rest.PostProcessResponse(w, cliCtx, AccountWithHeight{account, height}) } } @@ -97,7 +96,7 @@ func QueryBalancesRequestHandlerFn( return } - res, err := cliCtx.QueryStore(types.AddressStoreKey(addr), storeName) + res, _, err := cliCtx.QueryStore(types.AddressStoreKey(addr), storeName) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/distribution/client/cli/query.go b/x/distribution/client/cli/query.go index 815feb828517..f227e1159c1e 100644 --- a/x/distribution/client/cli/query.go +++ b/x/distribution/client/cli/query.go @@ -86,7 +86,7 @@ $ %s query distr validator-outstanding-rewards cosmosvaloper1lwjmdnks33xwnmfayc6 return err } - resp, err := cliCtx.QueryWithData( + resp, _, err := cliCtx.QueryWithData( fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryValidatorOutstandingRewards), bz, ) @@ -178,7 +178,7 @@ $ %s query distr slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 0 return err } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/validator_slashes", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/validator_slashes", queryRoute), bz) if err != nil { return err } @@ -252,7 +252,7 @@ $ %s query distr community-pool RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/community_pool", queryRoute), nil) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/community_pool", queryRoute), nil) if err != nil { return err } diff --git a/x/distribution/client/common/common.go b/x/distribution/client/common/common.go index eb4e3b059869..077933f0375c 100644 --- a/x/distribution/client/common/common.go +++ b/x/distribution/client/common/common.go @@ -12,25 +12,25 @@ import ( func QueryParams(cliCtx context.CLIContext, queryRoute string) (PrettyParams, error) { route := fmt.Sprintf("custom/%s/params/%s", queryRoute, types.ParamCommunityTax) - retCommunityTax, err := cliCtx.QueryWithData(route, []byte{}) + retCommunityTax, _, err := cliCtx.QueryWithData(route, []byte{}) if err != nil { return PrettyParams{}, err } route = fmt.Sprintf("custom/%s/params/%s", queryRoute, types.ParamBaseProposerReward) - retBaseProposerReward, err := cliCtx.QueryWithData(route, []byte{}) + retBaseProposerReward, _, err := cliCtx.QueryWithData(route, []byte{}) if err != nil { return PrettyParams{}, err } route = fmt.Sprintf("custom/%s/params/%s", queryRoute, types.ParamBonusProposerReward) - retBonusProposerReward, err := cliCtx.QueryWithData(route, []byte{}) + retBonusProposerReward, _, err := cliCtx.QueryWithData(route, []byte{}) if err != nil { return PrettyParams{}, err } route = fmt.Sprintf("custom/%s/params/%s", queryRoute, types.ParamWithdrawAddrEnabled) - retWithdrawAddrEnabled, err := cliCtx.QueryWithData(route, []byte{}) + retWithdrawAddrEnabled, _, err := cliCtx.QueryWithData(route, []byte{}) if err != nil { return PrettyParams{}, err } @@ -47,10 +47,11 @@ func QueryDelegatorTotalRewards(cliCtx context.CLIContext, queryRoute, delAddr s return nil, err } - return cliCtx.QueryWithData( + res, _, err := cliCtx.QueryWithData( fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegatorTotalRewards), cliCtx.Codec.MustMarshalJSON(types.NewQueryDelegatorParams(delegatorAddr)), ) + return res, err } // QueryDelegationRewards queries a delegation rewards. @@ -65,27 +66,30 @@ func QueryDelegationRewards(cliCtx context.CLIContext, queryRoute, delAddr, valA return nil, err } - return cliCtx.QueryWithData( + res, _, err := cliCtx.QueryWithData( fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegationRewards), cliCtx.Codec.MustMarshalJSON(types.NewQueryDelegationRewardsParams(delegatorAddr, validatorAddr)), ) + return res, err } // QueryDelegatorValidators returns delegator's list of validators // it submitted delegations to. func QueryDelegatorValidators(cliCtx context.CLIContext, queryRoute string, delegatorAddr sdk.AccAddress) ([]byte, error) { - return cliCtx.QueryWithData( + res, _, err := cliCtx.QueryWithData( fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegatorValidators), cliCtx.Codec.MustMarshalJSON(types.NewQueryDelegatorParams(delegatorAddr)), ) + return res, err } // QueryValidatorCommission returns a validator's commission. func QueryValidatorCommission(cliCtx context.CLIContext, queryRoute string, validatorAddr sdk.ValAddress) ([]byte, error) { - return cliCtx.QueryWithData( + res, _, err := cliCtx.QueryWithData( fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryValidatorCommission), cliCtx.Codec.MustMarshalJSON(types.NewQueryValidatorCommissionParams(validatorAddr)), ) + return res, err } // WithdrawAllDelegatorRewards builds a multi-message slice to be used diff --git a/x/distribution/client/rest/query.go b/x/distribution/client/rest/query.go index 86ae87f87f05..c669135de2ed 100644 --- a/x/distribution/client/rest/query.go +++ b/x/distribution/client/rest/query.go @@ -115,7 +115,7 @@ func delegatorWithdrawalAddrHandlerFn(cliCtx context.CLIContext, queryRoute stri } bz := cliCtx.Codec.MustMarshalJSON(types.NewQueryDelegatorWithdrawAddrParams(delegatorAddr)) - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/withdraw_addr", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/withdraw_addr", queryRoute), bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -232,7 +232,7 @@ func communityPoolHandler(cliCtx context.CLIContext, queryRoute string) http.Han return } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/community_pool", queryRoute), nil) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/community_pool", queryRoute), nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -262,7 +262,7 @@ func outstandingRewardsHandlerFn(cliCtx context.CLIContext, queryRoute string) h } bin := cliCtx.Codec.MustMarshalJSON(types.NewQueryValidatorOutstandingRewardsParams(validatorAddr)) - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/validator_outstanding_rewards", queryRoute), bin) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/validator_outstanding_rewards", queryRoute), bin) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index a3d09f509f8c..e6b3b74897aa 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -141,7 +141,7 @@ $ %s query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected) cliCtx := context.NewCLIContext().WithCodec(cdc) - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposals", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposals", queryRoute), bz) if err != nil { return err } @@ -210,7 +210,7 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk return err } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/vote", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/vote", queryRoute), bz) if err != nil { return err } @@ -278,7 +278,7 @@ $ %s query gov votes 1 if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) { res, err = gcutils.QueryVotesByTxQuery(cliCtx, params) } else { - res, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/votes", queryRoute), bz) + res, _, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/votes", queryRoute), bz) } if err != nil { @@ -334,7 +334,7 @@ $ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk return err } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/deposit", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/deposit", queryRoute), bz) if err != nil { return err } @@ -399,7 +399,7 @@ $ %s query gov deposits 1 if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) { res, err = gcutils.QueryDepositsByTxQuery(cliCtx, params) } else { - res, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/deposits", queryRoute), bz) + res, _, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/deposits", queryRoute), bz) } if err != nil { @@ -452,7 +452,7 @@ $ %s query gov tally 1 } // Query store - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/tally", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/tally", queryRoute), bz) if err != nil { return err } @@ -481,15 +481,15 @@ $ %s query gov params Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - tp, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/tallying", queryRoute), nil) + tp, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/tallying", queryRoute), nil) if err != nil { return err } - dp, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/deposit", queryRoute), nil) + dp, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/deposit", queryRoute), nil) if err != nil { return err } - vp, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/voting", queryRoute), nil) + vp, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/voting", queryRoute), nil) if err != nil { return err } @@ -527,7 +527,7 @@ $ %s query gov param deposit cliCtx := context.NewCLIContext().WithCodec(cdc) // Query store - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/%s", queryRoute, args[0]), nil) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/params/%s", queryRoute, args[0]), nil) if err != nil { return err } diff --git a/x/gov/client/rest/rest.go b/x/gov/client/rest/rest.go index 7c897313132c..297b21de9fd3 100644 --- a/x/gov/client/rest/rest.go +++ b/x/gov/client/rest/rest.go @@ -201,7 +201,7 @@ func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/gov/%s/%s", types.QueryParams, paramType), nil) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/gov/%s/%s", types.QueryParams, paramType), nil) if err != nil { rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) return @@ -240,7 +240,7 @@ func queryProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/proposal", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/proposal", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -273,7 +273,7 @@ func queryDepositsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/proposal", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/proposal", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -291,7 +291,7 @@ func queryDepositsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) { res, err = gcutils.QueryDepositsByTxQuery(cliCtx, params) } else { - res, err = cliCtx.QueryWithData("custom/gov/deposits", bz) + res, _, err = cliCtx.QueryWithData("custom/gov/deposits", bz) } if err != nil { @@ -370,7 +370,7 @@ func queryDepositHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/deposit", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/deposit", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -392,7 +392,7 @@ func queryDepositHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err = cliCtx.QueryWithData("custom/gov/proposal", bz) + res, _, err = cliCtx.QueryWithData("custom/gov/proposal", bz) if err != nil || len(res) == 0 { err := fmt.Errorf("proposalID %d does not exist", proposalID) rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) @@ -452,7 +452,7 @@ func queryVoteHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/vote", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/vote", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -474,7 +474,7 @@ func queryVoteHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err = cliCtx.QueryWithData("custom/gov/proposal", bz) + res, _, err = cliCtx.QueryWithData("custom/gov/proposal", bz) if err != nil || len(res) == 0 { err := fmt.Errorf("proposalID %d does not exist", proposalID) rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) @@ -522,7 +522,7 @@ func queryVotesOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/proposal", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/proposal", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -540,7 +540,7 @@ func queryVotesOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) { res, err = gcutils.QueryVotesByTxQuery(cliCtx, params) } else { - res, err = cliCtx.QueryWithData("custom/gov/votes", bz) + res, _, err = cliCtx.QueryWithData("custom/gov/votes", bz) } if err != nil { @@ -607,7 +607,7 @@ func queryProposalsWithParameterFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/proposals", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/proposals", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -647,7 +647,7 @@ func queryTallyOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/gov/tally", bz) + res, _, err := cliCtx.QueryWithData("custom/gov/tally", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 9d94c20cc2c4..8675b97055d3 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -229,7 +229,7 @@ func QueryProposalByID(proposalID uint64, cliCtx context.CLIContext, queryRoute return nil, err } - res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposal", queryRoute), bz) + res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposal", queryRoute), bz) if err != nil { return nil, err } diff --git a/x/ibc/client/cli/relay.go b/x/ibc/client/cli/relay.go index 577dcc0d18c3..071a91109cd8 100644 --- a/x/ibc/client/cli/relay.go +++ b/x/ibc/client/cli/relay.go @@ -157,7 +157,8 @@ OUTER: } func query(node string, key []byte, storeName string) (res []byte, err error) { - return context.NewCLIContext().WithNodeURI(node).QueryStore(key, storeName) + res, _, err = context.NewCLIContext().WithNodeURI(node).QueryStore(key, storeName) + return res, err } // nolint: unparam diff --git a/x/mint/client/cli/query.go b/x/mint/client/cli/query.go index ce57342a9b1b..b50e3709645a 100644 --- a/x/mint/client/cli/query.go +++ b/x/mint/client/cli/query.go @@ -45,7 +45,7 @@ func GetCmdQueryParams(cdc *codec.Codec) *cobra.Command { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParameters) - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { return err } @@ -71,7 +71,7 @@ func GetCmdQueryInflation(cdc *codec.Codec) *cobra.Command { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryInflation) - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { return err } @@ -97,7 +97,7 @@ func GetCmdQueryAnnualProvisions(cdc *codec.Codec) *cobra.Command { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAnnualProvisions) - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { return err } diff --git a/x/mint/client/rest/query.go b/x/mint/client/rest/query.go index 0ee44b37e45a..f8083d06a05f 100644 --- a/x/mint/client/rest/query.go +++ b/x/mint/client/rest/query.go @@ -37,7 +37,7 @@ func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -56,7 +56,7 @@ func queryInflationHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -75,7 +75,7 @@ func queryAnnualProvisionsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc return } - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/slashing/client/cli/query.go b/x/slashing/client/cli/query.go index de149a79dc56..5ca6004af6a0 100644 --- a/x/slashing/client/cli/query.go +++ b/x/slashing/client/cli/query.go @@ -58,7 +58,7 @@ $ query slashing signing-info cosmosvalconspub1zcjduepqfhvwcmt7p06fvdge consAddr := sdk.ConsAddress(pk.Address()) key := types.GetValidatorSigningInfoKey(consAddr) - res, err := cliCtx.QueryStore(key, storeName) + res, _, err := cliCtx.QueryStore(key, storeName) if err != nil { return err } @@ -88,7 +88,7 @@ $ query slashing params cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/parameters", types.QuerierRoute) - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { return err } diff --git a/x/slashing/client/rest/query.go b/x/slashing/client/rest/query.go index cb678934166a..e5cdd7966bfb 100644 --- a/x/slashing/client/rest/query.go +++ b/x/slashing/client/rest/query.go @@ -53,7 +53,7 @@ func signingInfoHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { } route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QuerySigningInfo) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -85,7 +85,7 @@ func signingInfoHandlerListFn(cliCtx context.CLIContext) http.HandlerFunc { } route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QuerySigningInfos) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -104,7 +104,7 @@ func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { route := fmt.Sprintf("custom/%s/parameters", types.QuerierRoute) - res, err := cliCtx.QueryWithData(route, nil) + res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/staking/client/cli/query.go b/x/staking/client/cli/query.go index f9ea5314ec86..8f4258b75f1c 100644 --- a/x/staking/client/cli/query.go +++ b/x/staking/client/cli/query.go @@ -66,7 +66,7 @@ $ %s query staking validator cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhff return err } - res, err := cliCtx.QueryStore(types.GetValidatorKey(addr), storeName) + res, _, err := cliCtx.QueryStore(types.GetValidatorKey(addr), storeName) if err != nil { return err } @@ -98,7 +98,7 @@ $ %s query staking validators RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - resKVs, err := cliCtx.QuerySubspace(types.ValidatorsKey, storeName) + resKVs, _, err := cliCtx.QuerySubspace(types.ValidatorsKey, storeName) if err != nil { return err } @@ -142,7 +142,7 @@ $ %s query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj6 } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryValidatorUnbondingDelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -184,7 +184,7 @@ $ %s query staking redelegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fx } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryRedelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -233,7 +233,7 @@ $ %s query staking delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosm } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegation) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -278,7 +278,7 @@ $ %s query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegatorDelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -323,7 +323,7 @@ $ %s query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ld } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryValidatorDelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -373,7 +373,7 @@ $ %s query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld7 } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryUnbondingDelegation) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -413,7 +413,7 @@ $ %s query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld7 } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryDelegatorUnbondingDelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -468,7 +468,7 @@ $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p co } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryRedelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -513,7 +513,7 @@ $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p } route := fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryRedelegations) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { return err } @@ -546,7 +546,7 @@ $ %s query staking pool RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - res, err := cliCtx.QueryStore(types.PoolKey, storeName) + res, _, err := cliCtx.QueryStore(types.PoolKey, storeName) if err != nil { return err } @@ -575,7 +575,7 @@ $ %s query staking params cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", storeName, types.QueryParameters) - bz, err := cliCtx.QueryWithData(route, nil) + bz, _, err := cliCtx.QueryWithData(route, nil) if err != nil { return err } diff --git a/x/staking/client/rest/query.go b/x/staking/client/rest/query.go index 2d1e66da4a1b..3a10eb42d312 100644 --- a/x/staking/client/rest/query.go +++ b/x/staking/client/rest/query.go @@ -227,7 +227,7 @@ func redelegationsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/staking/redelegations", bz) + res, _, err := cliCtx.QueryWithData("custom/staking/redelegations", bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -279,7 +279,7 @@ func validatorsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { } route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryValidators) - res, err := cliCtx.QueryWithData(route, bz) + res, _, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -311,7 +311,7 @@ func poolHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/staking/pool", nil) + res, _, err := cliCtx.QueryWithData("custom/staking/pool", nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -329,7 +329,7 @@ func paramsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData("custom/staking/parameters", nil) + res, _, err := cliCtx.QueryWithData("custom/staking/parameters", nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/staking/client/rest/utils.go b/x/staking/client/rest/utils.go index 488759c4681e..6730346c9e97 100644 --- a/x/staking/client/rest/utils.go +++ b/x/staking/client/rest/utils.go @@ -62,7 +62,7 @@ func queryBonds(cliCtx context.CLIContext, endpoint string) http.HandlerFunc { return } - res, err := cliCtx.QueryWithData(endpoint, bz) + res, _, err := cliCtx.QueryWithData(endpoint, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -95,7 +95,7 @@ func queryDelegator(cliCtx context.CLIContext, endpoint string) http.HandlerFunc return } - res, err := cliCtx.QueryWithData(endpoint, bz) + res, _, err := cliCtx.QueryWithData(endpoint, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -128,7 +128,7 @@ func queryValidator(cliCtx context.CLIContext, endpoint string) http.HandlerFunc return } - res, err := cliCtx.QueryWithData(endpoint, bz) + res, _, err := cliCtx.QueryWithData(endpoint, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return From c62439c2213d704c3e7551675aeca40861f52b58 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Wed, 12 Jun 2019 16:38:57 -0700 Subject: [PATCH 4/4] add pending log --- .pending/improvements/sdk/4536-cli-context-que | 1 + 1 file changed, 1 insertion(+) create mode 100644 .pending/improvements/sdk/4536-cli-context-que diff --git a/.pending/improvements/sdk/4536-cli-context-que b/.pending/improvements/sdk/4536-cli-context-que new file mode 100644 index 000000000000..f69dc70d3c61 --- /dev/null +++ b/.pending/improvements/sdk/4536-cli-context-que @@ -0,0 +1 @@ +#4536 cli context queries return query height and accounts are returned with query height \ No newline at end of file