diff --git a/neo-cli/CLI/MainService.Contracts.cs b/neo-cli/CLI/MainService.Contracts.cs index ccc222dd7..6e8686c13 100644 --- a/neo-cli/CLI/MainService.Contracts.cs +++ b/neo-cli/CLI/MainService.Contracts.cs @@ -67,7 +67,7 @@ private void OnUpdateCommand(UInt160 scriptHash, string filePath, string manifes Signer[] signers = Array.Empty(); if (NoWallet()) return; - if (!NoWallet() && sender != null) + if (sender != null) { if (signerAccounts == null) signerAccounts = new UInt160[1] { sender }; diff --git a/neo-cli/CLI/MainService.Vote.cs b/neo-cli/CLI/MainService.Vote.cs index d96761632..b8ffdb988 100644 --- a/neo-cli/CLI/MainService.Vote.cs +++ b/neo-cli/CLI/MainService.Vote.cs @@ -32,10 +32,7 @@ partial class MainService private void OnRegisterCandidateCommand(UInt160 account) { var testGas = NativeContract.NEO.GetRegisterPrice(NeoSystem.StoreView) + (BigInteger)Math.Pow(10, NativeContract.GAS.Decimals) * 10; - - if (NoWallet()) - return; - + if (NoWallet()) return; WalletAccount currentAccount = CurrentWallet.GetAccount(account); if (currentAccount == null) @@ -70,9 +67,7 @@ private void OnRegisterCandidateCommand(UInt160 account) [ConsoleCommand("unregister candidate", Category = "Vote Commands")] private void OnUnregisterCandidateCommand(UInt160 account) { - if (NoWallet()) - return; - + if (NoWallet()) return; WalletAccount currentAccount = CurrentWallet.GetAccount(account); if (currentAccount == null) @@ -108,9 +103,7 @@ private void OnUnregisterCandidateCommand(UInt160 account) [ConsoleCommand("vote", Category = "Vote Commands")] private void OnVoteCommand(UInt160 senderAccount, ECPoint publicKey) { - if (NoWallet()) - return; - + if (NoWallet()) return; byte[] script; using (ScriptBuilder scriptBuilder = new ScriptBuilder()) { @@ -128,9 +121,7 @@ private void OnVoteCommand(UInt160 senderAccount, ECPoint publicKey) [ConsoleCommand("unvote", Category = "Vote Commands")] private void OnUnvoteCommand(UInt160 senderAccount) { - if (NoWallet()) - return; - + if (NoWallet()) return; byte[] script; using (ScriptBuilder scriptBuilder = new ScriptBuilder()) { diff --git a/neo-cli/CLI/MainService.Wallet.cs b/neo-cli/CLI/MainService.Wallet.cs index 43ecca5ed..96f776516 100644 --- a/neo-cli/CLI/MainService.Wallet.cs +++ b/neo-cli/CLI/MainService.Wallet.cs @@ -138,6 +138,32 @@ private void OnCreateAddressCommand(ushort count = 1) File.WriteAllLines(path, addresses); } + /// + /// Process "delete address" command + /// + /// Address + [ConsoleCommand("delete address", Category = "Wallet Commands")] + private void OnDeleteAddressCommand(UInt160 address) + { + if (NoWallet()) return; + + if (ReadUserInput($"Warning: Irrevocable operation!\nAre you sure to delete account {address.ToAddress(NeoSystem.Settings.AddressVersion)}? (no|yes)").IsYes()) + { + if (CurrentWallet.DeleteAccount(address)) + { + if (CurrentWallet is NEP6Wallet wallet) + { + wallet.Save(); + } + Console.WriteLine($"Address {address} deleted."); + } + else + { + Console.WriteLine($"Address {address} doesn't exist."); + } + } + } + /// /// Process "export key" command ///