Skip to content

Commit

Permalink
Contract invoke should check to ensure either account or --results is…
Browse files Browse the repository at this point in the history
… specified (#145)

Fixes #144

Co-authored-by: Harry <[email protected]>
  • Loading branch information
devhawk and Harry authored Jun 15, 2021
1 parent 5333fd1 commit ed990c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/neoxp/Commands/ContractCommand.Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ internal async Task<int> OnExecuteAsync(IConsole console)
{
try
{
if (string.IsNullOrEmpty(Account) && !Results)
{
throw new Exception("Either Account or --results must be specified");
}

var (chainManager, _) = chainManagerFactory.LoadChain(Input);

if (Results)
Expand Down Expand Up @@ -80,7 +85,6 @@ internal async Task<int> OnExecuteAsync(IConsole console)
return 1;
}
}

}
}
}
2 changes: 2 additions & 0 deletions src/neoxp/Extensions/ExpressChainExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public static bool IsReservedName(this ExpressChain chain, string name)

public static string ResolvePassword(this ExpressChain chain, string name, string password)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentException($"{nameof(name)} parameter can't be null or empty", nameof(name));

// if the user specified a password, use it
if (!string.IsNullOrEmpty(password)) return password;

Expand Down

0 comments on commit ed990c1

Please sign in to comment.