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

Commit

Permalink
add RPC command listaddress (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Jan 26, 2018
1 parent 020b394 commit 5078839
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions neo-cli/Network/RPC/RpcServerWithWallet.cs
Expand Up @@ -41,6 +41,19 @@ protected override JObject Process(string method, JArray _params)
json["confirmed"] = coins.Where(p => p.State.HasFlag(CoinState.Confirmed)).Sum(p => p.Output.Value).ToString();
return json;
}
case "listaddress":
if (Program.Wallet == null)
throw new RpcException(-400, "Access denied.");
else
return Program.Wallet.GetAccounts().Select(p =>
{
JObject account = new JObject();
account["address"] = p.Address;
account["haskey"] = p.HasKey;
account["label"] = p.Label;
account["watchonly"] = p.WatchOnly;
return account;
}).ToArray();
case "sendfrom":
if (Program.Wallet == null)
throw new RpcException(-400, "Access denied");
Expand Down

0 comments on commit 5078839

Please sign in to comment.