Skip to content

Commit

Permalink
refactor: replace the keystore command with account cmd (#54)
Browse files Browse the repository at this point in the history
* fix: remove default password file

* refactor: replace keystore command with account cmd

* fix: fix command description and log

* feat: support account export commands and support version cmd

---------

Co-authored-by: leowkong <[email protected]>
  • Loading branch information
flywukong and leowkong committed Jul 14, 2023
1 parent 3b260f5 commit 00f53dd
Show file tree
Hide file tree
Showing 8 changed files with 537 additions and 473 deletions.
21 changes: 20 additions & 1 deletion cmd/client_gnfd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,31 @@ import (

const iso8601DateFormatSecond = "2006-01-02T15:04:05Z"

func cmdShowVersion() *cli.Command {
return &cli.Command{
Name: "version",
Action: showVersion,
Usage: "print version info",
ArgsUsage: "",
Description: `
Examples:
$ gnfd-cmd version `,
}
}

func showVersion(ctx *cli.Context) error {
fmt.Println("Greenfield Cmd Version:", Version)
return nil
}

// NewClient returns a new greenfield client
func NewClient(ctx *cli.Context) (client.Client, error) {
privateKey, err := parseKeystore(ctx)
privateKey, _, err := parseKeystore(ctx)
if err != nil {
return nil, err
}

account, err := sdktypes.NewAccountFromPrivateKey("gnfd-account", privateKey)
if err != nil {
fmt.Println("new account err", err.Error())
Expand Down
Loading

0 comments on commit 00f53dd

Please sign in to comment.