Skip to content

Commit

Permalink
Clean up sendtx example
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey authored and rigelrozanski committed Mar 1, 2018
1 parent f481900 commit 67e896d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
15 changes: 11 additions & 4 deletions examples/basecoin/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,21 @@ func TestSendMsg(t *testing.T) {
Signature: sig,
}})

// just marshal/unmarshal!
cdc := MakeTxCodec()
txBytes, err := cdc.MarshalBinary(tx)
require.NoError(t, err)

// Run a Check
res := bapp.Check(tx)
assert.Equal(t, sdk.CodeUnrecognizedAddress, res.Code, res.Log)
cres := bapp.CheckTx(txBytes)
assert.Equal(t, sdk.CodeUnrecognizedAddress,
sdk.CodeType(cres.Code), cres.Log)

// Simulate a Block
bapp.BeginBlock(abci.RequestBeginBlock{})
res = bapp.Deliver(tx)
assert.Equal(t, sdk.CodeUnrecognizedAddress, res.Code, res.Log)
dres := bapp.DeliverTx(txBytes)
assert.Equal(t, sdk.CodeUnrecognizedAddress,
sdk.CodeType(dres.Code), dres.Log)
}

func TestGenesis(t *testing.T) {
Expand Down
19 changes: 1 addition & 18 deletions examples/basecoin/cmd/basecli/sendtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,7 @@ func sendTx(cmd *cobra.Command, args []string) error {
result.DeliverTx.Log)
}

fmt.Printf("Result: %#v\n", result)

// // parse out the value
// acct := new(types.AppAccount)
// cdc := app.MakeTxCodec()
// err = cdc.UnmarshalBinary(resp.Value, acct)
// if err != nil {
// return err
// }

// // TODO: better
// // fmt.Printf("Account: %#v\n", acct)
// output, err := json.MarshalIndent(acct, "", " ")
// // output, err := json.MarshalIndent(acct.BaseAccount.Coins, "", " ")
// if err != nil {
// return err
// }
// fmt.Println(string(output))
fmt.Printf("Committed at block %d. Hash: %s\n", result.Height, result.Hash.String())
return nil
}

Expand Down

0 comments on commit 67e896d

Please sign in to comment.