From f5c285f5ee63756917d056d5d27e7cec8b50d2fa Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 9 Apr 2018 23:18:56 +0300 Subject: [PATCH] more MarshalJSONIndent --- baseapp/baseapp.go | 9 --------- x/auth/commands/account.go | 3 +-- x/stake/commands/query.go | 9 ++++----- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index dfbb821fe81d..74b23bfb05e6 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -1,7 +1,6 @@ package baseapp import ( - "encoding/json" "fmt" "runtime/debug" @@ -241,14 +240,6 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC app.setDeliverState(abci.Header{}) app.initChainer(app.deliverState.ctx, req) // no error - // Initialize module genesis state - genesisState := new(map[string]json.RawMessage) - err := json.Unmarshal(req.AppStateBytes, genesisState) - if err != nil { - // TODO Return something intelligent - panic(err) - } - // NOTE: we don't commit, but BeginBlock for block 1 // starts from this deliverState diff --git a/x/auth/commands/account.go b/x/auth/commands/account.go index 734285202ce1..56f441f35d82 100644 --- a/x/auth/commands/account.go +++ b/x/auth/commands/account.go @@ -2,7 +2,6 @@ package commands import ( "encoding/hex" - "encoding/json" "fmt" "github.com/pkg/errors" @@ -77,7 +76,7 @@ func (c commander) getAccountCmd(cmd *cobra.Command, args []string) error { } // print out whole account - output, err := json.MarshalIndent(account, "", " ") + output, err := wire.MarshalJSONIndent(c.cdc, account) if err != nil { return err } diff --git a/x/stake/commands/query.go b/x/stake/commands/query.go index 7bc6a8aa9411..8cbb877ce9e0 100644 --- a/x/stake/commands/query.go +++ b/x/stake/commands/query.go @@ -2,7 +2,6 @@ package commands import ( "encoding/hex" - "encoding/json" "fmt" "github.com/spf13/cobra" @@ -59,7 +58,7 @@ func GetCmdQueryCandidates(cdc *wire.Codec, storeName string) *cobra.Command { if err != nil { return err } - output, err := json.MarshalIndent(candidates, "", " ") + output, err := wire.MarshalJSONIndent(cdc, candidates) if err != nil { return err } @@ -101,7 +100,7 @@ func GetCmdQueryCandidate(cdc *wire.Codec, storeName string) *cobra.Command { if err != nil { return err } - output, err := json.MarshalIndent(candidate, "", " ") + output, err := wire.MarshalJSONIndent(cdc, candidate) if err != nil { return err } @@ -149,7 +148,7 @@ func GetCmdQueryDelegatorBond(cdc *wire.Codec, storeName string) *cobra.Command if err != nil { return err } - output, err := json.MarshalIndent(bond, "", " ") + output, err := wire.MarshalJSONIndent(cdc, bond) if err != nil { return err } @@ -193,7 +192,7 @@ func GetCmdQueryDelegatorBonds(cdc *wire.Codec, storeName string) *cobra.Command if err != nil { return err } - output, err := json.MarshalIndent(candidates, "", " ") + output, err := wire.MarshalJSONIndent(cdc, candidates) if err != nil { return err }