I wrote a new RPC and my parameters are not parsed correctly.
This is the definition of the RPCHelpMan:
return RPCHelpMan{"mycustomrpc",
"\nchange definitions(before the RPC call returns)\n",
{
{"Param1", RPCArg::Type::NUM, RPCArg::Optional::NO, ""},
{"Param2", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
{"Param3", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
{"Param4", RPCArg::Type::NUM, /* default */ ToString(1000), "How many iterations to try."}
},
RPCResult{
RPCResult::Type::ARR, "", "",
{
{RPCResult::Type::STR_HEX, "", "param"},
}},
RPCExamples{
"\nChange definitions to bitcoin core\n"
+ HelpExampleCli("mycustomrpc", "param1 \"param2\" \"param3\" ")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
When I'm running this command from my CLI, I got this error:
error code: -1
error message:
JSON value is not an integer as expected
Can someone tell me what's wrong in the function definition?