Repository navigation
Expand file tree
/
Copy pathexport.h
More file actions
37 lines (30 loc) · 1.44 KB
/
Copy pathexport.h
File metadata and controls
37 lines (30 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2026-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_WALLET_EXPORT_H
#define BITCOIN_WALLET_EXPORT_H
#include <threadsafety.h>
#include <util/expected.h>
#include <wallet/wallet.h>
#include <optional>
#include <vector>
namespace wallet {
// Struct containing all of the info from WalletDescriptor, except with the descriptor as a string,
// and without its ID.
// Used when exporting descriptors from the wallet.
struct WalletDescInfo {
std::string descriptor;
uint64_t creation_time;
bool active;
std::optional<bool> internal;
std::optional<std::pair<int64_t,int64_t>> range;
int64_t next_index;
DescriptorCache cache;
};
//! Export the descriptors from a wallet so that they can be imported elsewhere
util::Expected<std::vector<WalletDescInfo>, std::string> ExportDescriptors(const CWallet& wallet, bool export_private) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
//! Make a new watchonly wallet file containing the public descriptors from this wallet
//! The exported watchonly wallet file will be named and placed at the path specified in 'destination'
util::Result<std::string> ExportWatchOnlyWallet(const CWallet& wallet, const fs::path& destination, WalletContext& context) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
} // namespace wallet
#endif // BITCOIN_WALLET_EXPORT_H