Merge branch 'feature/adrian-extendABCIcli' into develop

This commit is contained in:
Ethan Buchman
2017-05-15 12:30:02 -04:00

View File

@ -126,6 +126,22 @@ func main() {
Action: func(c *cli.Context) error {
return cmdQuery(c)
},
Flags: []cli.Flag{
cli.StringFlag{
Name: "path",
Value: "/store",
Usage: "Path to prefix the query with",
},
cli.IntFlag{
Name: "height",
Value: 0,
Usage: "Height to query the blockchain at",
},
cli.BoolFlag{
Name: "prove",
Usage: "Whether or not to return a merkle proof of the query result",
},
},
},
}
app.Before = before
@ -307,21 +323,27 @@ func cmdCommit(c *cli.Context) error {
}
// Query application state
// TODO: Make request and response support all fields.
func cmdQuery(c *cli.Context) error {
args := c.Args()
if len(args) != 1 {
return errors.New("Command query takes 1 argument")
return errors.New("Command query takes 1 argument, the query bytes")
}
queryBytes, err := stringOrHexToBytes(c.Args()[0])
queryBytes, err := stringOrHexToBytes(args[0])
if err != nil {
return err
}
path := c.String("path")
height := c.Int("height")
prove := c.Bool("prove")
resQuery, err := client.QuerySync(types.RequestQuery{
Data: queryBytes,
Path: "/store", // TOOD expose
Height: 0, // TODO expose
//Prove: true, // TODO expose
Path: path,
Height: uint64(height),
Prove: prove,
})
if err != nil {
return err