Ejemplo n.º 1
0
 def do_paste(self):
     data = self.app._clipboard.paste()
     if not data:
         self.app.show_info(_("Clipboard is empty"))
         return
     # try to decode as transaction
     try:
         raw_tx = tx_from_str(data)
         tx = Transaction(raw_tx)
         tx.deserialize()
     except:
         tx = None
     if tx:
         self.app.tx_dialog(tx)
         return
     # try to decode as URI/address
     self.set_URI(data)
Ejemplo n.º 2
0
 def on_qr(self, data):
     from electrum_xzc.bitcoin import base_decode, is_address
     data = data.strip()
     if is_address(data):
         self.set_URI(data)
         return
     if data.startswith('zcoin:'):
         self.set_URI(data)
         return
     # try to decode transaction
     from electrum_xzc.transaction import Transaction
     from electrum_xzc.util import bh2u
     try:
         text = bh2u(base_decode(data, None, base=43))
         tx = Transaction(text)
         tx.deserialize()
     except:
         tx = None
     if tx:
         self.tx_dialog(tx)
         return
     # show error
     self.show_error("Unable to decode QR data")