From 1e01851152c90668000327eaefa6c105629102f3 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Sat, 4 Dec 2021 12:44:27 +0200 Subject: [PATCH] ui: Display XMR subaddress on wallets page. --- basicswap/basicswap.py | 2 ++ basicswap/http_server.py | 4 +++- basicswap/interface_xmr.py | 2 +- basicswap/templates/wallets.html | 7 ++++++- doc/release-notes.md | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 357c670..97b0dc8 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -5123,6 +5123,8 @@ class BasicSwap(BaseApp): rv['anon_pending'] = walletinfo['unconfirmed_anon'] + walletinfo['immature_anon_balance'] rv['blind_balance'] = walletinfo['blind_balance'] rv['blind_unconfirmed'] = walletinfo['unconfirmed_blind'] + elif coin == Coins.XMR: + rv['main_address'] = self.getCachedMainWalletAddress(ci) return rv diff --git a/basicswap/http_server.py b/basicswap/http_server.py index d92090e..6b7603c 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -386,7 +386,6 @@ class HttpHandler(BaseHTTPRequestHandler): wf['unconfirmed'] = w['unconfirmed'] if k == Coins.PART: - wf['stealth_address'] = w['stealth_address'] wf['blind_balance'] = w['blind_balance'] if float(w['blind_unconfirmed']) > 0.0: @@ -395,6 +394,9 @@ class HttpHandler(BaseHTTPRequestHandler): if float(w['anon_pending']) > 0.0: wf['anon_pending'] = w['anon_pending'] + elif k == Coins.XMR: + wf['main_address'] = w.get('main_address', 'Refresh necessary') + if 'wd_type_from_' + cid in page_data: wf['wd_type_from'] = page_data['wd_type_from_' + cid] if 'wd_type_to_' + cid in page_data: diff --git a/basicswap/interface_xmr.py b/basicswap/interface_xmr.py index 07f64e2..aaab5a5 100644 --- a/basicswap/interface_xmr.py +++ b/basicswap/interface_xmr.py @@ -158,7 +158,7 @@ class XMRInterface(CoinInterface): with self._mx_wallet: self._log.warning('TODO - subaddress?') self.rpc_wallet_cb('open_wallet', {'filename': self._wallet_filename}) - return self.rpc_wallet_cb('get_address')['address'] + return self.rpc_wallet_cb('create_address', {'account_index': 0})['address'] def get_fee_rate(self, conf_target=2): self._log.warning('TODO - estimate fee rate?') diff --git a/basicswap/templates/wallets.html b/basicswap/templates/wallets.html index 46e850a..b302f94 100644 --- a/basicswap/templates/wallets.html +++ b/basicswap/templates/wallets.html @@ -39,7 +39,12 @@ {% if w.cid == '1' %} Stealth Address{{ w.stealth_address }} {% endif %} -{{ w.deposit_address }} +{% if w.cid == '6' %} +Main Address{{ w.main_address }} +{{ w.deposit_address }} +{% else %} +{{ w.deposit_address }} +{% endif %} Amount: Address: Subtract fee: {% if w.cid == '1' %} Type From, To diff --git a/doc/release-notes.md b/doc/release-notes.md index fefd55a..c9dcb53 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -7,6 +7,7 @@ - Prevent old shutdown link from shutting down a new session. - ui: Connected XMR wallet to rpc page. - Separate chain to generate smsg addresses. +- ui: Display XMR subaddress on wallets page. 0.0.26