Renamed client/commands/proofs to client/commands/query
This commit is contained in:
parent
6dae258767
commit
d6d6b75736
@ -1,4 +1,4 @@
|
||||
package proofs
|
||||
package query
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -1,4 +1,4 @@
|
||||
package proofs
|
||||
package query
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
@ -1,4 +1,4 @@
|
||||
package proofs
|
||||
package query
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
@ -1,4 +1,4 @@
|
||||
package proofs
|
||||
package query
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
"github.com/tendermint/basecoin/client/commands/auto"
|
||||
"github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/proxy"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
rpccmd "github.com/tendermint/basecoin/client/commands/rpc"
|
||||
"github.com/tendermint/basecoin/client/commands/seeds"
|
||||
txcmd "github.com/tendermint/basecoin/client/commands/txs"
|
||||
@ -40,10 +40,10 @@ func main() {
|
||||
commands.AddBasicFlags(BaseCli)
|
||||
|
||||
// Prepare queries
|
||||
proofs.RootCmd.AddCommand(
|
||||
query.RootCmd.AddCommand(
|
||||
// These are default parsers, but optional in your app (you can remove key)
|
||||
proofs.TxQueryCmd,
|
||||
proofs.KeyQueryCmd,
|
||||
query.TxQueryCmd,
|
||||
query.KeyQueryCmd,
|
||||
coincmd.AccountQueryCmd,
|
||||
noncecmd.NonceQueryCmd,
|
||||
rolecmd.RoleQueryCmd,
|
||||
@ -80,7 +80,7 @@ func main() {
|
||||
keycmd.RootCmd,
|
||||
seeds.RootCmd,
|
||||
rpccmd.RootCmd,
|
||||
proofs.RootCmd,
|
||||
query.RootCmd,
|
||||
txcmd.RootCmd,
|
||||
proxy.RootCmd,
|
||||
commands.VersionCmd,
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
|
||||
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
@ -23,10 +23,10 @@ func counterQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
key := stack.PrefixedKey(counter.NameCounter, counter.StateKey())
|
||||
h, err := proofcmd.GetParsed(key, &cp, prove)
|
||||
h, err := query.GetParsed(key, &cp, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(cp, h)
|
||||
return query.OutputProof(cp, h)
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"github.com/tendermint/tmlibs/cli"
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
"github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/proxy"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/client/commands/seeds"
|
||||
txcmd "github.com/tendermint/basecoin/client/commands/txs"
|
||||
bcount "github.com/tendermint/basecoin/docs/guide/counter/cmd/countercli/commands"
|
||||
@ -37,10 +37,10 @@ func main() {
|
||||
commands.AddBasicFlags(BaseCli)
|
||||
|
||||
// Prepare queries
|
||||
proofs.RootCmd.AddCommand(
|
||||
query.RootCmd.AddCommand(
|
||||
// These are default parsers, optional in your app
|
||||
proofs.TxQueryCmd,
|
||||
proofs.KeyQueryCmd,
|
||||
query.TxQueryCmd,
|
||||
query.KeyQueryCmd,
|
||||
coincmd.AccountQueryCmd,
|
||||
noncecmd.NonceQueryCmd,
|
||||
|
||||
@ -72,7 +72,7 @@ func main() {
|
||||
commands.ResetCmd,
|
||||
keycmd.RootCmd,
|
||||
seeds.RootCmd,
|
||||
proofs.RootCmd,
|
||||
query.RootCmd,
|
||||
txcmd.RootCmd,
|
||||
proxy.RootCmd,
|
||||
)
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
lc "github.com/tendermint/light-client"
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/modules/coin"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
)
|
||||
@ -34,12 +34,12 @@ func accountQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
acc := coin.Account{}
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
height, err := proofcmd.GetParsed(key, &acc, prove)
|
||||
height, err := query.GetParsed(key, &acc, prove)
|
||||
if lc.IsNoDataErr(err) {
|
||||
return errors.Errorf("Account bytes are empty for address %s ", addr)
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(acc, height)
|
||||
return query.OutputProof(acc, height)
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/tendermint/basecoin"
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
"github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/modules/auth"
|
||||
"github.com/tendermint/basecoin/modules/base"
|
||||
"github.com/tendermint/basecoin/modules/coin"
|
||||
@ -38,8 +38,8 @@ type SendInput struct {
|
||||
// doQueryAccount is the HTTP handlerfunc to query an account
|
||||
// It expects a query string with
|
||||
func doQueryAccount(w http.ResponseWriter, r *http.Request) {
|
||||
query := mux.Vars(r)
|
||||
signature := query["signature"]
|
||||
args := mux.Vars(r)
|
||||
signature := args["signature"]
|
||||
actor, err := commands.ParseActor(signature)
|
||||
if err != nil {
|
||||
common.WriteError(w, err)
|
||||
@ -49,7 +49,7 @@ func doQueryAccount(w http.ResponseWriter, r *http.Request) {
|
||||
key := stack.PrefixedKey(coin.NameCoin, actor.Bytes())
|
||||
account := new(coin.Account)
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
height, err := proofs.GetParsed(key, account, prove)
|
||||
height, err := query.GetParsed(key, account, prove)
|
||||
if lightclient.IsNoDataErr(err) {
|
||||
err := fmt.Errorf("account bytes are empty for address: %q", signature)
|
||||
common.WriteError(w, err)
|
||||
@ -59,7 +59,7 @@ func doQueryAccount(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := proofs.FoutputProof(w, account, height); err != nil {
|
||||
if err := query.FoutputProof(w, account, height); err != nil {
|
||||
common.WriteError(w, err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/modules/ibc"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
@ -86,18 +86,18 @@ func ibcQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
var res ibc.HandlerInfo
|
||||
key := stack.PrefixedKey(ibc.NameIBC, ibc.HandlerKey())
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
h, err := proofcmd.GetParsed(key, &res, prove)
|
||||
h, err := query.GetParsed(key, &res, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return proofcmd.OutputProof(res, h)
|
||||
return query.OutputProof(res, h)
|
||||
}
|
||||
|
||||
func chainsQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
list := [][]byte{}
|
||||
key := stack.PrefixedKey(ibc.NameIBC, ibc.ChainsKey())
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
h, err := proofcmd.GetParsed(key, &list, prove)
|
||||
h, err := query.GetParsed(key, &list, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -108,7 +108,7 @@ func chainsQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
res[i] = string(list[i])
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(res, h)
|
||||
return query.OutputProof(res, h)
|
||||
}
|
||||
|
||||
func chainQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
@ -120,12 +120,12 @@ func chainQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
var res ibc.ChainInfo
|
||||
key := stack.PrefixedKey(ibc.NameIBC, ibc.ChainKey(arg))
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
h, err := proofcmd.GetParsed(key, &res, prove)
|
||||
h, err := query.GetParsed(key, &res, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(res, h)
|
||||
return query.OutputProof(res, h)
|
||||
}
|
||||
|
||||
func assertOne(from, to string) error {
|
||||
@ -157,12 +157,12 @@ func packetsQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
var res uint64
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
h, err := proofcmd.GetParsed(key, &res, prove)
|
||||
h, err := query.GetParsed(key, &res, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(res, h)
|
||||
return query.OutputProof(res, h)
|
||||
}
|
||||
|
||||
func packetQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
@ -189,15 +189,15 @@ func packetQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
// Input queue just display the results
|
||||
var packet ibc.Packet
|
||||
if from != "" {
|
||||
h, err := proofcmd.GetParsed(key, &packet, prove)
|
||||
h, err := query.GetParsed(key, &packet, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return proofcmd.OutputProof(packet, h)
|
||||
return query.OutputProof(packet, h)
|
||||
}
|
||||
|
||||
// output queue, create a post packet
|
||||
bs, height, proof, err := proofcmd.GetWithProof(key)
|
||||
bs, height, proof, err := query.GetWithProof(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/tendermint/basecoin"
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/modules/nonce"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
)
|
||||
@ -39,13 +39,13 @@ func nonceQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(seq, height)
|
||||
return query.OutputProof(seq, height)
|
||||
}
|
||||
|
||||
func doNonceQuery(signers []basecoin.Actor) (sequence uint32, height uint64, err error) {
|
||||
key := stack.PrefixedKey(nonce.NameNonce, nonce.GetSeqKey(signers))
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
height, err = proofcmd.GetParsed(key, &sequence, prove)
|
||||
height, err = query.GetParsed(key, &sequence, prove)
|
||||
if lc.IsNoDataErr(err) {
|
||||
// no data, return sequence 0
|
||||
return 0, 0, nil
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/tendermint/basecoin/client/commands"
|
||||
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
|
||||
"github.com/tendermint/basecoin/client/commands/query"
|
||||
"github.com/tendermint/basecoin/modules/roles"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
)
|
||||
@ -30,10 +30,10 @@ func roleQueryCmd(cmd *cobra.Command, args []string) error {
|
||||
var res roles.Role
|
||||
key := stack.PrefixedKey(roles.NameRole, role)
|
||||
prove := !viper.GetBool(commands.FlagTrustNode)
|
||||
height, err := proofcmd.GetParsed(key, &res, prove)
|
||||
height, err := query.GetParsed(key, &res, prove)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return proofcmd.OutputProof(res, height)
|
||||
return query.OutputProof(res, height)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user