diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index eca0fbb12..bd63638c9 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -90,7 +90,7 @@ std::string DecodeDumpString(const std::string &str) { return ret.str(); } -UniValue convertpassphrase(const UniValue& params, bool fHelp) +UniValue convertpassphrase(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() < 1 || params.size() > 1) throw runtime_error( @@ -149,7 +149,7 @@ UniValue convertpassphrase(const UniValue& params, bool fHelp) return ret; } -UniValue importprivkey(const UniValue& params, bool fHelp) +UniValue importprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -245,7 +245,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp) return EncodeDestination(vchAddress); } -UniValue importaddress(const UniValue& params, bool fHelp) +UniValue importaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -318,7 +318,7 @@ UniValue importaddress(const UniValue& params, bool fHelp) return NullUniValue; } -UniValue z_importwallet(const UniValue& params, bool fHelp) +UniValue z_importwallet(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -341,7 +341,7 @@ UniValue z_importwallet(const UniValue& params, bool fHelp) return importwallet_impl(params, fHelp, true); } -UniValue importwallet(const UniValue& params, bool fHelp) +UniValue importwallet(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -473,7 +473,7 @@ UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys return NullUniValue; } -UniValue dumpprivkey(const UniValue& params, bool fHelp) +UniValue dumpprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -515,7 +515,7 @@ UniValue dumpprivkey(const UniValue& params, bool fHelp) -UniValue z_exportwallet(const UniValue& params, bool fHelp) +UniValue z_exportwallet(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -536,7 +536,7 @@ UniValue z_exportwallet(const UniValue& params, bool fHelp) return dumpwallet_impl(params, fHelp, true); } -UniValue dumpwallet(const UniValue& params, bool fHelp) +UniValue dumpwallet(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -673,7 +673,7 @@ UniValue dumpwallet_impl(const UniValue& params, bool fHelp, bool fDumpZKeys) } -UniValue z_importkey(const UniValue& params, bool fHelp) +UniValue z_importkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -764,7 +764,7 @@ UniValue z_importkey(const UniValue& params, bool fHelp) return NullUniValue; } -UniValue z_importviewingkey(const UniValue& params, bool fHelp) +UniValue z_importviewingkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -882,7 +882,7 @@ UniValue z_importviewingkey(const UniValue& params, bool fHelp) return NullUniValue; } -UniValue z_exportkey(const UniValue& params, bool fHelp) +UniValue z_exportkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -921,7 +921,7 @@ UniValue z_exportkey(const UniValue& params, bool fHelp) return EncodeSpendingKey(sk.get()); } -UniValue z_exportviewingkey(const UniValue& params, bool fHelp) +UniValue z_exportviewingkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -993,10 +993,12 @@ UniValue NSPV_spentinfo(uint256 txid,int32_t vout); UniValue NSPV_notarizations(int32_t height); UniValue NSPV_hdrsproof(int32_t prevheight,int32_t nextheight); UniValue NSPV_txproof(int32_t vout,uint256 txid,int32_t height); +UniValue NSPV_ccmoduleutxos(char *coinaddr, int64_t amount, uint8_t evalcode, std::string funcids, uint256 filtertxid); + uint256 Parseuint256(const char *hexstr); extern std::string NSPV_address; -UniValue nspv_getinfo(const UniValue& params, bool fHelp) +UniValue nspv_getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t reqht = 0; if ( fHelp || params.size() > 1 ) @@ -1008,7 +1010,7 @@ UniValue nspv_getinfo(const UniValue& params, bool fHelp) return(NSPV_getinfo_req(reqht)); } -UniValue nspv_logout(const UniValue& params, bool fHelp) +UniValue nspv_logout(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() != 0 ) throw runtime_error("nspv_logout\n"); @@ -1017,7 +1019,7 @@ UniValue nspv_logout(const UniValue& params, bool fHelp) return(NSPV_logout()); } -UniValue nspv_login(const UniValue& params, bool fHelp) +UniValue nspv_login(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() != 1 ) throw runtime_error("nspv_login wif\n"); @@ -1026,7 +1028,7 @@ UniValue nspv_login(const UniValue& params, bool fHelp) return(NSPV_login((char *)params[0].get_str().c_str())); } -UniValue nspv_listunspent(const UniValue& params, bool fHelp) +UniValue nspv_listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t skipcount = 0,CCflag = 0; if ( fHelp || params.size() > 3 ) @@ -1050,7 +1052,7 @@ UniValue nspv_listunspent(const UniValue& params, bool fHelp) else throw runtime_error("nspv_listunspent [address [isCC [skipcount]]]\n"); } -UniValue nspv_mempool(const UniValue& params, bool fHelp) +UniValue nspv_mempool(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t vout = 0,CCflag = 0; uint256 txid; uint8_t funcid; char *coinaddr; memset(&txid,0,sizeof(txid)); @@ -1071,7 +1073,7 @@ UniValue nspv_mempool(const UniValue& params, bool fHelp) return(NSPV_mempooltxids(coinaddr,CCflag,funcid,txid,vout)); } -UniValue nspv_listtransactions(const UniValue& params, bool fHelp) +UniValue nspv_listtransactions(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t skipcount = 0,CCflag = 0; if ( fHelp || params.size() > 3 ) @@ -1096,7 +1098,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp) else throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n"); } -UniValue nspv_spentinfo(const UniValue& params, bool fHelp) +UniValue nspv_spentinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 txid; int32_t vout; if ( fHelp || params.size() != 2 ) @@ -1108,7 +1110,7 @@ UniValue nspv_spentinfo(const UniValue& params, bool fHelp) return(NSPV_spentinfo(txid,vout)); } -UniValue nspv_notarizations(const UniValue& params, bool fHelp) +UniValue nspv_notarizations(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t height; if ( fHelp || params.size() != 1 ) @@ -1119,7 +1121,7 @@ UniValue nspv_notarizations(const UniValue& params, bool fHelp) return(NSPV_notarizations(height)); } -UniValue nspv_hdrsproof(const UniValue& params, bool fHelp) +UniValue nspv_hdrsproof(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t prevheight,nextheight; if ( fHelp || params.size() != 2 ) @@ -1131,7 +1133,7 @@ UniValue nspv_hdrsproof(const UniValue& params, bool fHelp) return(NSPV_hdrsproof(prevheight,nextheight)); } -UniValue nspv_txproof(const UniValue& params, bool fHelp) +UniValue nspv_txproof(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 txid; int32_t height; if ( fHelp || params.size() != 2 ) @@ -1143,7 +1145,7 @@ UniValue nspv_txproof(const UniValue& params, bool fHelp) return(NSPV_txproof(0,txid,height)); } -UniValue nspv_spend(const UniValue& params, bool fHelp) +UniValue nspv_spend(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint64_t satoshis; if ( fHelp || params.size() != 2 ) @@ -1159,7 +1161,7 @@ UniValue nspv_spend(const UniValue& params, bool fHelp) return(NSPV_spend((char *)NSPV_address.c_str(),(char *)params[0].get_str().c_str(),satoshis)); } -UniValue nspv_broadcast(const UniValue& params, bool fHelp) +UniValue nspv_broadcast(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() != 1 ) throw runtime_error("nspv_broadcast hex\n"); @@ -1167,3 +1169,23 @@ UniValue nspv_broadcast(const UniValue& params, bool fHelp) throw runtime_error("-nSPV=1 must be set to use nspv\n"); return(NSPV_broadcast((char *)params[0].get_str().c_str())); } + +UniValue nspv_listccmoduleunspent(const UniValue& params, bool fHelp, const CPubKey& mypk) +{ + int32_t skipcount = 0, CCflag = 0; + if (fHelp || params.size() != 5) + throw runtime_error("nspv_listccmoduleunspent address amount evalcode funcids txid\n\n" + "returns utxos from the address, filtered by evalcode funcids and txid in opret.\n" + "if amount is 0 just returns no utxos and available total.\n" + "funcids is a string of funcid symbols. The first symbol is considered as the creation funcid, so the txid param will be compared to the creation tx id.\n" + "For the second+ funcids the txid param will be compared to txid in opreturn\n\n" ); + if (KOMODO_NSPV_FULLNODE) + throw runtime_error("-nSPV=1 must be set to use nspv\n"); + + std::string address = params[0].get_str().c_str(); + int64_t amount = atof(params[1].get_str().c_str()); + uint8_t evalcode = atoi(params[2].get_str().c_str()); + std::string funcids = params[3].get_str().c_str(); + uint256 txid = Parseuint256( params[4].get_str().c_str() ); + return(NSPV_ccmoduleutxos((char*)address.c_str(), amount, evalcode, funcids, txid)); +} \ No newline at end of file