Update to use new helper methods, less code dups
This commit is contained in:
parent
8f67b6be84
commit
282a157997
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ imports:
|
|||
- data
|
||||
- data/base58
|
||||
- name: github.com/tendermint/light-client
|
||||
version: c90f1a90b28977431c6291a0162228e9e4250401
|
||||
version: 88fb726e779d97acac5f0bd387892bfc541f3701
|
||||
subpackages:
|
||||
- certifiers
|
||||
- certifiers/client
|
||||
|
|
Loading…
Reference in New Issue