diff options
author | Daniel Newton <djpnewton@gmail.com> | 2014-02-21 17:56:04 +1300 |
---|---|---|
committer | Daniel Newton <djpnewton@gmail.com> | 2014-02-27 14:46:58 +1300 |
commit | a00ebb51176d229683d36cd02a8a26fd63a471a8 (patch) | |
tree | 232ce156ee2f27917e4e4af3bbc1071e17b9f959 /src/rpcwallet.cpp | |
parent | 76a77059f361f3c700a550c11adf567bafebbd00 (diff) |
move wallet info stuff to "getwalletinfo" rpc (left original wallet
stuff in getinfo call for backwards compatibility)
add wallet transaction count to getwalletinfo rpc call
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 3b0c84e49e..ebffe89041 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1893,4 +1893,36 @@ Value settxfee(const Array& params, bool fHelp) return true; } +Value getwalletinfo(const Array& params, bool fHelp) +{ + if (fHelp || params.size() != 0) + throw runtime_error( + "getwalletinfo\n" + "Returns an object containing various wallet state info.\n" + "\nResult:\n" + "{\n" + " \"walletversion\": xxxxx, (numeric) the wallet version\n" + " \"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n" + " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n" + " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n" + " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" + " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n" + "}\n" + "\nExamples:\n" + + HelpExampleCli("getwalletinfo", "") + + HelpExampleRpc("getwalletinfo", "") + ); + + Object obj; + obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); + obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size())); + obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); + obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); + if (pwalletMain->IsCrypted()) + obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); + return obj; +} + + |