forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 719
/
Copy pathdestination_io.h
49 lines (36 loc) · 1.72 KB
/
destination_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#ifndef DESTINATION_IO_H
#define DESTINATION_IO_H
#include "chainparams.h"
#include "script/standard.h"
// Regular + shielded addresses variant.
typedef boost::variant<CTxDestination, libzcash::SaplingPaymentAddress> CWDestination;
namespace Standard {
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
CWDestination DecodeDestination(const std::string& strAddress);
CWDestination DecodeDestination(const std::string& strAddress, bool& isStaking);
CWDestination DecodeDestination(const std::string& strAddress, bool& isStaking, bool& isShielded);
bool IsValidDestination(const CWDestination& dest);
// boost::get wrapper
const libzcash::SaplingPaymentAddress* GetShieldedDestination(const CWDestination& dest);
const CTxDestination * GetTransparentDestination(const CWDestination& dest);
} // End Standard namespace
/**
* Wrapper class for every supported address
*/
class Destination {
public:
explicit Destination() {}
explicit Destination(const CTxDestination& _dest, bool _isP2CS) : dest(_dest), isP2CS(_isP2CS) {}
explicit Destination(const libzcash::SaplingPaymentAddress& _dest) : dest(_dest) {}
CWDestination dest{CNoDestination()};
bool isP2CS{false};
Destination& operator=(const Destination& from);
// Returns the key ID if Destination is a transparent "regular" destination
const CKeyID* getKeyID();
// Returns the encoded string address
std::string ToString() const;
};
#endif //DESTINATION_IO_H