mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
wallet2_api: add an API to the OpenAlias resolver
This commit is contained in:
parent
29735c8f8f
commit
9a2cd72257
3 changed files with 12 additions and 0 deletions
|
@ -352,6 +352,14 @@ double WalletManagerImpl::miningHashRate() const
|
||||||
return mres.speed;
|
return mres.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool &dnssec_valid) const
|
||||||
|
{
|
||||||
|
std::vector<std::string> addresses = tools::wallet2::addresses_from_url(address, dnssec_valid);
|
||||||
|
if (addresses.empty())
|
||||||
|
return "";
|
||||||
|
return addresses.front();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////// WalletManagerFactory implementation //////////////////////
|
///////////////////// WalletManagerFactory implementation //////////////////////
|
||||||
WalletManager *WalletManagerFactory::getWalletManager()
|
WalletManager *WalletManagerFactory::getWalletManager()
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
uint64_t blockchainTargetHeight() const;
|
uint64_t blockchainTargetHeight() const;
|
||||||
uint64_t networkDifficulty() const;
|
uint64_t networkDifficulty() const;
|
||||||
double miningHashRate() const;
|
double miningHashRate() const;
|
||||||
|
std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WalletManagerImpl() {}
|
WalletManagerImpl() {}
|
||||||
|
|
|
@ -561,6 +561,9 @@ struct WalletManager
|
||||||
|
|
||||||
//! returns current mining hash rate (0 if not mining)
|
//! returns current mining hash rate (0 if not mining)
|
||||||
virtual double miningHashRate() const = 0;
|
virtual double miningHashRate() const = 0;
|
||||||
|
|
||||||
|
//! resolves an OpenAlias address to a monero address
|
||||||
|
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue