Compare commits

...

1 Commits

  1. 2
      src/Makefile.am
  2. 1
      src/rpc/server.cpp
  3. 1
      src/rpc/server.h
  4. 26
      src/wallet/rpcwallet.cpp

2
src/Makefile.am

@ -358,6 +358,8 @@ crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES)
crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libbitcoin_crypto_a_SOURCES = \
crypto/common.h \
crypto/bip39/bip39.h \
crypto/bip39/bip39.c \
crypto/equihash.cpp \
crypto/equihash.h \
crypto/equihash.tcc \

1
src/rpc/server.cpp

@ -651,6 +651,7 @@ static const CRPCCommand vRPCCommands[] =
{ "wallet", "walletlock", &walletlock, true },
{ "wallet", "walletpassphrasechange", &walletpassphrasechange, true },
{ "wallet", "walletpassphrase", &walletpassphrase, true },
{ "wallet", "walletseedphrase", &walletseedphrase, true },
{ "wallet", "z_listreceivedbyaddress",&z_listreceivedbyaddress,false },
{ "wallet", "z_listreceivedaddress", &z_listreceivedaddress, false },
{ "wallet", "z_getbalance", &z_getbalance, false },

1
src/rpc/server.h

@ -384,6 +384,7 @@ extern UniValue gettransaction(const UniValue& params, bool fHelp, const CPubKey
extern UniValue backupwallet(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue keypoolrefill(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue walletpassphrase(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue walletseedphrase(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue walletpassphrasechange(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue walletlock(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue encryptwallet(const UniValue& params, bool fHelp, const CPubKey& mypk);

26
src/wallet/rpcwallet.cpp

@ -64,6 +64,7 @@
#include "komodo_defs.h"
#include <string.h>
#include "rpchushwallet.h"
#include "crypto/bip39/bip39.h"
using namespace std;
@ -2407,6 +2408,30 @@ static void LockWallet(CWallet* pWallet)
pWallet->Lock();
}
UniValue walletseedphrase(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (fHelp || params.size() > 1)
throw runtime_error(
"walletseedphrase\n"
"\nReturns HIP39 seedphrase of the current wallet."
+ HelpRequiringPassphrase() + "\n"
"\nExamples:\n"
+ HelpExampleCli("walletseedphrase", "")
+ HelpExampleRpc("walletseedphrase", "")
);
LOCK2(cs_main, pwalletMain->cs_wallet);
UniValue seedphrase(UniValue::VSTR);
//TODO: Currently we just generate a random seedphrase
int strength = 256;
const char *mnemonic = mnemonic_generate(strength);
seedphrase = std::string(mnemonic);
return seedphrase;
}
UniValue walletpassphrase(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))
@ -8291,6 +8316,7 @@ static const CRPCCommand commands[] =
{ "wallet", "walletlock", &walletlock, true },
{ "wallet", "walletpassphrasechange", &walletpassphrasechange, true },
{ "wallet", "walletpassphrase", &walletpassphrase, true },
{ "wallet", "walletseedphrase", &walletseedphrase, true },
{ "wallet", "z_listreceivedbyaddress", &z_listreceivedbyaddress, false },
{ "wallet", "z_listunspent", &z_listunspent, false },
{ "wallet", "z_getbalance", &z_getbalance, false },

Loading…
Cancel
Save