Bitcoin Core 32.99.0
P2P Digital Currency
imports.h
Go to the documentation of this file.
1// Copyright (c) 2026-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_WALLET_IMPORTS_H
6#define BITCOIN_WALLET_IMPORTS_H
7
8#include <cstdint>
9#include <optional>
10#include <string>
11#include <vector>
12
13#include <util/translation.h>
14#include <wallet/types.h>
15#include <wallet/wallet.h>
16
17namespace wallet {
18
26
27 ImportError(WalletErrorCode r, bilingual_str e, bool is_wallet_error)
28 : wallet_error{r, std::move(e)},
29 is_general_error{is_wallet_error}
30 {};
31};
32
34 std::vector<std::string> warnings;
35 std::optional<ImportError> error;
36
37 bool has_error() const {
38 return error.has_value();
39 }
40
41 ImportResult() = default;
42 ImportResult(WalletErrorCode code, std::string message, std::vector<std::string> warnings = {}, bool general_error = false)
43 : warnings{std::move(warnings)},
44 error{ImportError{code, Untranslated(message), general_error}}
45 {}
46};
47
50 std::string descriptor;
51 std::string label;
52 std::optional<int64_t> timestamp; // Unset timestamps are treated as now.
53 bool active{false};
54 std::optional<bool> internal;
55 std::optional<std::pair<int64_t, int64_t>> range;
56 std::optional<int64_t> next_index;
57};
58
59std::vector<ImportResult> ProcessDescriptorsImport(CWallet& wallet,
60 std::vector<ImportDescriptorRequest>& requests);
61
62} // namespace wallet
63
64#endif // BITCOIN_WALLET_IMPORTS_H
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:313
std::vector< ImportResult > ProcessDescriptorsImport(CWallet &wallet, std::vector< ImportDescriptorRequest > &requests)
Definition: imports.cpp:222
WalletErrorCode
Machine-readable wallet error codes.
Definition: types.h:66
Bilingual messages:
Definition: translation.h:24
Information about a descriptor to be imported.
Definition: imports.h:49
std::optional< int64_t > timestamp
Definition: imports.h:52
std::optional< int64_t > next_index
Definition: imports.h:56
std::optional< bool > internal
Definition: imports.h:54
std::optional< std::pair< int64_t, int64_t > > range
Definition: imports.h:55
bool is_general_error
Set to true when a wallet-wide precondition failed before any descriptor was processed (e....
Definition: imports.h:25
WalletError wallet_error
Definition: imports.h:20
ImportError(WalletErrorCode r, bilingual_str e, bool is_wallet_error)
Definition: imports.h:27
std::optional< ImportError > error
Definition: imports.h:35
bool has_error() const
Definition: imports.h:37
std::vector< std::string > warnings
Definition: imports.h:34
ImportResult(WalletErrorCode code, std::string message, std::vector< std::string > warnings={}, bool general_error=false)
Definition: imports.h:42
Wallet-layer error with both programmatic and user-facing information.
Definition: types.h:87
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:82
is a home for public enum and struct type definitions that are used by internally by wallet code,...