Skip to content

Commit

Permalink
Add RPC Command - MoneySupply
Browse files Browse the repository at this point in the history
  • Loading branch information
Stipend-Developer committed Feb 26, 2018
1 parent 03cac9c commit 33a74a5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
8 changes: 7 additions & 1 deletion contrib/bitrpc/bitrpc.py
Expand Up @@ -206,6 +206,12 @@
except:
print "\n---An error occurred---\n"

elif cmd == "moneysupply":
try:
print access.moneysupply()
except:
print "\n---An error occurred---\n"

elif cmd == "move":
try:
frm = raw_input("From: ")
Expand Down Expand Up @@ -321,4 +327,4 @@
print

else:
print "Command not found or not supported"
print "Command not found or not supported"
13 changes: 12 additions & 1 deletion src/rpcmisc.cpp
Expand Up @@ -28,6 +28,18 @@ using namespace boost;
using namespace boost::assign;
using namespace json_spirit;

Value moneysupply(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"moneysupply\n"
"Returns the current supply of the coin.");

proxyType proxy;
GetProxy(NET_IPV4, proxy);
return ValueFromAmount(pindexBest->nMoneySupply);
}

Value getinfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
Expand Down Expand Up @@ -278,4 +290,3 @@ Value spork(const Array& params, bool fHelp)
"<value> is a epoch datetime to enable or disable spork"
+ HelpRequiringPassphrase());
}

3 changes: 2 additions & 1 deletion src/rpcserver.cpp
Expand Up @@ -234,6 +234,7 @@ static const CRPCCommand vRPCCommands[] =
{ "getnettotals", &getnettotals, true, true, false },
{ "getdifficulty", &getdifficulty, true, false, false },
{ "getinfo", &getinfo, true, false, false },
{ "moneysupply", &moneysupply, true, false, false },
{ "getrawmempool", &getrawmempool, true, false, false },
{ "getblock", &getblock, false, false, false },
{ "getblockbynumber", &getblockbynumber, false, false, false },
Expand All @@ -255,7 +256,7 @@ static const CRPCCommand vRPCCommands[] =
{ "spork", &spork, true, false, false },
{ "masternode", &masternode, true, false, true },
{ "masternodelist", &masternodelist, true, false, false },

#ifdef ENABLE_WALLET
{ "darksend", &darksend, false, false, true },
{ "getmininginfo", &getmininginfo, true, false, false },
Expand Down
1 change: 1 addition & 0 deletions src/rpcserver.h
Expand Up @@ -157,6 +157,7 @@ extern json_spirit::Value walletlock(const json_spirit::Array& params, bool fHel
extern json_spirit::Value encryptwallet(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value validateaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getinfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value moneysupply(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value reservebalance(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value addmultisigaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value createmultisig(const json_spirit::Array& params, bool fHelp);
Expand Down

0 comments on commit 33a74a5

Please sign in to comment.