fix endPath missing bug for query
This commit is contained in:
parent
99e5c5a18f
commit
52cd8b8c1f
|
@ -59,7 +59,7 @@ func (ctx CoreContext) QuerySubspace(cdc *wire.Codec, subspace []byte, storeName
|
|||
|
||||
// Query from Tendermint with the provided storename and path
|
||||
func (ctx CoreContext) query(key cmn.HexBytes, storeName, endPath string) (res []byte, err error) {
|
||||
path := fmt.Sprintf("/store/%s/key", storeName)
|
||||
path := fmt.Sprintf("/store/%s/%s", storeName, endPath)
|
||||
node, err := ctx.GetNode()
|
||||
if err != nil {
|
||||
return res, err
|
||||
|
|
|
@ -454,7 +454,7 @@ func startTMAndLCD() (*nm.Node, net.Listener, error) {
|
|||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
lcd, err := startLCD(logger, listenAddr)
|
||||
lcd, err := startLCD(logger, listenAddr, cdc)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ func startTM(cfg *tmcfg.Config, logger log.Logger, genDoc *tmtypes.GenesisDoc, p
|
|||
}
|
||||
|
||||
// start the LCD. note this blocks!
|
||||
func startLCD(logger log.Logger, listenAddr string) (net.Listener, error) {
|
||||
func startLCD(logger log.Logger, listenAddr string, cdc *wire.Codec) (net.Listener, error) {
|
||||
handler := createHandler(cdc)
|
||||
return tmrpc.StartHTTPServer(listenAddr, handler, logger)
|
||||
}
|
||||
|
|
|
@ -62,15 +62,15 @@ func GetCmdQueryValidators(storeName string, cdc *wire.Codec) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
// parse out the candidates
|
||||
var candidates []stake.Validator
|
||||
// parse out the validators
|
||||
var validators []stake.Validator
|
||||
for _, KV := range resKVs {
|
||||
var validator stake.Validator
|
||||
cdc.MustUnmarshalBinary(KV.Value, &validator)
|
||||
candidates = append(candidates, validator)
|
||||
validators = append(validators, validator)
|
||||
}
|
||||
|
||||
output, err := wire.MarshalJSONIndent(cdc, candidates)
|
||||
output, err := wire.MarshalJSONIndent(cdc, validators)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ func GetCmdQueryDelegation(storeName string, cdc *wire.Codec) *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// get the command to query all the candidates bonded to a delegation
|
||||
// get the command to query all the validators bonded to a delegation
|
||||
func GetCmdQueryDelegations(storeName string, cdc *wire.Codec) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "delegations [delegator-addr]",
|
||||
|
@ -146,7 +146,7 @@ func GetCmdQueryDelegations(storeName string, cdc *wire.Codec) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
// parse out the candidates
|
||||
// parse out the validators
|
||||
var delegations []stake.Delegation
|
||||
for _, KV := range resKVs {
|
||||
var delegation stake.Delegation
|
||||
|
|
|
@ -27,6 +27,7 @@ func registerQueryRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec
|
|||
// http request handler to query delegator bonding status
|
||||
func bondingStatusHandlerFn(storeName string, cdc *wire.Codec, ctx context.CoreContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// read parameters
|
||||
vars := mux.Vars(r)
|
||||
delegator := vars["delegator"]
|
||||
|
@ -98,7 +99,8 @@ func validatorsHandlerFn(storeName string, cdc *wire.Codec, ctx context.CoreCont
|
|||
return
|
||||
}
|
||||
|
||||
validators := make(stake.Validators, 0, len(res))
|
||||
// parse out the validators
|
||||
var validators []stake.Validator
|
||||
for _, kv := range res {
|
||||
var validator stake.Validator
|
||||
err = cdc.UnmarshalBinary(kv.Value, &validator)
|
||||
|
|
|
@ -24,8 +24,6 @@ func registerTxRoutes(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec, k
|
|||
}
|
||||
|
||||
type editDelegationsBody struct {
|
||||
// fees is not used currently
|
||||
// Fees sdk.Coin `json="fees"`
|
||||
LocalAccountName string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
ChainID string `json:"chain_id"`
|
||||
|
|
Loading…
Reference in New Issue