aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-07-24 14:24:40 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-07-24 14:24:40 -0500
commit8ae2681e08de3b18db433758b60bfe69ed6edd16 (patch)
tree6c58618fcbaebef6711331f129f98c57949d7665 /src/wallet/api
parentMerge pull request #5591 (diff)
parentdevice: show address on device display (diff)
downloadmonero-8ae2681e08de3b18db433758b60bfe69ed6edd16.tar.xz
Merge pull request #5594
f074b6b device: show address on device display (ph4r05)
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp17
-rw-r--r--src/wallet/api/wallet.h1
-rw-r--r--src/wallet/api/wallet2_api.h3
3 files changed, 21 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 5902eef4b..03db385a4 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -2430,6 +2430,23 @@ uint64_t WalletImpl::coldKeyImageSync(uint64_t &spent, uint64_t &unspent)
{
return m_wallet->cold_key_image_sync(spent, unspent);
}
+
+void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId)
+{
+ boost::optional<crypto::hash8> payment_id_param = boost::none;
+ if (!paymentId.empty())
+ {
+ crypto::hash8 payment_id;
+ bool res = tools::wallet2::parse_short_payment_id(paymentId, payment_id);
+ if (!res)
+ {
+ throw runtime_error("Invalid payment ID");
+ }
+ payment_id_param = payment_id;
+ }
+
+ m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param);
+}
} // namespace
namespace Bitmonero = Monero;
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 5dfd997a1..a367a1917 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -205,6 +205,7 @@ public:
virtual bool unlockKeysFile() override;
virtual bool isKeysFileLocked() override;
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override;
+ virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override;
private:
void clearStatus() const;
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index f2e99be21..9e556cb2f 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -1016,6 +1016,9 @@ struct Wallet
//! cold-device protocol key image sync
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) = 0;
+
+ //! shows address on device display
+ virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0;
};
/**