Skip to content

Commit

Permalink
cleaned up basecli tx so it really works
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey authored and rigelrozanski committed Mar 1, 2018
1 parent 734b107 commit c083678
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
11 changes: 4 additions & 7 deletions client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tx

import (
"encoding/hex"
"encoding/json"
"fmt"

"github.com/pkg/errors"
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
5 changes: 4 additions & 1 deletion tests/check_basecli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

6 changes: 3 additions & 3 deletions types/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions types/tx_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c083678

Please sign in to comment.