Merge pull request #958 from cosmos/cwgoes/export-genesis-file
Export all genesis information (closes #946)
This commit is contained in:
commit
7f8734fab3
@ -18,6 +18,7 @@ BREAKING CHANGES
|
||||
|
||||
FEATURES:
|
||||
|
||||
* Added `gaiad export` command, which exports genesis information & current state
|
||||
* Gaia stake commands include, DeclareCandidacy, EditCandidacy, Delegate, Unbond
|
||||
* MountStoreWithDB without providing a custom store works.
|
||||
* Repo is now lint compliant / GoMetaLinter with tendermint-lint integrated into CI
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/wire"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// ExportCmd dumps app state to JSON
|
||||
@ -21,7 +22,16 @@ func ExportCmd(ctx *Context, cdc *wire.Codec, appExporter AppExporter) *cobra.Co
|
||||
if err != nil {
|
||||
return errors.Errorf("Error exporting state: %v\n", err)
|
||||
}
|
||||
fmt.Println(string(appState))
|
||||
doc, err := tmtypes.GenesisDocFromFile(ctx.Config.GenesisFile())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
doc.AppStateJSON = appState
|
||||
encoded, err := wire.MarshalJSONIndent(cdc, doc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(string(encoded))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user