Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into color-output
Browse files Browse the repository at this point in the history
  • Loading branch information
superboyiii committed Aug 30, 2021
2 parents 2ca1312 + e0162a0 commit 0c1ff4c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion neo-cli/CLI/MainService.Contracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void OnUpdateCommand(UInt160 scriptHash, string filePath, string manifes
Signer[] signers = Array.Empty<Signer>();

if (NoWallet()) return;
if (!NoWallet() && sender != null)
if (sender != null)
{
if (signerAccounts == null)
signerAccounts = new UInt160[1] { sender };
Expand Down
17 changes: 4 additions & 13 deletions neo-cli/CLI/MainService.Vote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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())
{
Expand All @@ -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())
{
Expand Down
26 changes: 26 additions & 0 deletions neo-cli/CLI/MainService.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,32 @@ private void OnCreateAddressCommand(ushort count = 1)
File.WriteAllLines(path, addresses);
}

/// <summary>
/// Process "delete address" command
/// </summary>
/// <param name="address">Address</param>
[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.");
}
}
}

/// <summary>
/// Process "export key" command
/// </summary>
Expand Down

0 comments on commit 0c1ff4c

Please sign in to comment.