From 2daae43eafdf04d5c6df7f5df2d2adde58a4aeca Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 19 Apr 2021 17:46:27 +0300 Subject: [PATCH] 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. --- cli/wallet/wallet.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 95d97bf32..ecb30072e 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -193,11 +193,15 @@ func NewCommands() []cli.Command { { Name: "import-deployed", Usage: "import deployed contract", - UsageText: "import-deployed --wallet --wif --contract ", + UsageText: "import-deployed --wallet --wif --contract [--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) }