示例#1
0
        /// <summary>
        /// delete a address
        /// </summary>
        /// <returns></returns>
        public async Task <object> DeleteAddress(UInt160[] addresses)
        {
            if (CurrentWallet == null)
            {
                return(Error(ErrorCode.WalletNotOpen));
            }
            var result = addresses.Select(scriptHash => CurrentWallet.DeleteAccount(scriptHash)).ToList();

            if (CurrentWallet is NEP6Wallet wallet)
            {
                wallet.Save();
            }
            return(result);
        }
        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();
                    }
                    ConsoleHelper.Info($"Address {address} deleted.");
                }
                else
                {
                    ConsoleHelper.Warning($"Address {address} doesn't exist.");
                }
            }
        }