diff --git a/cmd/basecli/commands/cmds.go b/cmd/basecli/commands/cmds.go index 268f4d61d0..50a39024b4 100644 --- a/cmd/basecli/commands/cmds.go +++ b/cmd/basecli/commands/cmds.go @@ -53,7 +53,7 @@ func doSendTx(cmd *cobra.Command, args []string) error { } send := &SendTx{ - chainID: viper.GetString(commands.ChainFlag), + chainID: commands.GetChainID(), Tx: tx, } send.AddSigner(txcmd.GetSigner()) @@ -138,7 +138,7 @@ func ReadAppTxFlags(tx *btypes.AppTx) error { func WrapAppTx(tx *btypes.AppTx) *AppTx { return &AppTx{ - chainID: viper.GetString(commands.ChainFlag), + chainID: commands.GetChainID(), Tx: tx, } } diff --git a/cmd/basecli/commands/query.go b/cmd/basecli/commands/query.go index aea350d063..82ec564913 100644 --- a/cmd/basecli/commands/query.go +++ b/cmd/basecli/commands/query.go @@ -4,7 +4,6 @@ import ( "github.com/spf13/cobra" wire "github.com/tendermint/go-wire" - "github.com/tendermint/light-client/commands" proofcmd "github.com/tendermint/light-client/commands/proofs" "github.com/tendermint/light-client/proofs" @@ -18,23 +17,14 @@ var AccountQueryCmd = &cobra.Command{ } func doAccountQuery(cmd *cobra.Command, args []string) error { - height := proofcmd.GetHeight() addr, err := proofcmd.ParseHexKey(args, "address") if err != nil { return err } key := btypes.AccountKey(addr) - // get the proof -> this will be used by all prover commands - node := commands.GetNode() - prover := proofs.NewAppProver(node) - proof, err := proofcmd.GetProof(node, prover, key, height) - if err != nil { - return err - } - acc := new(btypes.Account) - err = wire.ReadBinaryBytes(proof.Data(), &acc) + proof, err := proofcmd.GetAndParseAppProof(key, &acc) if err != nil { return err } @@ -42,7 +32,7 @@ func doAccountQuery(cmd *cobra.Command, args []string) error { return proofcmd.OutputProof(acc, proof.BlockHeight()) } -/*** this decodes the basecoin tx ***/ +/*** this decodes all basecoin tx ***/ type BaseTxPresenter struct { proofs.RawPresenter // this handles MakeKey as hex bytes diff --git a/cmd/basecli/counter/query.go b/cmd/basecli/counter/query.go index 9396c956a7..a1c6aeb9b5 100644 --- a/cmd/basecli/counter/query.go +++ b/cmd/basecli/counter/query.go @@ -3,10 +3,7 @@ package counter import ( "github.com/spf13/cobra" - wire "github.com/tendermint/go-wire" - "github.com/tendermint/light-client/commands" proofcmd "github.com/tendermint/light-client/commands/proofs" - "github.com/tendermint/light-client/proofs" "github.com/tendermint/basecoin/plugins/counter" ) @@ -18,18 +15,10 @@ var CounterQueryCmd = &cobra.Command{ } func doCounterQuery(cmd *cobra.Command, args []string) error { - height := proofcmd.GetHeight() key := counter.New().StateKey() - node := commands.GetNode() - prover := proofs.NewAppProver(node) - proof, err := proofcmd.GetProof(node, prover, key, height) - if err != nil { - return err - } - var cp counter.CounterPluginState - err = wire.ReadBinaryBytes(proof.Data(), &cp) + proof, err := proofcmd.GetAndParseAppProof(key, &cp) if err != nil { return err } diff --git a/glide.lock b/glide.lock index 8964951f09..bd38882094 100644 --- a/glide.lock +++ b/glide.lock @@ -127,7 +127,7 @@ imports: - data - data/base58 - name: github.com/tendermint/light-client - version: c90f1a90b28977431c6291a0162228e9e4250401 + version: 88fb726e779d97acac5f0bd387892bfc541f3701 subpackages: - certifiers - certifiers/client