7#include <chainparams.h>
19 if (!fs::is_directory(path)) {
27 if (fs::is_directory(path /
"wallets")) {
37 int64_t creation_time =
GetTime();
42 std::string desc_prefix;
43 std::string desc_suffix =
"/*)";
46 desc_prefix =
"pkh(" + xpub +
"/44h";
50 desc_prefix =
"sh(wpkh(" + xpub +
"/49h";
55 desc_prefix =
"wpkh(" + xpub +
"/84h";
59 desc_prefix =
"tr(" + xpub +
"/86h";
68 assert(!desc_prefix.empty());
71 if (
Params().IsTestChain()) {
77 std::string internal_path = internal ?
"/1" :
"/0";
78 std::string desc_str = desc_prefix +
"/0h" + internal_path + desc_suffix;
83 std::vector<std::unique_ptr<Descriptor>> desc =
Parse(desc_str, keys, error,
false);
const CChainParams & Params()
Return the currently selected parameters.
fs::path GetDataDirNet() const
Get data directory path with appended network identifier.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
Descriptor with some wallet metadata.
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
std::string EncodeExtPubKey(const CExtPubKey &key)
fs::path GetWalletDir()
Get the path of the wallet directory.
WalletDescriptor GenerateWalletDescriptor(const CExtPubKey &master_key, const OutputType &addr_type, bool internal)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.