def tx_from_text(self, txt): from electrum_zclassic.transaction import tx_from_str try: txt_tx = tx_from_str(txt) tx = Transaction(txt_tx, sign_schnorr=self.wallet.is_schnorr_enabled()) tx.deserialize() return tx except: traceback.print_exc(file=sys.stdout) self.show_critical( _("Electron Cash was unable to parse your transaction")) return
def on_qr(self, data): from electrum_zclassic.bitcoin import base_decode, is_address data = data.strip() if is_address(data): self.set_URI(data) return if data.startswith('zclassic:'): self.set_URI(data) return # try to decode transaction from electrum_zclassic.transaction import Transaction from electrum_zclassic.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")