convert vobj to string in cclib rpc to allow passing json param as vobj
This commit is contained in:
@@ -5564,6 +5564,8 @@ UniValue cclibinfo(const UniValue& params, bool fHelp)
|
|||||||
UniValue cclib(const UniValue& params, bool fHelp)
|
UniValue cclib(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
struct CCcontract_info *cp,C; char *method,*jsonstr=0; uint8_t evalcode = EVAL_FIRSTUSER;
|
struct CCcontract_info *cp,C; char *method,*jsonstr=0; uint8_t evalcode = EVAL_FIRSTUSER;
|
||||||
|
std::string vobjJsonSerialized;
|
||||||
|
|
||||||
if ( fHelp || params.size() > 3 )
|
if ( fHelp || params.size() > 3 )
|
||||||
throw runtime_error("cclib method [evalcode] [JSON params]\n");
|
throw runtime_error("cclib method [evalcode] [JSON params]\n");
|
||||||
if ( ASSETCHAINS_CCLIB.size() == 0 )
|
if ( ASSETCHAINS_CCLIB.size() == 0 )
|
||||||
@@ -5583,7 +5585,12 @@ UniValue cclib(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
if ( params.size() == 3 )
|
if ( params.size() == 3 )
|
||||||
{
|
{
|
||||||
jsonstr = (char *)params[2].get_str().c_str();
|
if (params[2].getType() == UniValue::VOBJ) {
|
||||||
|
vobjJsonSerialized = params[2].write(0, 0);
|
||||||
|
jsonstr = (char *)vobjJsonSerialized.c_str();
|
||||||
|
}
|
||||||
|
else // VSTR assumed
|
||||||
|
jsonstr = (char *)params[2].get_str().c_str();
|
||||||
//fprintf(stderr,"params.(%s %s %s)\n",params[0].get_str().c_str(),params[1].get_str().c_str(),jsonstr);
|
//fprintf(stderr,"params.(%s %s %s)\n",params[0].get_str().c_str(),params[1].get_str().c_str(),jsonstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user