One step for module eyes commands compiling

This commit is contained in:
Ethan Frey 2017-10-24 22:15:04 +02:00
parent 4bff480440
commit 5efbbc3237
2 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/commands"
"github.com/cosmos/cosmos-sdk/client/commands/query"
"github.com/cosmos/cosmos-sdk/modules/eyes"
"github.com/cosmos/cosmos-sdk/stack"
"github.com/cosmos/cosmos-sdk/util"
)
// EyesQueryCmd - command to query raw data
@ -33,7 +33,7 @@ func eyesQueryCmd(cmd *cobra.Command, args []string) error {
return err
}
key = stack.PrefixedKey(eyes.Name, key)
key = util.PrefixedKey(eyes.Name, key)
prove := !viper.GetBool(commands.FlagTrustNode)
height, err := query.GetParsed(key, &res, query.GetHeight(), prove)
if err != nil {

10
util/prefix.go Normal file
View File

@ -0,0 +1,10 @@
package util
// PrefixedKey returns the absolute path to a given key in a particular
// app's state-space
//
// This is useful for to set up queries for this particular app data
func PrefixedKey(app string, key []byte) []byte {
prefix := append([]byte(app), byte(0))
return append(prefix, key...)
}