Bitcoin Core  23.99.0
P2P Digital Currency
outputtype.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2021 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_OUTPUTTYPE_H
7 #define BITCOIN_OUTPUTTYPE_H
8 
10 #include <script/standard.h>
11 
12 #include <array>
13 #include <optional>
14 #include <string>
15 #include <vector>
16 
17 enum class OutputType {
18  LEGACY,
20  BECH32,
21  BECH32M,
22  UNKNOWN,
23 };
24 
25 static constexpr auto OUTPUT_TYPES = std::array{
31 };
32 
33 std::optional<OutputType> ParseOutputType(const std::string& str);
34 const std::string& FormatOutputType(OutputType type);
35 
41 
43 std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
44 
51 
53 std::optional<OutputType> OutputTypeFromDestination(const CTxDestination& dest);
54 
55 #endif // BITCOIN_OUTPUTTYPE_H
An encapsulated public key.
Definition: pubkey.h:34
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:411
Fillable signing provider that keeps keys in an address->secret map.
const std::string & FormatOutputType(OutputType type)
Definition: outputtype.cpp:41
OutputType
Definition: outputtype.h:17
std::optional< OutputType > ParseOutputType(const std::string &str)
Definition: outputtype.cpp:25
std::vector< CTxDestination > GetAllDestinationsForKey(const CPubKey &key)
Get all destinations (potentially) supported by the wallet for the given key.
Definition: outputtype.cpp:74
std::optional< OutputType > OutputTypeFromDestination(const CTxDestination &dest)
Get the OutputType for a CTxDestination.
Definition: outputtype.cpp:113
CTxDestination GetDestinationForKey(const CPubKey &key, OutputType)
Get a destination of the requested type (if possible) to the specified key.
Definition: outputtype.cpp:53
static constexpr auto OUTPUT_TYPES
Definition: outputtype.h:25
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, const CScript &script, OutputType)
Get a destination of the requested type (if possible) to the specified script.
Definition: outputtype.cpp:87
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:149