diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-10-23 19:04:01 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-10-23 19:04:01 +0200 |
| commit | 92095104fe2cea06a22faa6712a9135f40829686 (patch) | |
| tree | fa739a798fccf315e811a4aea42c1efc3293d284 /src/wallet/api/wallet.cpp | |
| parent | 4f6ea2eb6a7bdc189858dc752e7b06210500db48 (diff) | |
| parent | 06b642dfe4b27216615310440ecd8d37db5652a0 (diff) | |
| download | monzero-core-92095104fe2cea06a22faa6712a9135f40829686.tar.gz monzero-core-92095104fe2cea06a22faa6712a9135f40829686.tar.xz monzero-core-92095104fe2cea06a22faa6712a9135f40829686.zip | |
Merge pull request #1230
06b642d wallet_api: add address validation functions (moneromooo-monero)
Diffstat (limited to 'src/wallet/api/wallet.cpp')
| -rw-r--r-- | src/wallet/api/wallet.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 747263b54..9a9638b40 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -167,6 +167,26 @@ bool Wallet::paymentIdValid(const string &paiment_id) return false; } +bool Wallet::addressValid(const std::string &str, bool testnet) +{ + bool has_payment_id; + cryptonote::account_public_address address; + crypto::hash8 pid; + return get_account_integrated_address_from_str(address, has_payment_id, pid, testnet, str); +} + +std::string Wallet::paymentIdFromAddress(const std::string &str, bool testnet) +{ + bool has_payment_id; + cryptonote::account_public_address address; + crypto::hash8 pid; + if (!get_account_integrated_address_from_str(address, has_payment_id, pid, testnet, str)) + return ""; + if (!has_payment_id) + return ""; + return epee::string_tools::pod_to_hex(pid); +} + uint64_t Wallet::maximumAllowedAmount() { return std::numeric_limits<uint64_t>::max(); |
