Browse Source

wip rpc for nullifiers

pull/63/head
Duke Leto 4 years ago
parent
commit
2d1b8eff67
  1. 1
      src/rpc/server.cpp
  2. 30
      src/wallet/rpcwallet.cpp

1
src/rpc/server.cpp

@ -667,6 +667,7 @@ static const CRPCCommand vRPCCommands[] =
{ "wallet", "z_listoperationids", &z_listoperationids, true },
{ "wallet", "z_getnewaddress", &z_getnewaddress, true },
{ "wallet", "z_listaddresses", &z_listaddresses, true },
{ "wallet", "z_listnullifiers", &z_listnullifiers, true },
{ "wallet", "z_exportkey", &z_exportkey, true },
{ "wallet", "z_importkey", &z_importkey, true },
{ "wallet", "z_exportviewingkey", &z_exportviewingkey, true },

30
src/wallet/rpcwallet.cpp

@ -3743,6 +3743,34 @@ UniValue z_getnewaddress(const UniValue& params, bool fHelp, const CPubKey& mypk
}
}
UniValue z_listnullifiers(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (fHelp || params.size() > 1)
throw runtime_error(
"z_listaddresses ( includeWatchonly )\n"
"\nReturns the list of Sprout and Sapling shielded addresses belonging to the wallet.\n"
"\nArguments:\n"
"1. includeWatchonly (bool, optional, default=false) Also include watchonly addresses (see 'z_importviewingkey')\n"
"\nResult:\n"
"[ (json array of string)\n"
" \"zaddr\" (string) a zaddr belonging to the wallet\n"
" ,...\n"
"]\n"
"\nExamples:\n"
+ HelpExampleCli("z_listaddresses", "")
+ HelpExampleRpc("z_listaddresses", "")
);
LOCK2(cs_main, pwalletMain->cs_wallet);
UniValue ret(UniValue::VARR);
for (auto nullifier: Nullifiers){
ret.push_back(EncodePaymentAddress(addr));
}
return ret;
}
UniValue z_listaddresses(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
@ -3752,7 +3780,7 @@ UniValue z_listaddresses(const UniValue& params, bool fHelp, const CPubKey& mypk
if (fHelp || params.size() > 1)
throw runtime_error(
"z_listaddresses ( includeWatchonly )\n"
"\nReturns the list of Sprout and Sapling shielded addresses belonging to the wallet.\n"
"\nReturns the list of Sapling shielded addresses belonging to the wallet.\n"
"\nArguments:\n"
"1. includeWatchonly (bool, optional, default=false) Also include watchonly addresses (see 'z_importviewingkey')\n"
"\nResult:\n"

Loading…
Cancel
Save