cleaned up basecli tx so it really works

This commit is contained in:
Ethan Frey 2018-02-23 14:17:07 +01:00 committed by rigelrozanski
parent 734b1073ba
commit c083678cae
4 changed files with 13 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package tx
import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/pkg/errors"
@ -56,8 +57,7 @@ func queryTx(cmd *cobra.Command, args []string) error {
return err
}
cdc := app.MakeTxCodec()
output, err := cdc.MarshalJSON(info)
output, err := json.MarshalIndent(info, "", " ")
if err != nil {
return err
}
@ -67,19 +67,16 @@ func queryTx(cmd *cobra.Command, args []string) error {
}
func formatTxResult(res *ctypes.ResultTx) (txInfo, error) {
height := res.Height
result := res.TxResult
// TODO: verify the proof if requested
tx, err := parseTx(res.Tx)
if err != nil {
return txInfo{}, err
}
info := txInfo{
Height: height,
Height: res.Height,
Tx: tx,
Result: result,
Result: res.TxResult,
}
return info, nil
}

View File

@ -54,5 +54,8 @@ echo; echo "Empty account got some cash"
echo; echo "View tx"
./build/basecli tx $HASH
# shutdown
# shutdown, but add a sleep if you want to manually run some cli scripts
# against this server before it goes away
# sleep 120
kill $PID_SERVER

View File

@ -4,7 +4,7 @@ import crypto "github.com/tendermint/go-crypto"
// Standard Signature
type StdSignature struct {
crypto.PubKey // optional
crypto.Signature
Sequence int64
crypto.PubKey `json:"pub_key"` // optional
crypto.Signature `json:"signature"`
Sequence int64 `json:"sequence"`
}

View File

@ -52,8 +52,8 @@ var _ Tx = (*StdTx)(nil)
// StdTx is a standard way to wrap a Msg with Signatures.
// NOTE: the first signature is the FeePayer (Signatures must not be nil).
type StdTx struct {
Msg
Signatures []StdSignature
Msg `json:"msg"`
Signatures []StdSignature `json:"signatures"`
}
func NewStdTx(msg Msg, sigs []StdSignature) StdTx {