Initial Vexta Core v0.1.0 release
This commit is contained in:
commit
25c454329d
2481 changed files with 689289 additions and 0 deletions
54
src/outputtype.h
Normal file
54
src/outputtype.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2020 The Bitcoin Core developers
|
||||
// Copyright (c) 2014-2020 The DigiByte Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef DIGIBYTE_OUTPUTTYPE_H
|
||||
#define DIGIBYTE_OUTPUTTYPE_H
|
||||
|
||||
#include <attributes.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum class OutputType {
|
||||
LEGACY,
|
||||
P2SH_SEGWIT,
|
||||
BECH32,
|
||||
BECH32M,
|
||||
};
|
||||
|
||||
static constexpr auto OUTPUT_TYPES = std::array{
|
||||
OutputType::LEGACY,
|
||||
OutputType::P2SH_SEGWIT,
|
||||
OutputType::BECH32,
|
||||
OutputType::BECH32M,
|
||||
};
|
||||
|
||||
[[nodiscard]] bool ParseOutputType(const std::string& str, OutputType& output_type);
|
||||
const std::string& FormatOutputType(OutputType type);
|
||||
|
||||
/**
|
||||
* Get a destination of the requested type (if possible) to the specified key.
|
||||
* The caller must make sure LearnRelatedScripts has been called beforehand.
|
||||
*/
|
||||
CTxDestination GetDestinationForKey(const CPubKey& key, OutputType);
|
||||
|
||||
/** Get all destinations (potentially) supported by the wallet for the given key. */
|
||||
std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
|
||||
|
||||
/**
|
||||
* Get a destination of the requested type (if possible) to the specified script.
|
||||
* This function will automatically add the script (and any other
|
||||
* necessary scripts) to the keystore.
|
||||
*/
|
||||
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
|
||||
|
||||
/** Get the OutputType for a CTxDestination */
|
||||
std::optional<OutputType> OutputTypeFromDestination(const CTxDestination& dest);
|
||||
|
||||
#endif // DIGIBYTE_OUTPUTTYPE_H
|
||||
Loading…
Reference in a new issue