Bitcoin Core 28.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-2022 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
9#include <addresstype.h>
11
12#include <array>
13#include <optional>
14#include <string>
15#include <vector>
16
17enum class OutputType {
18 LEGACY,
20 BECH32,
21 BECH32M,
22 UNKNOWN,
23};
24
25static constexpr auto OUTPUT_TYPES = std::array{
30};
31
32std::optional<OutputType> ParseOutputType(const std::string& str);
33const std::string& FormatOutputType(OutputType type);
34
40
42std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
43
50
52std::optional<OutputType> OutputTypeFromDestination(const CTxDestination& dest);
53
54#endif // BITCOIN_OUTPUTTYPE_H
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
Definition: addresstype.h:140
An encapsulated public key.
Definition: pubkey.h:34
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:415
std::optional< OutputType > ParseOutputType(const std::string &str)
Definition: outputtype.cpp:24
std::optional< OutputType > OutputTypeFromDestination(const CTxDestination &dest)
Get the OutputType for a CTxDestination.
Definition: outputtype.cpp:110
OutputType
Definition: outputtype.h:17
std::vector< CTxDestination > GetAllDestinationsForKey(const CPubKey &key)
Get all destinations (potentially) supported by the wallet for the given key.
Definition: outputtype.cpp:71
CTxDestination AddAndGetDestinationForScript(FlatSigningProvider &keystore, const CScript &script, OutputType)
Get a destination of the requested type (if possible) to the specified script.
Definition: outputtype.cpp:84
const std::string & FormatOutputType(OutputType type)
Definition: outputtype.cpp:38
CTxDestination GetDestinationForKey(const CPubKey &key, OutputType)
Get a destination of the requested type (if possible) to the specified key.
Definition: outputtype.cpp:50
static constexpr auto OUTPUT_TYPES
Definition: outputtype.h:25