mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
rpc: ParsePathBIP32 helper
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <univalue.h>
|
||||
#include <util/bip32.h>
|
||||
#include <util/check.h>
|
||||
#include <util/result.h>
|
||||
#include <util/strencodings.h>
|
||||
@@ -1379,6 +1380,15 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> ParsePathBIP32(const std::string& path)
|
||||
{
|
||||
std::vector<uint32_t> out;
|
||||
if (!ParseHDKeypath(path, out)) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid BIP32 keypath");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. */
|
||||
[[nodiscard]] static UniValue BilingualStringsToUniValue(const std::vector<bilingual_str>& bilingual_strings)
|
||||
{
|
||||
|
||||
@@ -156,6 +156,9 @@ std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value);
|
||||
/** Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000. */
|
||||
std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, FlatSigningProvider& provider, bool expand_priv = false);
|
||||
|
||||
//! Parse BIP32 path
|
||||
std::vector<uint32_t> ParsePathBIP32(const std::string& path);
|
||||
|
||||
/**
|
||||
* Serializing JSON objects depends on the outer type. Only arrays and
|
||||
* dictionaries can be nested in json. The top-level outer type is "NONE".
|
||||
|
||||
Reference in New Issue
Block a user