Delete more CCs #381

This commit is contained in:
Duke
2024-02-10 22:56:34 -05:00
parent 958bc486d4
commit b41785a684
6 changed files with 4 additions and 202 deletions

View File

@@ -1508,71 +1508,6 @@ UniValue txnotarizedconfirmed(const UniValue& params, bool fHelp, const CPubKey&
return result;
}
UniValue decodeccopret(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
CTransaction tx; uint256 tokenid,txid,hashblock;
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,tokenevalcode;
UniValue result(UniValue::VOBJ),array(UniValue::VARR); std::vector<CPubKey> pubkeys;
if (fHelp || params.size() < 1 || params.size() > 1)
{
string msg = "decodeccopret scriptPubKey\n"
"\nReturns eval code and function id for CC OP RETURN data.\n"
"\nArguments:\n"
"1. scriptPubKey (string, required) Hex of scriptPubKey with OP_RETURN data.\n"
"\nResult:\n"
"{\n"
" eval_code, (string) Eval code name.\n"
" function, (char) Function id char.\n"
"}\n"
;
throw runtime_error(msg);
}
std::vector<unsigned char> hex(ParseHex(params[0].get_str()));
CScript scripthex(hex.begin(),hex.end());
std::vector<std::pair<uint8_t, vscript_t>> oprets;
if (DecodeTokenOpRet(scripthex,tokenevalcode,tokenid,pubkeys, oprets)!=0 && tokenevalcode==EVAL_TOKENS && oprets.size()>0)
{
// seems we need a loop here
vOpretExtra = oprets[0].second;
UniValue obj(UniValue::VOBJ);
GetOpReturnData(scripthex,vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 1)
{
char func[5];
sprintf(func,"%c",script[1]);
obj.push_back(Pair("eval_code", EvalToStr(script[0])));
obj.push_back(Pair("function", func));
}
else
{
obj.push_back(Pair("error", "invalid or no CC opret data for Token OP_RETURN"));
}
array.push_back(obj);
if (!E_UNMARSHAL(vOpretExtra, { ss >> vopret; })) return (0);
}
else GetOpReturnData(scripthex,vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 1)
{
char func[5]; UniValue obj(UniValue::VOBJ);
result.push_back(Pair("result", "success"));
sprintf(func,"%c",script[1]);
obj.push_back(Pair("eval_code", EvalToStr(script[0])));
obj.push_back(Pair("function", func));
array.push_back(obj);
result.push_back(Pair("OpRets",array));
}
else
{
result.push_back(Pair("result", "error"));
result.push_back(Pair("error", "invalid or no CC opret data"));
}
return result;
}
static const CRPCCommand commands[] =
{ // category name actor (function) okSafeMode

View File

@@ -406,7 +406,6 @@ static const CRPCCommand vRPCCommands[] =
{ "util", "validateaddress", &validateaddress, true }, /* uses wallet if enabled */
{ "util", "verifymessage", &verifymessage, true },
{ "util", "txnotarizedconfirmed", &txnotarizedconfirmed, true },
{ "util", "decodeccopret", &decodeccopret, true },
{ "util", "estimatefee", &estimatefee, true },
{ "util", "estimatepriority", &estimatepriority, true },
{ "util", "z_validateaddress", &z_validateaddress, true }, /* uses wallet if enabled */

View File

@@ -281,7 +281,6 @@ extern UniValue walletlock(const UniValue& params, bool fHelp, const CPubKey& my
extern UniValue encryptwallet(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue validateaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue txnotarizedconfirmed(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue decodeccopret(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue getdragonjson(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue getnotarysendmany(const UniValue& params, bool fHelp, const CPubKey& mypk);