#include "ui_interface.h"
#include "base58.h"
-#include <boost/lexical_cast.hpp>
-
#define printf OutputDebugStringF
using namespace json_spirit;
using namespace std;
+void EnsureWalletIsUnlocked();
+
class CTxDump
{
public:
return Value::null;
}
+Value importwallet(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() != 1)
+ throw runtime_error(
+ "importwallet <filename>\n"
+ "Imports keys from a wallet dump file (see dumpwallet)."
+ + HelpRequiringPassphrase());
+
+ EnsureWalletIsUnlocked();
+
+ if(!ImportWallet(pwalletMain, params[0].get_str().c_str()))
+ throw JSONRPCError(RPC_WALLET_ERROR, "Error adding some keys to wallet");
+
+ return Value::null;
+}
+
Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
"dumpprivkey <novacoinaddress>\n"
"Reveals the private key corresponding to <novacoinaddress>.");
+ EnsureWalletIsUnlocked();
+
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
return CBitcoinSecret(vchSecret, fCompressed).ToString();
}
+
+Value dumpwallet(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() != 1)
+ throw runtime_error(
+ "dumpwallet <filename>\n"
+ "Dumps all wallet keys in a human-readable format."
+ + HelpRequiringPassphrase());
+
+ EnsureWalletIsUnlocked();
+
+ if(!DumpWallet(pwalletMain, params[0].get_str().c_str() ))
+ throw JSONRPCError(RPC_WALLET_ERROR, "Error dumping wallet keys to file");
+
+ return Value::null;
+}