mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 08:08:51 +00:00
subaddressIndex()
This commit is contained in:
parent
4f8ad5bfac
commit
8b467e98a4
@ -893,6 +893,27 @@ std::string WalletImpl::address(uint32_t accountIndex, uint32_t addressIndex) co
|
||||
return m_wallet->get_subaddress_as_str({accountIndex, addressIndex});
|
||||
}
|
||||
|
||||
bool WalletImpl::subaddressIndex(std::string address, std::pair<uint32_t, uint32_t> &index) const
|
||||
{
|
||||
clearStatus();
|
||||
cryptonote::address_parse_info info;
|
||||
|
||||
if (!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), address)) {
|
||||
setStatusError(tr("Failed to parse address"));
|
||||
return false;
|
||||
}
|
||||
|
||||
auto i = m_wallet->get_subaddress_index(info.address);
|
||||
if (!i) {
|
||||
setStatusError(tr("Address doesn't belong to the wallet"));
|
||||
return false;
|
||||
}
|
||||
|
||||
index.first = i->major;
|
||||
index.second = i->minor;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string WalletImpl::integratedAddress(const std::string &payment_id) const
|
||||
{
|
||||
crypto::hash8 pid;
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
bool setDevicePin(const std::string &password) override;
|
||||
bool setDevicePassphrase(const std::string &password) override;
|
||||
std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override;
|
||||
bool subaddressIndex(std::string address, std::pair<uint32_t, uint32_t> &index) const override;
|
||||
std::string integratedAddress(const std::string &payment_id) const override;
|
||||
std::string secretViewKey() const override;
|
||||
std::string publicViewKey() const override;
|
||||
|
@ -556,6 +556,7 @@ struct Wallet
|
||||
virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; };
|
||||
virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; };
|
||||
virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0;
|
||||
virtual bool subaddressIndex(std::string address, std::pair<uint32_t, uint32_t> &index) const = 0;
|
||||
std::string mainAddress() const { return address(0, 0); }
|
||||
virtual std::string path() const = 0;
|
||||
virtual NetworkType nettype() const = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user