rpc: expose RPC metadata for introspection

This commit is contained in:
will
2026-03-10 10:52:49 +00:00
parent 6a1a66c180
commit 26c221a980
3 changed files with 6 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ public:
fn().GetArgNames(),
intptr_t(fn))
{
this->metadata_fn = fn;
}
std::string category;
@@ -79,6 +80,7 @@ public:
//! appended after other arguments, see transformNamedArguments for details.
std::vector<std::pair<std::string, bool>> argNames;
intptr_t unique_id;
RpcMethodFnType metadata_fn{nullptr};
};
/**

View File

@@ -518,6 +518,9 @@ public:
bool IsValidNumArgs(size_t num_args) const;
//! Return list of arguments and whether they are named-only.
std::vector<std::pair<std::string, bool>> GetArgNames() const;
const std::string& GetDescription() const { return m_description; }
const std::vector<RPCArg>& GetArgs() const { return m_args; }
const RPCResults& GetResults() const { return m_results; }
const std::string m_name;

View File

@@ -544,6 +544,7 @@ public:
wallet_request.context = &m_context;
return command.actor(wallet_request, result, last_handler);
}, command.argNames, command.unique_id);
m_rpc_commands.back().metadata_fn = command.metadata_fn;
m_rpc_handlers.emplace_back(m_context.chain->handleRpc(m_rpc_commands.back()));
}
}