Changeset View
Changeset View
Standalone View
Standalone View
src/cashaddrenc.h
// Copyright (c) 2017-2019 The Bitcoin developers | // Copyright (c) 2017-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_CASHADDRENC_H | #ifndef BITCOIN_CASHADDRENC_H | ||||
#define BITCOIN_CASHADDRENC_H | #define BITCOIN_CASHADDRENC_H | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <serialize.h> | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
class CChainParams; | class CChainParams; | ||||
enum CashAddrType : uint8_t { PUBKEY_TYPE = 0, SCRIPT_TYPE = 1 }; | enum CashAddrType : uint8_t { PUBKEY_TYPE = 0, SCRIPT_TYPE = 1 }; | ||||
struct CashAddrContent { | struct CashAddrContent { | ||||
CashAddrType type; | CashAddrType type; | ||||
std::vector<uint8_t> hash; | std::vector<uint8_t> hash; | ||||
SERIALIZE_METHODS(CashAddrContent, obj) { | |||||
READWRITE(Using<CustomUintFormatter<1>>(obj.type), obj.hash); | |||||
} | |||||
}; | }; | ||||
std::string EncodeCashAddr(const CTxDestination &, const CChainParams &); | std::string EncodeCashAddr(const CTxDestination &, const CChainParams &); | ||||
std::string EncodeCashAddr(const std::string &prefix, | std::string EncodeCashAddr(const std::string &prefix, | ||||
const CashAddrContent &content); | const CashAddrContent &content); | ||||
CTxDestination DecodeCashAddr(const std::string &addr, | CTxDestination DecodeCashAddr(const std::string &addr, | ||||
const CChainParams ¶ms); | const CChainParams ¶ms); | ||||
CashAddrContent DecodeCashAddrContent(const std::string &addr, | CashAddrContent DecodeCashAddrContent(const std::string &addr, | ||||
const std::string &prefix); | const std::string &prefix); | ||||
CTxDestination DecodeCashAddrDestination(const CashAddrContent &content); | CTxDestination DecodeCashAddrDestination(const CashAddrContent &content); | ||||
std::vector<uint8_t> PackCashAddrContent(const CashAddrContent &content); | std::vector<uint8_t> PackCashAddrContent(const CashAddrContent &content); | ||||
#endif // BITCOIN_CASHADDRENC_H | #endif // BITCOIN_CASHADDRENC_H |