diff --git a/client/commands/seeds/export.go b/client/commands/seeds/export.go index 1119800f2d..ec381246bd 100644 --- a/client/commands/seeds/export.go +++ b/client/commands/seeds/export.go @@ -1,15 +1,11 @@ package seeds import ( - "encoding/json" - "os" - "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/cosmos/cosmos-sdk/client/commands" - "github.com/tendermint/light-client/certifiers" ) var exportCmd = &cobra.Command{ @@ -44,17 +40,5 @@ func exportSeed(cmd *cobra.Command, args []string) error { } // now get the output file and write it - return writeSeed(seed, path) -} - -// TODO use certifiers function -func writeSeed(seed certifiers.Seed, path string) (err error) { - f, err := os.Create(path) - if err != nil { - return errors.WithStack(err) - } - defer f.Close() - stream := json.NewEncoder(f) - err = stream.Encode(seed) - return errors.WithStack(err) + return seed.WriteJSON(path) } diff --git a/client/commands/seeds/import.go b/client/commands/seeds/import.go index 3114391506..d231f4c3b5 100644 --- a/client/commands/seeds/import.go +++ b/client/commands/seeds/import.go @@ -42,7 +42,7 @@ func importSeed(cmd *cobra.Command, args []string) error { // parse the input file path := args[0] - seed, err := certifiers.LoadSeed(path) + seed, err := certifiers.LoadSeedJSON(path) if err != nil { return err } diff --git a/client/commands/seeds/show.go b/client/commands/seeds/show.go index d0ba0b7b84..852cb0b82c 100644 --- a/client/commands/seeds/show.go +++ b/client/commands/seeds/show.go @@ -47,7 +47,7 @@ func loadSeed(p certifiers.Provider, h int, hash, file string) (seed certifiers. seed, err = p.GetByHash(vhash) } } else if file != "" { - seed, err = certifiers.LoadSeed(file) + seed, err = certifiers.LoadSeedJSON(file) } else { // default is latest seed seed, err = certifiers.LatestSeed(p)