Make sure cmd uses encoding/json not wire.JSONBytes
This commit is contained in:
parent
7b39417b99
commit
935c74d970
|
@ -2,6 +2,7 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
|
@ -133,7 +134,12 @@ func ibcRegisterTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("IBCTx:", string(wire.JSONBytes(ibcTx)))
|
out, err := json.Marshal(ibcTx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("IBCTx:", string(out))
|
||||||
|
|
||||||
data := []byte(wire.BinaryBytes(struct {
|
data := []byte(wire.BinaryBytes(struct {
|
||||||
ibc.IBCTx `json:"unwrap"`
|
ibc.IBCTx `json:"unwrap"`
|
||||||
|
@ -172,7 +178,11 @@ func ibcUpdateTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
Commit: *commit,
|
Commit: *commit,
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("IBCTx:", string(wire.JSONBytes(ibcTx)))
|
out, err := json.Marshal(ibcTx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("IBCTx:", string(out))
|
||||||
|
|
||||||
data := []byte(wire.BinaryBytes(struct {
|
data := []byte(wire.BinaryBytes(struct {
|
||||||
ibc.IBCTx `json:"unwrap"`
|
ibc.IBCTx `json:"unwrap"`
|
||||||
|
@ -211,7 +221,11 @@ func ibcPacketCreateTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("IBCTx:", string(wire.JSONBytes(ibcTx)))
|
out, err := json.Marshal(ibcTx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("IBCTx:", string(out))
|
||||||
|
|
||||||
data := []byte(wire.BinaryBytes(struct {
|
data := []byte(wire.BinaryBytes(struct {
|
||||||
ibc.IBCTx `json:"unwrap"`
|
ibc.IBCTx `json:"unwrap"`
|
||||||
|
@ -253,7 +267,11 @@ func ibcPacketPostTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
Proof: proof,
|
Proof: proof,
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("IBCTx:", string(wire.JSONBytes(ibcTx)))
|
out, err := json.Marshal(ibcTx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("IBCTx:", string(out))
|
||||||
|
|
||||||
data := []byte(wire.BinaryBytes(struct {
|
data := []byte(wire.BinaryBytes(struct {
|
||||||
ibc.IBCTx `json:"unwrap"`
|
ibc.IBCTx `json:"unwrap"`
|
||||||
|
|
|
@ -2,6 +2,7 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
@ -99,11 +100,16 @@ func queryCmd(cmd *cobra.Command, args []string) error {
|
||||||
proof := resp.Proof
|
proof := resp.Proof
|
||||||
height := resp.Height
|
height := resp.Height
|
||||||
|
|
||||||
fmt.Println(string(wire.JSONBytes(struct {
|
out, err := json.Marshal(struct {
|
||||||
Value []byte `json:"value"`
|
Value []byte `json:"value"`
|
||||||
Proof []byte `json:"proof"`
|
Proof []byte `json:"proof"`
|
||||||
Height uint64 `json:"height"`
|
Height uint64 `json:"height"`
|
||||||
}{val, proof, height})))
|
}{val, proof, height})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(out))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +132,11 @@ func accountCmd(cmd *cobra.Command, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(string(wire.JSONBytes(acc)))
|
out, err := json.Marshal(acc)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(out))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +157,7 @@ func blockCmd(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(wire.JSONBytes(struct {
|
out, err := json.Marshal(struct {
|
||||||
Hex BlockHex `json:"hex"`
|
Hex BlockHex `json:"hex"`
|
||||||
JSON BlockJSON `json:"json"`
|
JSON BlockJSON `json:"json"`
|
||||||
}{
|
}{
|
||||||
|
@ -159,7 +169,12 @@ func blockCmd(cmd *cobra.Command, args []string) error {
|
||||||
Header: header,
|
Header: header,
|
||||||
Commit: commit,
|
Commit: commit,
|
||||||
},
|
},
|
||||||
})))
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(out))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -141,8 +142,13 @@ func sendTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
signBytes := tx.SignBytes(chainIDFlag)
|
signBytes := tx.SignBytes(chainIDFlag)
|
||||||
tx.Inputs[0].Signature = privKey.Sign(signBytes)
|
tx.Inputs[0].Signature = privKey.Sign(signBytes)
|
||||||
|
|
||||||
|
out, err := json.Marshal(tx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("Signed SendTx:")
|
fmt.Println("Signed SendTx:")
|
||||||
fmt.Println(string(wire.JSONBytes(tx)))
|
fmt.Println(string(out))
|
||||||
|
|
||||||
// broadcast the transaction to tendermint
|
// broadcast the transaction to tendermint
|
||||||
data, log, err := broadcastTx(tx)
|
data, log, err := broadcastTx(tx)
|
||||||
|
@ -197,8 +203,13 @@ func AppTx(name string, data []byte) error {
|
||||||
|
|
||||||
tx.Input.Signature = privKey.Sign(tx.SignBytes(chainIDFlag))
|
tx.Input.Signature = privKey.Sign(tx.SignBytes(chainIDFlag))
|
||||||
|
|
||||||
|
out, err := json.Marshal(tx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("Signed AppTx:")
|
fmt.Println("Signed AppTx:")
|
||||||
fmt.Println(string(wire.JSONBytes(tx)))
|
fmt.Println(string(out))
|
||||||
|
|
||||||
data, log, err := broadcastTx(tx)
|
data, log, err := broadcastTx(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -45,7 +46,11 @@ func counterTxCmd(cmd *cobra.Command, args []string) error {
|
||||||
Fee: countFee,
|
Fee: countFee,
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("CounterTx:", string(wire.JSONBytes(counterTx)))
|
out, err := json.Marshal(counterTx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("CounterTx:", string(out))
|
||||||
|
|
||||||
data := wire.BinaryBytes(counterTx)
|
data := wire.BinaryBytes(counterTx)
|
||||||
name := "counter"
|
name := "counter"
|
||||||
|
|
Loading…
Reference in New Issue