Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1265: Show QR code for xpub

e4f249ad4b Show QR code for xpub (Wukong)

Pull request description:

  Show QR code for xpub so that mobile client can easily import the xpub by scanning the QR code

ACKs for top commit:
  kristapsk:
    ACK e4f249ad4b

Tree-SHA512: d2b60155f03cc2787b9a71d232584a0b97bd54c4682905cffe2babf8dc726426af9544edce5bbabb5fb7833099e2784ec0487a4a860fc8432527c6f3edc48185
master
Kristaps Kaupe 4 years ago
parent
commit
808b9af8c7
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 13
      scripts/joinmarket-qt.py

13
scripts/joinmarket-qt.py

@ -1479,11 +1479,13 @@ class JMWalletTab(QWidget):
# Show QR code option only for new addresses to avoid address reuse
if item.text(3) == "new":
menu.addAction("Show QR code",
lambda: self.openQRCodePopup(txt))
lambda: self.openAddressQRCodePopup(txt))
if xpub_exists:
menu.addAction("Copy extended public key to clipboard",
lambda: app.clipboard().setText(xpub),
shortcut=QKeySequence(QKeySequence.Copy))
menu.addAction("Show QR code",
lambda: self.openQRCodePopup(xpub, xpub))
menu.addAction("Refresh wallet",
lambda: mainWindow.updateWalletInfo(None, "all"),
shortcut=QKeySequence(QKeySequence.Refresh))
@ -1491,7 +1493,11 @@ class JMWalletTab(QWidget):
#TODO add more items to context menu
menu.exec_(self.walletTree.viewport().mapToGlobal(position))
def openQRCodePopup(self, address):
def openQRCodePopup(self, title, data):
popup = QRCodePopup(self, title, data)
popup.show()
def openAddressQRCodePopup(self, address):
bip21_uri = btc.encode_bip21_uri(address, {})
# From BIP173 (bech32) spec:
# For presentation, lowercase is usually preferable, but inside
@ -1502,8 +1508,7 @@ class JMWalletTab(QWidget):
# encoded in QR code to uppercase, if possible.
if detect_script_type(mainWindow.wallet_service.addr_to_script(address)) == TYPE_P2WPKH:
bip21_uri = bip21_uri.upper()
popup = QRCodePopup(self, address, bip21_uri)
popup.show()
self.openQRCodePopup(address, bip21_uri)
def updateWalletInfo(self, walletinfo=None):
max_mixdepth_count = jm_single().config.getint("GUI", "max_mix_depth")

Loading…
Cancel
Save