2017-11-23 11:20:20 -08:00
|
|
|
#ifndef ZC_ADDRESS_H_
|
|
|
|
#define ZC_ADDRESS_H_
|
2016-05-04 17:25:42 -07:00
|
|
|
|
2020-02-18 07:28:04 -08:00
|
|
|
#include "zcash/address/sapling.hpp"
|
|
|
|
#include "zcash/address/sprout.hpp"
|
2016-05-04 17:25:42 -07:00
|
|
|
|
2018-04-25 18:51:17 -07:00
|
|
|
#include <boost/variant.hpp>
|
|
|
|
|
2016-05-04 17:25:42 -07:00
|
|
|
namespace libzcash {
|
2018-04-25 18:51:17 -07:00
|
|
|
class InvalidEncoding {
|
|
|
|
public:
|
|
|
|
friend bool operator==(const InvalidEncoding &a, const InvalidEncoding &b) { return true; }
|
|
|
|
friend bool operator<(const InvalidEncoding &a, const InvalidEncoding &b) { return true; }
|
|
|
|
};
|
2016-05-04 17:25:42 -07:00
|
|
|
|
2018-06-06 21:40:59 -07:00
|
|
|
typedef boost::variant<InvalidEncoding, SproutPaymentAddress, SaplingPaymentAddress> PaymentAddress;
|
|
|
|
typedef boost::variant<InvalidEncoding, SproutViewingKey> ViewingKey;
|
|
|
|
|
2019-11-11 15:49:11 -08:00
|
|
|
class AddressInfoFromSpendingKey : public boost::static_visitor<std::pair<std::string, PaymentAddress>> {
|
|
|
|
public:
|
|
|
|
std::pair<std::string, PaymentAddress> operator()(const SproutSpendingKey&) const;
|
|
|
|
std::pair<std::string, PaymentAddress> operator()(const struct SaplingExtendedSpendingKey&) const;
|
|
|
|
std::pair<std::string, PaymentAddress> operator()(const InvalidEncoding&) const;
|
|
|
|
};
|
|
|
|
|
2016-05-04 17:25:42 -07:00
|
|
|
}
|
|
|
|
|
2018-04-25 18:51:17 -07:00
|
|
|
/** Check whether a PaymentAddress is not an InvalidEncoding. */
|
|
|
|
bool IsValidPaymentAddress(const libzcash::PaymentAddress& zaddr);
|
|
|
|
|
|
|
|
/** Check whether a ViewingKey is not an InvalidEncoding. */
|
|
|
|
bool IsValidViewingKey(const libzcash::ViewingKey& vk);
|
|
|
|
|
2017-11-23 11:20:20 -08:00
|
|
|
#endif // ZC_ADDRESS_H_
|