From eada85891c3ddf7f139bfe5b39402ce0223c439c Mon Sep 17 00:00:00 2001 From: fekt Date: Mon, 26 Feb 2024 12:50:29 -0500 Subject: [PATCH] Update rpcdump.cpp --- src/wallet/rpcdump.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index d74666bf0..b98b38613 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -820,10 +820,9 @@ UniValue z_getalldiversifiedaddresses(const UniValue& params, bool fHelp, const LOCK2(cs_main, pwalletMain->cs_wallet); - KeyIO keyIO(Params()); string strAddress = params[0].get_str(); - auto in_address = keyIO.DecodePaymentAddress(strAddress); + auto in_address = DecodePaymentAddress(strAddress); if (!IsValidPaymentAddress(in_address)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid zaddr"); } @@ -849,7 +848,7 @@ UniValue z_getalldiversifiedaddresses(const UniValue& params, bool fHelp, const pwalletMain->GetSaplingFullViewingKey(ivk, xfvk); if (ivk == in_ivk && xfvk == in_xfvk) { - ret.push_back(keyIO.EncodePaymentAddress(addr)); + ret.push_back(EncodePaymentAddress(addr)); } } @@ -877,10 +876,9 @@ UniValue z_getnewdiversifiedaddress(const UniValue& params, bool fHelp, const CP EnsureWalletIsUnlocked(); - KeyIO keyIO(Params()); string strAddress = params[0].get_str(); - auto in_address = keyIO.DecodePaymentAddress(strAddress); + auto in_address = DecodePaymentAddress(strAddress); if (!IsValidPaymentAddress(in_address)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid zaddr"); @@ -930,7 +928,7 @@ UniValue z_getnewdiversifiedaddress(const UniValue& params, bool fHelp, const CP break; } - return keyIO.EncodePaymentAddress(address); + return EncodePaymentAddress(address); } UniValue z_importkey(const UniValue& params, bool fHelp, const CPubKey& mypk) @@ -1223,8 +1221,7 @@ UniValue z_exportivk(const UniValue& params, bool fHelp, const CPubKey& mypk) string strAddress = params[0].get_str(); - KeyIO keyIO(Params()); - auto address = keyIO.DecodePaymentAddress(strAddress); + auto address = DecodePaymentAddress(strAddress); if (!IsValidPaymentAddress(address) || !IsValidSaplingAddress(address)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Sapling zaddr"); } @@ -1234,7 +1231,7 @@ UniValue z_exportivk(const UniValue& params, bool fHelp, const CPubKey& mypk) if (!pwalletMain->GetSaplingIncomingViewingKey(spa, ivk)) { throw JSONRPCError(RPC_WALLET_ERROR, "Wallet does not hold viewing key for this zaddr"); } else { - return keyIO.EncodeIVK(ivk); + return EncodeIVK(ivk); } } @@ -1299,8 +1296,7 @@ UniValue z_importivk(const UniValue& params, bool fHelp, const CPubKey& mypk) } string strIVKey = params[0].get_str(); - KeyIO keyIO(Params()); - auto ivk = keyIO.DecodeIVK(strIVKey); + auto ivk = DecodeIVK(strIVKey); if (ivk.IsNull()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid incoming viewing key"); } @@ -1309,7 +1305,7 @@ UniValue z_importivk(const UniValue& params, bool fHelp, const CPubKey& mypk) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Missing zaddr for Sapling viewing key."); } string strAddress = params[3].get_str(); - auto address = keyIO.DecodePaymentAddress(strAddress); + auto address = DecodePaymentAddress(strAddress); if (!IsValidSaplingAddress(address)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Sapling zaddr"); }