mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
rpc: expose RPC metadata for introspection
This commit is contained in:
@@ -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};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user