コード例 #1
0
 def send(self, window, addr):
     from electrum_zcash import paymentrequest
     r = window.wallet.receive_requests.get(addr)
     message = r.get('memo', '')
     if r.get('signature'):
         pr = paymentrequest.serialize_request(r)
     else:
         pr = paymentrequest.make_request(self.config, r)
     if not pr:
         return
     recipient, ok = QInputDialog.getText(window, 'Send request',
                                          'Email invoice to:')
     if not ok:
         return
     recipient = str(recipient)
     payload = pr.SerializeToString()
     self.print_error('sending mail to', recipient)
     try:
         # FIXME this runs in the GUI thread and blocks it...
         self.processor.send(recipient, message, payload)
     except BaseException as e:
         traceback.print_exc(file=sys.stderr)
         window.show_message(str(e))
     else:
         window.show_message(_('Request sent.'))
コード例 #2
0
ファイル: qt.py プロジェクト: zebra-lucky/electrum-zcash
 def send(self, window: ElectrumWindow, addr):
     from electrum_zcash import paymentrequest
     req = window.wallet.receive_requests.get(addr)
     if not isinstance(req, OnchainInvoice):
         window.show_error("Only on-chain requests are supported.")
         return
     message = req.message
     if req.bip70:
         payload = bytes.fromhex(req.bip70)
     else:
         pr = paymentrequest.make_request(self.config, req)
         payload = pr.SerializeToString()
     if not payload:
         return
     recipient, ok = QInputDialog.getText(window, 'Send request',
                                          'Email invoice to:')
     if not ok:
         return
     recipient = str(recipient)
     self.logger.info(f'sending mail to {recipient}')
     try:
         # FIXME this runs in the GUI thread and blocks it...
         self.processor.send(recipient, message, payload)
     except BaseException as e:
         self.logger.exception('')
         window.show_message(repr(e))
     else:
         window.show_message(_('Request sent.'))