diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 40aa1edaea8..68130df88aa 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -28,7 +28,7 @@ static RPCMethod rpcNestedTest_rpc() }, RPCResult{RPCResult::Type::ANY, "", ""}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return request.params.write(0, 0); }, }; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 9b7e965ec31..d898cd42806 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -257,7 +257,7 @@ static RPCMethod getblockcount() HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -278,7 +278,7 @@ static RPCMethod getbestblockhash() HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -308,7 +308,7 @@ static RPCMethod waitfornewblock() HelpExampleCli("waitfornewblock", "1000") + HelpExampleRpc("waitfornewblock", "1000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; if (!request.params[0].isNull()) @@ -367,7 +367,7 @@ static RPCMethod waitforblock() HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\" 1000") + HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; @@ -429,7 +429,7 @@ static RPCMethod waitforblockheight() HelpExampleCli("waitforblockheight", "100 1000") + HelpExampleRpc("waitforblockheight", "100, 1000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int timeout = 0; @@ -481,7 +481,7 @@ static RPCMethod syncwithvalidationinterfacequeue() HelpExampleCli("syncwithvalidationinterfacequeue","") + HelpExampleRpc("syncwithvalidationinterfacequeue","") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CHECK_NONFATAL(node.validation_signals)->SyncWithValidationInterfaceQueue(); @@ -502,7 +502,7 @@ static RPCMethod getdifficulty() HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -532,7 +532,7 @@ static RPCMethod getblockfrompeer() HelpExampleCli("getblockfrompeer", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0") + HelpExampleRpc("getblockfrompeer", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -580,7 +580,7 @@ static RPCMethod getblockhash() HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -634,7 +634,7 @@ static RPCMethod getblockheader() HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "hash")); @@ -837,7 +837,7 @@ static RPCMethod getblock() HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -920,7 +920,7 @@ static RPCMethod pruneblockchain() HelpExampleCli("pruneblockchain", "1000") + HelpExampleRpc("pruneblockchain", "1000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); if (!chainman.m_blockman.IsPruneMode()) { @@ -1061,7 +1061,7 @@ static RPCMethod gettxoutsetinfo() HelpExampleRpc("gettxoutsetinfo", R"("none", 1000)") + HelpExampleRpc("gettxoutsetinfo", R"("none", "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09")") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); @@ -1213,7 +1213,7 @@ static RPCMethod gettxout() "\nAs a JSON-RPC call\n" + HelpExampleRpc("gettxout", "\"txid\", 1") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -1275,7 +1275,7 @@ static RPCMethod verifychain() HelpExampleCli("verifychain", "") + HelpExampleRpc("verifychain", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const int check_level{request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].getInt()}; const int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].getInt()}; @@ -1409,7 +1409,7 @@ RPCMethod getblockchaininfo() HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1528,7 +1528,7 @@ RPCMethod getdeploymentinfo() } }, RPCExamples{ HelpExampleCli("getdeploymentinfo", "") + HelpExampleRpc("getdeploymentinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1600,7 +1600,7 @@ static RPCMethod getchaintips() HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -1688,7 +1688,7 @@ static RPCMethod preciousblock() HelpExampleCli("preciousblock", "\"blockhash\"") + HelpExampleRpc("preciousblock", "\"blockhash\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash(ParseHashV(request.params[0], "blockhash")); CBlockIndex* pblockindex; @@ -1748,7 +1748,7 @@ static RPCMethod invalidateblock() HelpExampleCli("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -1794,7 +1794,7 @@ static RPCMethod reconsiderblock() HelpExampleCli("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); uint256 hash(ParseHashV(request.params[0], "blockhash")); @@ -1837,7 +1837,7 @@ static RPCMethod getchaintxstats() HelpExampleCli("getchaintxstats", "") + HelpExampleRpc("getchaintxstats", "2016") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); const CBlockIndex* pindex; @@ -2020,7 +2020,7 @@ static RPCMethod getblockstats() HelpExampleRpc("getblockstats", R"("00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", ["minfeerate","avgfeerate"])") + HelpExampleRpc("getblockstats", R"(1000, ["minfeerate","avgfeerate"])") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); const CBlockIndex& pindex{*CHECK_NONFATAL(ParseHashOrHeight(request.params[0], chainman))}; @@ -2375,7 +2375,7 @@ static RPCMethod scantxoutset() HelpExampleRpc("scantxoutset", "\"status\"") + HelpExampleRpc("scantxoutset", "\"abort\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VOBJ); const auto action{self.Arg("action")}; @@ -2571,7 +2571,7 @@ static RPCMethod scanblocks() HelpExampleRpc("scanblocks", "\"start\", [\"addr(bcrt1q4u4nsgk6ug0sqz7r3rj9tykjxrsl0yy4d0wwte)\"], 100, 150, \"basic\"") + HelpExampleRpc("scanblocks", "\"status\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); auto action{self.Arg("action")}; @@ -2767,7 +2767,7 @@ static RPCMethod getdescriptoractivity() RPCExamples{ HelpExampleCli("getdescriptoractivity", "'[\"000000000000000000001347062c12fded7c528943c8ce133987e2e2f5a840ee\"]' '[\"addr(bc1qzl6nsgqzu89a66l50cvwapnkw5shh23zarqkw9)\"]'") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue ret(UniValue::VOBJ); UniValue activity(UniValue::VARR); @@ -2972,7 +2972,7 @@ static RPCMethod getblockfilter() HelpExampleCli("getblockfilter", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" \"basic\"") + HelpExampleRpc("getblockfilter", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\", \"basic\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 block_hash = ParseHashV(request.params[0], "blockhash"); auto filtertype_name{self.Arg("filtertype")}; @@ -3106,7 +3106,7 @@ static RPCMethod dumptxoutset() HelpExampleCli("-rpcclienttimeout=0 dumptxoutset", "utxo.dat rollback") + HelpExampleCli("-rpcclienttimeout=0 -named dumptxoutset", R"(utxo.dat rollback=853456)") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CBlockIndex* tip{WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Tip())}; @@ -3401,7 +3401,7 @@ static RPCMethod loadtxoutset() RPCExamples{ HelpExampleCli("-rpcclienttimeout=0 loadtxoutset", "utxo.dat") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -3475,7 +3475,7 @@ return RPCMethod{ HelpExampleCli("getchainstates", "") + HelpExampleRpc("getchainstates", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); UniValue obj(UniValue::VOBJ); diff --git a/src/rpc/external_signer.cpp b/src/rpc/external_signer.cpp index 24c3f2f0c74..08226ffb431 100644 --- a/src/rpc/external_signer.cpp +++ b/src/rpc/external_signer.cpp @@ -40,7 +40,7 @@ static RPCMethod enumeratesigners() HelpExampleCli("enumeratesigners", "") + HelpExampleRpc("enumeratesigners", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::string command = gArgs.GetArg("-signer", ""); if (command == "") throw JSONRPCError(RPC_MISC_ERROR, "Error: restart bitcoind with -signer="); diff --git a/src/rpc/fees.cpp b/src/rpc/fees.cpp index 93017a8a9cc..b19826698a3 100644 --- a/src/rpc/fees.cpp +++ b/src/rpc/fees.cpp @@ -60,7 +60,7 @@ static RPCMethod estimatesmartfee() HelpExampleCli("estimatesmartfee", "6") + HelpExampleRpc("estimatesmartfee", "6") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context); const NodeContext& node = EnsureAnyNodeContext(request.context); @@ -149,7 +149,7 @@ static RPCMethod estimaterawfee() RPCExamples{ HelpExampleCli("estimaterawfee", "6 0.9") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context); const NodeContext& node = EnsureAnyNodeContext(request.context); diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index f1efb26c404..f8dce151531 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -87,7 +87,7 @@ static RPCMethod sendrawtransaction() "\nAs a JSON-RPC call\n" + HelpExampleRpc("sendrawtransaction", "\"signedhex\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const CAmount max_burn_amount = request.params[2].isNull() ? 0 : AmountFromValue(request.params[2]); @@ -171,7 +171,7 @@ static RPCMethod getprivatebroadcastinfo() HelpExampleCli("getprivatebroadcastinfo", "") + HelpExampleRpc("getprivatebroadcastinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node{EnsureAnyNodeContext(request.context)}; const PeerManager& peerman{EnsurePeerman(node)}; @@ -232,7 +232,7 @@ static RPCMethod abortprivatebroadcast() HelpExampleCli("abortprivatebroadcast", "\"id\"") + HelpExampleRpc("abortprivatebroadcast", "\"id\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const uint256 id{ParseHashV(self.Arg("id"), "id")}; @@ -315,7 +315,7 @@ static RPCMethod testmempoolaccept() "\nAs a JSON-RPC call\n" + HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue raw_transactions = request.params[0].get_array(); if (raw_transactions.size() < 1 || raw_transactions.size() > MAX_PACKAGE_COUNT) { @@ -629,7 +629,7 @@ static RPCMethod getmempoolfeeratediagram() HelpExampleCli("getmempoolfeeratediagram", "") + HelpExampleRpc("getmempoolfeeratediagram", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const CTxMemPool& mempool = EnsureAnyMemPool(request.context); LOCK(mempool.cs); @@ -684,7 +684,7 @@ static RPCMethod getrawmempool() HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[0].isNull()) @@ -723,7 +723,7 @@ static RPCMethod getmempoolancestors() HelpExampleCli("getmempoolancestors", "\"mytxid\"") + HelpExampleRpc("getmempoolancestors", "\"mytxid\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[1].isNull()) @@ -784,7 +784,7 @@ static RPCMethod getmempooldescendants() HelpExampleCli("getmempooldescendants", "\"mytxid\"") + HelpExampleRpc("getmempooldescendants", "\"mytxid\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { bool fVerbose = false; if (!request.params[1].isNull()) @@ -839,7 +839,7 @@ static RPCMethod getmempoolcluster() HelpExampleCli("getmempoolcluster", "txid") + HelpExampleRpc("getmempoolcluster", "txid") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { uint256 hash = ParseHashV(request.params[0], "txid"); @@ -875,7 +875,7 @@ static RPCMethod getmempoolentry() HelpExampleCli("getmempoolentry", "\"mytxid\"") + HelpExampleRpc("getmempoolentry", "\"mytxid\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto txid{Txid::FromUint256(ParseHashV(request.params[0], "txid"))}; @@ -934,7 +934,7 @@ static RPCMethod gettxspendingprevout() + HelpExampleRpc("gettxspendingprevout", "\"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":3}]\"") + HelpExampleCliNamed("gettxspendingprevout", {{"outputs", "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":3}]"}, {"return_spending_tx", true}}) }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue& output_params = request.params[0].get_array(); if (output_params.empty()) { @@ -1093,7 +1093,7 @@ static RPCMethod getmempoolinfo() HelpExampleCli("getmempoolinfo", "") + HelpExampleRpc("getmempoolinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return MempoolInfoToJSON(EnsureAnyMemPool(request.context)); }, @@ -1130,7 +1130,7 @@ static RPCMethod importmempool() }, RPCResult{RPCResult::Type::OBJ, "", "", std::vector{}}, RPCExamples{HelpExampleCli("importmempool", "/path/to/mempool.dat") + HelpExampleRpc("importmempool", "/path/to/mempool.dat")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node{EnsureAnyNodeContext(request.context)}; CTxMemPool& mempool{EnsureMemPool(node)}; @@ -1176,7 +1176,7 @@ static RPCMethod savemempool() HelpExampleCli("savemempool", "") + HelpExampleRpc("savemempool", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const ArgsManager& args{EnsureAnyArgsman(request.context)}; const CTxMemPool& mempool = EnsureAnyMemPool(request.context); @@ -1266,7 +1266,7 @@ static RPCMethod getorphantxs() HelpExampleCli("getorphantxs", "2") + HelpExampleRpc("getorphantxs", "2") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); PeerManager& peerman = EnsurePeerman(node); @@ -1355,7 +1355,7 @@ static RPCMethod submitpackage() HelpExampleRpc("submitpackage", R"(["raw-parent-tx-1", "raw-parent-tx-2", "raw-child-tx"])") + HelpExampleCli("submitpackage", R"('["raw-tx-without-unconfirmed-parents"]')") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const UniValue raw_transactions = request.params[0].get_array(); if (raw_transactions.empty() || raw_transactions.size() > MAX_PACKAGE_COUNT) { diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index f0d31ec0ef4..dcf5ee26457 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -125,7 +125,7 @@ static RPCMethod getnetworkhashps() HelpExampleCli("getnetworkhashps", "") + HelpExampleRpc("getnetworkhashps", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { ChainstateManager& chainman = EnsureAnyChainman(request.context); LOCK(cs_main); @@ -234,7 +234,7 @@ static RPCMethod generatetodescriptor() }, RPCExamples{ "\nGenerate 11 blocks to mydesc\n" + HelpExampleCli("generatetodescriptor", "11 \"mydesc\"")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto num_blocks{self.Arg("num_blocks")}; const auto max_tries{self.Arg("maxtries")}; @@ -256,7 +256,7 @@ static RPCMethod generatetodescriptor() static RPCMethod generate() { - return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString()); }}; } @@ -281,7 +281,7 @@ static RPCMethod generatetoaddress() + "If you are using the " CLIENT_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n" + HelpExampleCli("getnewaddress", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const int num_blocks{request.params[0].getInt()}; const uint64_t max_tries{request.params[2].isNull() ? DEFAULT_MAX_TRIES : request.params[2].getInt()}; @@ -329,7 +329,7 @@ static RPCMethod generateblock() "\nGenerate a block to myaddress, with txs rawtx and mempool_txid\n" + HelpExampleCli("generateblock", R"("myaddress" '["rawtx", "mempool_txid"]')") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto address_or_descriptor = request.params[0].get_str(); CScript coinbase_output_script; @@ -453,7 +453,7 @@ static RPCMethod getmininginfo() HelpExampleCli("getmininginfo", "") + HelpExampleRpc("getmininginfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CTxMemPool& mempool = EnsureMemPool(node); @@ -518,7 +518,7 @@ static RPCMethod prioritisetransaction() HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); @@ -563,7 +563,7 @@ static RPCMethod getprioritisedtransactions() HelpExampleCli("getprioritisedtransactions", "") + HelpExampleRpc("getprioritisedtransactions", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CTxMemPool& mempool = EnsureMemPool(node); @@ -704,7 +704,7 @@ static RPCMethod getblocktemplate() HelpExampleCli("getblocktemplate", "'{\"rules\": [\"segwit\"]}'") + HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -1072,7 +1072,7 @@ static RPCMethod submitblock() HelpExampleCli("submitblock", "\"mydata\"") + HelpExampleRpc("submitblock", "\"mydata\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr blockptr = std::make_shared(); CBlock& block = *blockptr; @@ -1120,7 +1120,7 @@ static RPCMethod submitheader() HelpExampleCli("submitheader", "\"aabbcc\"") + HelpExampleRpc("submitheader", "\"aabbcc\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CBlockHeader h; if (!DecodeHexBlockHeader(h, request.params[0].get_str())) { diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 06fc4cb18ce..f93e6337037 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -71,7 +71,7 @@ static RPCMethod getconnectioncount() HelpExampleCli("getconnectioncount", "") + HelpExampleRpc("getconnectioncount", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -94,7 +94,7 @@ static RPCMethod ping() HelpExampleCli("ping", "") + HelpExampleRpc("ping", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); PeerManager& peerman = EnsurePeerman(node); @@ -201,7 +201,7 @@ static RPCMethod getpeerinfo() HelpExampleCli("getpeerinfo", "") + HelpExampleRpc("getpeerinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -330,7 +330,7 @@ static RPCMethod addnode() HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\" true") + HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\" true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const auto command{self.Arg("command")}; if (command != "onetry" && command != "add" && command != "remove") { @@ -394,7 +394,7 @@ static RPCMethod addconnection() HelpExampleCli("addconnection", "\"192.168.0.6:8333\" \"outbound-full-relay\" true") + HelpExampleRpc("addconnection", "\"192.168.0.6:8333\" \"outbound-full-relay\" true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (Params().GetChainType() != ChainType::REGTEST) { throw std::runtime_error("addconnection is for regression testing (-regtest mode) only."); @@ -455,7 +455,7 @@ static RPCMethod disconnectnode() + HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"") + HelpExampleRpc("disconnectnode", "\"\", 1") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node); @@ -514,7 +514,7 @@ static RPCMethod getaddednodeinfo() HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"") + HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -584,7 +584,7 @@ static RPCMethod getnettotals() HelpExampleCli("getnettotals", "") + HelpExampleRpc("getnettotals", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -684,7 +684,7 @@ static RPCMethod getnetworkinfo() HelpExampleCli("getnetworkinfo", "") + HelpExampleRpc("getnetworkinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(cs_main); UniValue obj(UniValue::VOBJ); @@ -750,7 +750,7 @@ static RPCMethod setban() + HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"") + HelpExampleRpc("setban", "\"192.168.0.6\", \"add\", 86400") }, - [&](const RPCMethod& help, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& help, const JSONRPCRequest& request) -> UniValue { auto command{help.Arg("command")}; if (command != "add" && command != "remove") { @@ -834,7 +834,7 @@ static RPCMethod listbanned() HelpExampleCli("listbanned", "") + HelpExampleRpc("listbanned", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BanMan& banman = EnsureAnyBanman(request.context); @@ -872,7 +872,7 @@ static RPCMethod clearbanned() HelpExampleCli("clearbanned", "") + HelpExampleRpc("clearbanned", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BanMan& banman = EnsureAnyBanman(request.context); @@ -893,7 +893,7 @@ static RPCMethod setnetworkactive() }, RPCResult{RPCResult::Type::BOOL, "", "The value that was passed in"}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node); @@ -935,7 +935,7 @@ static RPCMethod getnodeaddresses() + HelpExampleRpc("getnodeaddresses", "8") + HelpExampleRpc("getnodeaddresses", "4, \"i2p\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureAnyNodeContext(request.context); const CConnman& connman = EnsureConnman(node); @@ -986,7 +986,7 @@ static RPCMethod addpeeraddress() HelpExampleCli("addpeeraddress", "\"1.2.3.4\" 8333 true") + HelpExampleRpc("addpeeraddress", "\"1.2.3.4\", 8333, true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); @@ -1041,7 +1041,7 @@ static RPCMethod sendmsgtopeer() RPCResult{RPCResult::Type::OBJ, "", "", std::vector{}}, RPCExamples{ HelpExampleCli("sendmsgtopeer", "0 \"addr\" \"ffffff\"") + HelpExampleRpc("sendmsgtopeer", "0 \"addr\" \"ffffff\"")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeId peer_id{request.params[0].getInt()}; const auto msg_type{self.Arg("msg_type")}; if (msg_type.size() > CMessageHeader::MESSAGE_TYPE_SIZE) { @@ -1090,7 +1090,7 @@ static RPCMethod getaddrmaninfo() }}, }}, RPCExamples{HelpExampleCli("getaddrmaninfo", "") + HelpExampleRpc("getaddrmaninfo", "")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); UniValue ret(UniValue::VOBJ); @@ -1177,7 +1177,7 @@ static RPCMethod getrawaddrman() HelpExampleCli("getrawaddrman", "") + HelpExampleRpc("getrawaddrman", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { AddrMan& addrman = EnsureAnyAddrman(request.context); NodeContext& node_context = EnsureAnyNodeContext(request.context); CConnman& connman = EnsureConnman(node_context); diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index 45b597fb118..aad24b0f5b3 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -47,7 +47,7 @@ static RPCMethod setmocktime() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (!Params().IsMockableChain()) { throw std::runtime_error("setmocktime is for regression testing (-regtest mode) only"); @@ -87,7 +87,7 @@ static RPCMethod mockscheduler() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (!Params().IsMockableChain()) { throw std::runtime_error("mockscheduler is for regression testing (-regtest mode) only"); @@ -177,7 +177,7 @@ static RPCMethod getmemoryinfo() HelpExampleCli("getmemoryinfo", "") + HelpExampleRpc("getmemoryinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto mode{self.Arg("mode")}; if (mode == "stats") { @@ -247,7 +247,7 @@ static RPCMethod logging() HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"") + HelpExampleRpc("logging", "[\"all\"], [\"libevent\"]") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BCLog::CategoryMask original_log_categories = LogInstance().GetCategoryMask(); if (request.params[0].isArray()) { @@ -296,7 +296,7 @@ static RPCMethod echo(const std::string& name) }, RPCResult{RPCResult::Type::ANY, "", "Returns whatever was passed in"}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { if (request.params[9].isStr()) { CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug"); @@ -320,7 +320,7 @@ static RPCMethod echoipc() RPCResult{RPCResult::Type::STR, "echo", "The echoed string."}, RPCExamples{HelpExampleCli("echo", "\"Hello world\"") + HelpExampleRpc("echo", "\"Hello world\"")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { interfaces::Init& local_init = *EnsureAnyNodeContext(request.context).init; std::unique_ptr echo; if (interfaces::Ipc* ipc = local_init.ipc()) { @@ -385,7 +385,7 @@ static RPCMethod getindexinfo() + HelpExampleCli("getindexinfo", "txindex") + HelpExampleRpc("getindexinfo", "txindex") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VOBJ); const std::string index_name{self.MaybeArg("index_name").value_or("")}; diff --git a/src/rpc/output_script.cpp b/src/rpc/output_script.cpp index fb04589ff4b..cb73fe54490 100644 --- a/src/rpc/output_script.cpp +++ b/src/rpc/output_script.cpp @@ -55,7 +55,7 @@ static RPCMethod validateaddress() HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") + HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::string error_msg; std::vector error_locations; @@ -118,7 +118,7 @@ static RPCMethod createmultisig() "\nAs a JSON-RPC call\n" + HelpExampleRpc("createmultisig", "2, [\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { int required = request.params[0].getInt(); @@ -192,7 +192,7 @@ static RPCMethod getdescriptorinfo() HelpExampleCli("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") + HelpExampleRpc("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { FlatSigningProvider provider; std::string error; @@ -299,7 +299,7 @@ static RPCMethod deriveaddresses() HelpExampleCli("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\" \"[0,2]\"") + HelpExampleRpc("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\", \"[0,2]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { auto desc_str{self.Arg("descriptor")}; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index cd0f3ea44b6..2a1a4d1a06f 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -279,7 +279,7 @@ static RPCMethod getrawtransaction() + HelpExampleCli("getrawtransaction", "\"mytxid\" 1 \"myblockhash\"") + HelpExampleCli("getrawtransaction", "\"mytxid\" 2 \"myblockhash\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -393,7 +393,7 @@ static RPCMethod createrawtransaction() + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"") + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::optional rbf; if (!request.params[3].isNull()) { @@ -428,7 +428,7 @@ static RPCMethod decoderawtransaction() HelpExampleCli("decoderawtransaction", "\"hexstring\"") + HelpExampleRpc("decoderawtransaction", "\"hexstring\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMutableTransaction mtx; @@ -480,7 +480,7 @@ static RPCMethod decodescript() HelpExampleCli("decodescript", "\"hexstring\"") + HelpExampleRpc("decodescript", "\"hexstring\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue r(UniValue::VOBJ); CScript script; @@ -602,7 +602,7 @@ static RPCMethod combinerawtransaction() RPCExamples{ HelpExampleCli("combinerawtransaction", R"('["myhex1", "myhex2", "myhex3"]')") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue txs = request.params[0].get_array(); @@ -735,7 +735,7 @@ static RPCMethod signrawtransactionwithkey() HelpExampleCli("signrawtransactionwithkey", "\"myhex\" \"[\\\"key1\\\",\\\"key2\\\"]\"") + HelpExampleRpc("signrawtransactionwithkey", "\"myhex\", \"[\\\"key1\\\",\\\"key2\\\"]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMutableTransaction mtx; if (!DecodeHexTx(mtx, request.params[0].get_str())) { @@ -1056,7 +1056,7 @@ static RPCMethod decodepsbt() RPCExamples{ HelpExampleCli("decodepsbt", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions PartiallySignedTransaction psbtx; @@ -1531,7 +1531,7 @@ static RPCMethod combinepsbt() RPCExamples{ HelpExampleCli("combinepsbt", R"('["mybase64_1", "mybase64_2", "mybase64_3"]')") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions std::vector psbtxs; @@ -1583,7 +1583,7 @@ static RPCMethod finalizepsbt() RPCExamples{ HelpExampleCli("finalizepsbt", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions PartiallySignedTransaction psbtx; @@ -1632,7 +1632,7 @@ static RPCMethod createpsbt() RPCExamples{ HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::optional rbf; @@ -1687,7 +1687,7 @@ static RPCMethod converttopsbt() "\nConvert the transaction to a PSBT\n" + HelpExampleCli("converttopsbt", "\"rawtransaction\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // parse hex string from parameter CMutableTransaction tx; @@ -1749,7 +1749,7 @@ static RPCMethod utxoupdatepsbt() RPCExamples { HelpExampleCli("utxoupdatepsbt", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Parse descriptors, if any. FlatSigningProvider provider; @@ -1793,7 +1793,7 @@ static RPCMethod joinpsbts() RPCExamples { HelpExampleCli("joinpsbts", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transactions std::vector psbtxs; @@ -1920,7 +1920,7 @@ static RPCMethod analyzepsbt() RPCExamples { HelpExampleCli("analyzepsbt", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Unserialize the transaction PartiallySignedTransaction psbtx; @@ -2025,7 +2025,7 @@ RPCMethod descriptorprocesspsbt() HelpExampleCli("descriptorprocesspsbt", "\"psbt\" \"[\\\"descriptor1\\\", \\\"descriptor2\\\"]\"") + HelpExampleCli("descriptorprocesspsbt", "\"psbt\" \"[{\\\"desc\\\":\\\"mydescriptor\\\", \\\"range\\\":21}]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { // Add descriptor information to a signing provider FlatSigningProvider provider; diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 77fc170da2a..0894ba1cdfe 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -129,7 +129,7 @@ static RPCMethod help() RPCResult{RPCResult::Type::ANY, "", ""}, }, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue { auto command{self.MaybeArg("command")}; if (command == "dump_all_command_conversions") { @@ -156,7 +156,7 @@ static RPCMethod stop() }, RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& jsonRequest) -> UniValue { // Event loop will exit after current HTTP requests have been handled, so // this reply will get back to the client. @@ -182,7 +182,7 @@ static RPCMethod uptime() HelpExampleCli("uptime", "") + HelpExampleRpc("uptime", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { return TicksSeconds(GetUptime()); } @@ -212,7 +212,7 @@ static RPCMethod getrpcinfo() RPCExamples{ HelpExampleCli("getrpcinfo", "") + HelpExampleRpc("getrpcinfo", "")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { LOCK(g_rpc_server_info.mutex); UniValue active_commands(UniValue::VARR); diff --git a/src/rpc/signmessage.cpp b/src/rpc/signmessage.cpp index 97a9f7d1950..df56e09fe0c 100644 --- a/src/rpc/signmessage.cpp +++ b/src/rpc/signmessage.cpp @@ -36,7 +36,7 @@ static RPCMethod verifymessage() "\nAs a JSON-RPC call\n" + HelpExampleRpc("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { switch (MessageVerify(std::string{self.Arg("address")}, std::string{self.Arg("signature")}, @@ -79,7 +79,7 @@ static RPCMethod signmessagewithprivkey() "\nAs a JSON-RPC call\n" + HelpExampleRpc("signmessagewithprivkey", "\"privkey\", \"my message\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::string strPrivkey = request.params[0].get_str(); std::string strMessage = request.params[1].get_str(); diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp index d987e77b3e3..f68f53f665d 100644 --- a/src/rpc/txoutproof.cpp +++ b/src/rpc/txoutproof.cpp @@ -41,7 +41,7 @@ static RPCMethod gettxoutproof() RPCResult::Type::STR, "data", "A string that is a serialized, hex-encoded data for the proof." }, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::set setTxids; UniValue txids = request.params[0].get_array(); @@ -142,7 +142,7 @@ static RPCMethod verifytxoutproof() } }, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { CMerkleBlock merkleBlock; SpanReader{ParseHexV(request.params[0], "proof")} >> merkleBlock; diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 14d314618dc..1b6dbda0d92 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(rpc_arg_helper) }; //! Check that `self.Arg` returns the same value as the `request.params` accessors - RPCMethod::RPCMethodImpl check_positional = [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { + RPCMethod::RPCMethodImpl check_positional = [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { BOOST_CHECK_EQUAL(self.Arg("req_int"), request.params[0].getInt()); BOOST_CHECK_EQUAL(self.Arg("req_str"), request.params[1].get_str()); BOOST_CHECK_EQUAL(self.Arg("def_uint64_t"), request.params[2].isNull() ? DEFAULT_UINT64_T : request.params[2].getInt()); diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index 948bb4d3973..ed966d89441 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -36,7 +36,7 @@ RPCMethod getnewaddress() HelpExampleCli("getnewaddress", "") + HelpExampleRpc("getnewaddress", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -85,7 +85,7 @@ RPCMethod getrawchangeaddress() HelpExampleCli("getrawchangeaddress", "") + HelpExampleRpc("getrawchangeaddress", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -129,7 +129,7 @@ RPCMethod setlabel() HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"") + HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -180,7 +180,7 @@ RPCMethod listaddressgroupings() HelpExampleCli("listaddressgroupings", "") + HelpExampleRpc("listaddressgroupings", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -229,7 +229,7 @@ RPCMethod keypoolrefill() HelpExampleCli("keypoolrefill", "") + HelpExampleRpc("keypoolrefill", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -420,7 +420,7 @@ RPCMethod getaddressinfo() HelpExampleCli("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") + HelpExampleRpc("getaddressinfo", "\"" + EXAMPLE_ADDRESS[0] + "\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -533,7 +533,7 @@ RPCMethod getaddressesbylabel() HelpExampleCli("getaddressesbylabel", "\"tabby\"") + HelpExampleRpc("getaddressesbylabel", "\"tabby\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -597,7 +597,7 @@ RPCMethod listlabels() "\nAs a JSON-RPC call\n" + HelpExampleRpc("listlabels", "receive") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -645,7 +645,7 @@ RPCMethod walletdisplayaddress() } }, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index 1e39caf5b59..9edebbc152f 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -47,7 +47,7 @@ RPCMethod importprunedfunds() }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -105,7 +105,7 @@ RPCMethod removeprunedfunds() "\nAs a JSON-RPC call\n" + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -353,7 +353,7 @@ RPCMethod importdescriptors() "{ \"desc\": \"\", \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + HelpExampleCli("importdescriptors", "'[{ \"desc\": \"\", \"timestamp\":1455191478, \"active\": true, \"range\": [0,100], \"label\": \"\" }]'") }, - [&](const RPCMethod& self, const JSONRPCRequest& main_request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& main_request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(main_request); if (!pwallet) return UniValue::VNULL; @@ -491,7 +491,7 @@ RPCMethod listdescriptors() HelpExampleCli("listdescriptors", "") + HelpExampleRpc("listdescriptors", "") + HelpExampleCli("listdescriptors", "true") + HelpExampleRpc("listdescriptors", "true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; @@ -584,7 +584,7 @@ RPCMethod backupwallet() HelpExampleCli("backupwallet", "\"backup.dat\"") + HelpExampleRpc("backupwallet", "\"backup.dat\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -634,7 +634,7 @@ RPCMethod restorewallet() + HelpExampleCliNamed("restorewallet", {{"wallet_name", "testwallet"}, {"backup_file", "home\\backups\\backup-file.bak\""}, {"load_on_startup", true}}) + HelpExampleRpcNamed("restorewallet", {{"wallet_name", "testwallet"}, {"backup_file", "home\\backups\\backup-file.bak\""}, {"load_on_startup", true}}) }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { WalletContext& context = EnsureWalletContext(request.context); diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp index c9215341ac2..79889b5a38d 100644 --- a/src/wallet/rpc/coins.cpp +++ b/src/wallet/rpc/coins.cpp @@ -102,7 +102,7 @@ RPCMethod getreceivedbyaddress() "\nAs a JSON-RPC call\n" + HelpExampleRpc("getreceivedbyaddress", "\"" + EXAMPLE_ADDRESS[0] + "\", 6") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -144,7 +144,7 @@ RPCMethod getreceivedbylabel() "\nAs a JSON-RPC call\n" + HelpExampleRpc("getreceivedbylabel", "\"tabby\", 6, true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -185,7 +185,7 @@ RPCMethod getbalance() "\nAs a JSON-RPC call\n" + HelpExampleRpc("getbalance", "\"*\", 6") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -255,7 +255,7 @@ RPCMethod lockunspent() "\nAs a JSON-RPC call\n" + HelpExampleRpc("lockunspent", "false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -373,7 +373,7 @@ RPCMethod listlockunspent() "\nAs a JSON-RPC call\n" + HelpExampleRpc("listlockunspent", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -420,7 +420,7 @@ RPCMethod getbalances() RPCExamples{ HelpExampleCli("getbalances", "") + HelpExampleRpc("getbalances", "")}, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr rpc_wallet = GetWalletForJSONRPCRequest(request); if (!rpc_wallet) return UniValue::VNULL; @@ -517,7 +517,7 @@ RPCMethod listunspent() + HelpExampleCli("listunspent", "6 9999999 '[]' true '{ \"minimumAmount\": 0.005 }'") + HelpExampleRpc("listunspent", "6, 9999999, [] , true, { \"minimumAmount\": 0.005 } ") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/encrypt.cpp b/src/wallet/rpc/encrypt.cpp index 1ccf28e7868..68a80eb80e1 100644 --- a/src/wallet/rpc/encrypt.cpp +++ b/src/wallet/rpc/encrypt.cpp @@ -32,7 +32,7 @@ RPCMethod walletpassphrase() "\nAs a JSON-RPC call\n" + HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; @@ -129,7 +129,7 @@ RPCMethod walletpassphrasechange() HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -194,7 +194,7 @@ RPCMethod walletlock() "\nAs a JSON-RPC call\n" + HelpExampleRpc("walletlock", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -247,7 +247,7 @@ RPCMethod encryptwallet() "\nAs a JSON-RPC call\n" + HelpExampleRpc("encryptwallet", "\"my pass phrase\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/signmessage.cpp b/src/wallet/rpc/signmessage.cpp index 28e4d8303db..bd49f3e393c 100644 --- a/src/wallet/rpc/signmessage.cpp +++ b/src/wallet/rpc/signmessage.cpp @@ -34,7 +34,7 @@ RPCMethod signmessage() "\nAs a JSON-RPC call\n" + HelpExampleRpc("signmessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"my message\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 66eb002f6b2..c258c541ee4 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -285,7 +285,7 @@ RPCMethod sendtoaddress() + HelpExampleCli("-named sendtoaddress", "address=\"" + EXAMPLE_ADDRESS[0] + "\" amount=0.5 fee_rate=25") + HelpExampleCli("-named sendtoaddress", "address=\"" + EXAMPLE_ADDRESS[0] + "\" amount=0.5 fee_rate=25 subtractfeefromamount=false replaceable=true avoid_reuse=true comment=\"2 pizzas\" comment_to=\"jeremy\" verbose=true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -389,7 +389,7 @@ RPCMethod sendmany() "\nAs a JSON-RPC call\n" + HelpExampleRpc("sendmany", "\"\", {\"" + EXAMPLE_ADDRESS[0] + "\":0.01,\"" + EXAMPLE_ADDRESS[1] + "\":0.02}, 6, \"testing\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -796,7 +796,7 @@ RPCMethod fundrawtransaction() "\nSend the transaction\n" + HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -897,7 +897,7 @@ RPCMethod signrawtransactionwithwallet() HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"") + HelpExampleRpc("signrawtransactionwithwallet", "\"myhex\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -1247,7 +1247,7 @@ RPCMethod send() "Create a transaction that should confirm the next block, with a specific input, and return result without adding to wallet or broadcasting to the network\n" + HelpExampleCli("send", "'{\"" + EXAMPLE_ADDRESS[0] + "\": 0.1}' 1 economical null '{\"add_to_wallet\": false, \"inputs\": [{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\", \"vout\":1}]}'") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -1361,7 +1361,7 @@ RPCMethod sendall() "Spend all UTXOs with a fee rate of 1.3 " + CURRENCY_ATOM + "/vB using named arguments and sending a 0.25 " + CURRENCY_UNIT + " to another recipient\n" + HelpExampleCli("-named sendall", "recipients='[{\"" + EXAMPLE_ADDRESS[1] + "\": 0.25}, \""+ EXAMPLE_ADDRESS[0] + "\"]' fee_rate=1.3\n") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet{GetWalletForJSONRPCRequest(request)}; if (!pwallet) return UniValue::VNULL; @@ -1598,7 +1598,7 @@ RPCMethod walletprocesspsbt() RPCExamples{ HelpExampleCli("walletprocesspsbt", "\"psbt\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -1729,7 +1729,7 @@ RPCMethod walletcreatefundedpsbt() + "\nCreate the same PSBT as the above one instead using named arguments:\n" + HelpExampleCli("-named walletcreatefundedpsbt", "outputs=\"[{\\\"" + EXAMPLE_ADDRESS[0] + "\\\":0.5}]\" add_inputs=true fee_rate=2") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/transactions.cpp b/src/wallet/rpc/transactions.cpp index aed56b87682..1a7480b80df 100644 --- a/src/wallet/rpc/transactions.cpp +++ b/src/wallet/rpc/transactions.cpp @@ -222,7 +222,7 @@ RPCMethod listreceivedbyaddress() + HelpExampleRpc("listreceivedbyaddress", "6, true, true") + HelpExampleRpc("listreceivedbyaddress", "6, true, true, \"" + EXAMPLE_ADDRESS[0] + "\", true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -267,7 +267,7 @@ RPCMethod listreceivedbylabel() + HelpExampleCli("listreceivedbylabel", "6 true") + HelpExampleRpc("listreceivedbylabel", "6, true, true, true") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -463,7 +463,7 @@ RPCMethod listtransactions() "\nAs a JSON-RPC call\n" + HelpExampleRpc("listtransactions", "\"*\", 20, 100") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -574,7 +574,7 @@ RPCMethod listsinceblock() + HelpExampleCli("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6") + HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -716,7 +716,7 @@ RPCMethod gettransaction() + HelpExampleCli("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" false true") + HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -793,7 +793,7 @@ RPCMethod abandontransaction() HelpExampleCli("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -841,7 +841,7 @@ RPCMethod rescanblockchain() HelpExampleCli("rescanblockchain", "100000 120000") + HelpExampleRpc("rescanblockchain", "100000, 120000") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -929,7 +929,7 @@ RPCMethod abortrescan() "\nAs a JSON-RPC call\n" + HelpExampleRpc("abortrescan", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index e12081b5a71..4a2f5cf86b7 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -69,7 +69,7 @@ static RPCMethod getwalletinfo() HelpExampleCli("getwalletinfo", "") + HelpExampleRpc("getwalletinfo", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -158,7 +158,7 @@ static RPCMethod listwalletdir() HelpExampleCli("listwalletdir", "") + HelpExampleRpc("listwalletdir", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue wallets(UniValue::VARR); for (const auto& [path, db_type] : ListDatabases(GetWalletDir())) { @@ -195,7 +195,7 @@ static RPCMethod listwallets() HelpExampleCli("listwallets", "") + HelpExampleRpc("listwallets", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue obj(UniValue::VARR); @@ -242,7 +242,7 @@ static RPCMethod loadwallet() + HelpExampleCli("loadwallet", "\"DriveLetter:\\path\\to\\walletname\\\"") + HelpExampleRpc("loadwallet", "\"DriveLetter:\\path\\to\\walletname\\\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { WalletContext& context = EnsureWalletContext(request.context); const std::string name(request.params[0].get_str()); @@ -301,7 +301,7 @@ static RPCMethod setwalletflag() HelpExampleCli("setwalletflag", "avoid_reuse") + HelpExampleRpc("setwalletflag", "\"avoid_reuse\"") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; @@ -374,7 +374,7 @@ static RPCMethod createwallet() + HelpExampleCliNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"load_on_startup", true}}) + HelpExampleRpcNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"load_on_startup", true}}) }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { WalletContext& context = EnsureWalletContext(request.context); uint64_t flags = 0; @@ -450,7 +450,7 @@ static RPCMethod unloadwallet() HelpExampleCli("unloadwallet", "wallet_name") + HelpExampleRpc("unloadwallet", "wallet_name") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::string wallet_name{EnsureUniqueWalletName(request, self.MaybeArg("wallet_name"))}; @@ -513,7 +513,7 @@ RPCMethod simulaterawtransaction() HelpExampleCli("simulaterawtransaction", "[\"myhex\"]") + HelpExampleRpc("simulaterawtransaction", "[\"myhex\"]") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr rpc_wallet = GetWalletForJSONRPCRequest(request); if (!rpc_wallet) return UniValue::VNULL; @@ -607,7 +607,7 @@ static RPCMethod migratewallet() HelpExampleCli("migratewallet", "") + HelpExampleRpc("migratewallet", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::string wallet_name{EnsureUniqueWalletName(request, self.MaybeArg("wallet_name"))}; @@ -669,7 +669,7 @@ RPCMethod gethdkeys() HelpExampleCli("gethdkeys", "") + HelpExampleRpc("gethdkeys", "") + HelpExampleCliNamed("gethdkeys", {{"active_only", "true"}, {"private", "true"}}) + HelpExampleRpcNamed("gethdkeys", {{"active_only", "true"}, {"private", "true"}}) }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr wallet = GetWalletForJSONRPCRequest(request); if (!wallet) return UniValue::VNULL; @@ -767,7 +767,7 @@ static RPCMethod createwalletdescriptor() HelpExampleCli("createwalletdescriptor", "bech32m") + HelpExampleRpc("createwalletdescriptor", "bech32m") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) return UniValue::VNULL; diff --git a/src/zmq/zmqrpc.cpp b/src/zmq/zmqrpc.cpp index b75c84136c4..7c3dc29afab 100644 --- a/src/zmq/zmqrpc.cpp +++ b/src/zmq/zmqrpc.cpp @@ -41,7 +41,7 @@ static RPCMethod getzmqnotifications() HelpExampleCli("getzmqnotifications", "") + HelpExampleRpc("getzmqnotifications", "") }, - [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue + [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VARR); if (g_zmq_notification_interface != nullptr) {