diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 9903eab2d..c052395a6 100644 --- a/src/rpc/server.cpp +++ b/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 }, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a65f679f3..fd393fbe4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/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"