mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 13:41:47 +00:00
cli: add optional 'name' argument to 'wallet import-deployed' command
If the provided WIF is encrypted then we have no way to set the account name. Fixed.
This commit is contained in:
parent
0ccced2274
commit
2daae43eaf
1 changed files with 8 additions and 1 deletions
|
@ -193,11 +193,15 @@ func NewCommands() []cli.Command {
|
|||
{
|
||||
Name: "import-deployed",
|
||||
Usage: "import deployed contract",
|
||||
UsageText: "import-deployed --wallet <path> --wif <wif> --contract <hash>",
|
||||
UsageText: "import-deployed --wallet <path> --wif <wif> --contract <hash> [--name <account_name>]",
|
||||
Action: importDeployed,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
wifFlag,
|
||||
cli.StringFlag{
|
||||
Name: "name, n",
|
||||
Usage: "Optional account name",
|
||||
},
|
||||
flags.AddressFlag{
|
||||
Name: "contract, c",
|
||||
Usage: "Contract hash or address",
|
||||
|
@ -466,6 +470,9 @@ func importDeployed(ctx *cli.Context) error {
|
|||
}
|
||||
acc.Contract.Deployed = true
|
||||
|
||||
if acc.Label == "" {
|
||||
acc.Label = ctx.String("name")
|
||||
}
|
||||
if err := addAccountAndSave(wall, acc); err != nil {
|
||||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue