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