PIVX Core  5.6.99
P2P Digital Currency
destination_io.h
Go to the documentation of this file.
1 // Copyright (c) 2020-2021 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or https://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef PIVX_DESTINATION_IO_H
6 #define PIVX_DESTINATION_IO_H
7 
8 #include "chainparams.h"
9 #include "script/standard.h"
10 
11 // Regular + shielded addresses variant.
12 typedef boost::variant<CTxDestination, libzcash::SaplingPaymentAddress> CWDestination;
13 
14 namespace Standard {
15 
16  std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
17 
18  CWDestination DecodeDestination(const std::string& strAddress);
19  CWDestination DecodeDestination(const std::string& strAddress, bool& isStaking, bool& isExchange);
20  CWDestination DecodeDestination(const std::string& strAddress, bool& isStaking, bool& isExchange, bool& isShielded);
21 
22  bool IsValidDestination(const CWDestination& dest);
23 
24  // boost::get wrapper
27 
28 } // End Standard namespace
29 
33 class Destination {
34 public:
35  explicit Destination() {}
36  explicit Destination(const CTxDestination& _dest, bool _isP2CS) : dest(_dest), isP2CS(_isP2CS) {}
37  explicit Destination(const CTxDestination& _dest, bool _isP2CS, bool _isEXCHANGE = false) : dest(_dest), isP2CS(_isP2CS), isExchange(_isEXCHANGE) {}
38  explicit Destination(const libzcash::SaplingPaymentAddress& _dest) : dest(_dest) {}
39 
41  bool isP2CS{false};
42  bool isExchange{false};
43 
44  Destination& operator=(const Destination& from);
45  // Returns the key ID if Destination is a transparent "regular" destination
46  const CKeyID* getKeyID();
47  // Returns the encoded string address
48  std::string ToString() const;
49 };
50 
51 #endif // PIVX_DESTINATION_IO_H
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:21
Wrapper class for every supported address.
Destination(const libzcash::SaplingPaymentAddress &_dest)
const CKeyID * getKeyID()
Destination(const CTxDestination &_dest, bool _isP2CS)
Destination & operator=(const Destination &from)
Destination(const CTxDestination &_dest, bool _isP2CS, bool _isEXCHANGE=false)
CWDestination dest
std::string ToString() const
Sapling functions.
Definition: address.h:30
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
const CTxDestination * GetTransparentDestination(const CWDestination &dest)
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
const libzcash::SaplingPaymentAddress * GetShieldedDestination(const CWDestination &dest)
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:72