diff --git a/cmd/tmsp-cli/tmsp-cli.go b/cmd/tmsp-cli/tmsp-cli.go index fe6dbd451..219d89dfb 100644 --- a/cmd/tmsp-cli/tmsp-cli.go +++ b/cmd/tmsp-cli/tmsp-cli.go @@ -234,7 +234,7 @@ func cmdCheckTx(c *cli.Context) error { // Get application Merkle root hash func cmdCommit(c *cli.Context) error { res := client.CommitSync() - printResponse(c, res, Fmt("%X", res.Data), false) + printResponse(c, res, Fmt("0x%X", res.Data), false) return nil } @@ -264,7 +264,7 @@ func printResponse(c *cli.Context, res types.Result, s string, printCode bool) { fmt.Printf("-> error: %s\n", res.Error) }*/ if s != "" { - fmt.Printf("-> data: {%s}\n", s) + fmt.Printf("-> data: %s\n", s) } if res.Log != "" { fmt.Printf("-> log: %s\n", res.Log) diff --git a/example/counter/counter.go b/example/counter/counter.go index ef57d8407..3252f9437 100644 --- a/example/counter/counter.go +++ b/example/counter/counter.go @@ -18,7 +18,7 @@ func NewCounterApplication(serial bool) *CounterApplication { } func (app *CounterApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) { - return Fmt("hashes:%v, txs:%v", app.hashCount, app.txCount), nil, nil, nil + return Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount), nil, nil, nil } func (app *CounterApplication) SetOption(key string, value string) (log string) { diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index daed7a935..438de6a4c 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -19,7 +19,7 @@ func NewDummyApplication() *DummyApplication { } func (app *DummyApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) { - return Fmt("size:%v", app.state.Size()), nil, nil, nil + return Fmt("{\"size\":%v}", app.state.Size()), nil, nil, nil } func (app *DummyApplication) SetOption(key string, value string) (log string) { diff --git a/tests/test_cli/ex1.tmsp.out b/tests/test_cli/ex1.tmsp.out index 89bd61c2f..eabeabd1f 100644 --- a/tests/test_cli/ex1.tmsp.out +++ b/tests/test_cli/ex1.tmsp.out @@ -1,31 +1,32 @@ > echo hello --> data: {hello} +-> data: hello > info --> data: {size:0} +-> data: {"size":0} > commit +-> data: 0x > append_tx abc -> code: OK > info --> data: {size:1} +-> data: {"size":1} > commit --> data: {750502FC7E84BBD788ED589624F06CFA871845D1} +-> data: 0x750502FC7E84BBD788ED589624F06CFA871845D1 > query abc -> code: OK --> data: {Index=0 value=abc exists=true} +-> data: {"index":0,"value":"abc","exists":true} > append_tx def=xyz -> code: OK > commit --> data: {76393B8A182E450286B0694C629ECB51B286EFD5} +-> data: 0x76393B8A182E450286B0694C629ECB51B286EFD5 > query def -> code: OK --> data: {Index=1 value=xyz exists=true} +-> data: {"index":1,"value":"xyz","exists":true} diff --git a/tests/test_cli/ex2.tmsp.out b/tests/test_cli/ex2.tmsp.out index 3aa7744bb..84e4ad4f7 100644 --- a/tests/test_cli/ex2.tmsp.out +++ b/tests/test_cli/ex2.tmsp.out @@ -1,5 +1,5 @@ > set_option serial on --> data: {serial=on} +-> data: serial=on > check_tx 0x00 -> code: OK @@ -22,5 +22,5 @@ -> log: Invalid nonce. Expected 2, got 4 > info --> data: {hashes:0, txs:2} +-> data: {"hashes":0,"txs":2}