refactor: move verbosity parsing to rpc/util

Provides a common way for rpcs to obtain
verbosity from an rpc parameter
This commit is contained in:
tdb3
2024-09-18 12:28:43 -04:00
parent 532491faf1
commit f511ff3654
4 changed files with 23 additions and 17 deletions

View File

@@ -100,6 +100,15 @@ uint256 ParseHashO(const UniValue& o, std::string_view strKey);
std::vector<unsigned char> ParseHexV(const UniValue& v, std::string_view name);
std::vector<unsigned char> ParseHexO(const UniValue& o, std::string_view strKey);
/**
* Parses verbosity from provided UniValue.
*
* @param[in] arg The verbosity argument as a bool (true) or int (0, 1, 2,...)
* @param[in] default_verbosity The value to return if verbosity argument is null
* @returns An integer describing the verbosity level (e.g. 0, 1, 2, etc.)
*/
int ParseVerbosity(const UniValue& arg, int default_verbosity);
/**
* Validate and return a CAmount from a UniValue number or string.
*