コード例 #1
0
    def set_url(self, url, show_message, question):
        payto, amount, label, message, signature, identity, url = util.parse_url(
            url)
        if signature:
            if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity):
                signing_address = get_alias(identity, True, show_message,
                                            question)
            elif is_valid(identity):
                signing_address = identity
            else:
                signing_address = None
            if not signing_address:
                return
            try:
                EC_KEY.verify_message(signing_address, signature, url)
                self.receipt = (signing_address, signature, url)
            except:
                show_message(
                    'Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.'
                )
                address = amount = label = identity = message = ''

        if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', payto):
            payto_address = get_alias(payto, True, show_message, question)
            if payto_address:
                payto += ' <' + payto_address + '>'

        return payto, amount, label, message, signature, identity, url
コード例 #2
0
ファイル: gtk.py プロジェクト: MrBitKoin/electrum
 def set_url(self, url):
     payto, amount, label, message, payment_request, url = parse_url(url)
     self.notebook.set_current_page(1)
     self.payto_entry.set_text(payto)
     self.message_entry.set_text(message)
     self.amount_entry.set_text(amount)
     self.payto_sig.set_visible(False)
コード例 #3
0
ファイル: android.py プロジェクト: KillerByte/electrum
def make_new_contact():
    code = droid.scanBarcode()
    r = code.result
    if r:
        data = r['extras']['SCAN_RESULT']
        if data:
            if re.match('^memorycoin:', data):
                address, _, _, _, _, _, _ = util.parse_url(data)
            elif is_valid(data):
                address = data
            else:
                address = None
            if address:
                if modal_question('Add to contacts?', address):
                    wallet.add_contact(address)
        else:
            modal_dialog('Invalid address', data)
コード例 #4
0
ファイル: android.py プロジェクト: AYCHEX/aychex-electrum
def make_new_contact():
    code = droid.scanBarcode()
    r = code.result
    if r:
        data = r['extras']['SCAN_RESULT']
        if data:
            if re.match('^bitcoin:', data):
                address, _, _, _, _, _, _ = util.parse_url(data)
            elif is_valid(data):
                address = data
            else:
                address = None
            if address:
                if modal_question('Add to contacts?', address):
                    wallet.add_contact(address)
        else:
            modal_dialog('Invalid address', data)
コード例 #5
0
ファイル: gui_android.py プロジェクト: nvk/electrum
def make_new_contact():
    code = droid.scanBarcode()
    r = code.result
    if r:
        data = r["extras"]["SCAN_RESULT"]
        if data:
            if re.match("^bitcoin:", data):
                address, _, _, _, _, _, _ = util.parse_url(data)
            elif is_valid(data):
                address = data
            else:
                address = None
            if address:
                if modal_question("Add to contacts?", address):
                    wallet.add_contact(address)
        else:
            modal_dialog("Invalid address", data)
コード例 #6
0
ファイル: __init__.py プロジェクト: nordcz/electrum
    def init_lite(self, wallet, expert, url):
        import lite_window
        if not self.check_qt_version():
            return

        actuator = lite_window.MiniActuator(self.config, wallet)
        # Should probably not modify the current path but instead
        # change the behaviour of rsrc(...)
        old_path = QDir.currentPath()
        actuator.load_theme()

        mini = lite_window.MiniWindow(actuator, self.expand, self.config)
        driver = lite_window.MiniDriver(wallet, mini)

        # Reset path back to original value now that loading the GUI
        # is completed.
        QDir.setCurrent(old_path)
        if url:
            payto, amount, label, message, signature, identity, url = parse_url(url)
            self.mini.set_payment_fields(payto, amount)

        return mini
コード例 #7
0
ファイル: aliases.py プロジェクト: AdamISZ/electrum
    def set_url(self, url, show_message, question):
        payto, amount, label, message, signature, identity, url = util.parse_url(url)
        if signature:
            if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity):
                signing_address = get_alias(identity, True, show_message, question)
            elif is_valid(identity):
                signing_address = identity
            else:
                signing_address = None
            if not signing_address:
                return
            try:
                EC_KEY.verify_message(signing_address, signature, url )
                self.receipt = (signing_address, signature, url)
            except:
                show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.')
                address = amount = label = identity = message = ''

        if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', payto):
            payto_address = get_alias(payto, True, show_message, question)
            if payto_address:
                payto += ' <' + payto_address + '>'

        return payto, amount, label, message, signature, identity, url
コード例 #8
0
ファイル: android.py プロジェクト: KillerByte/electrum
def payto_loop():
    global recipient
    if recipient:
        droid.fullSetProperty("recipient","text",recipient)
        recipient = None

    out = None
    while out is None:
        event = droid.eventWait().result
        if not event: continue
        print "got event in payto loop", event
        if event == 'OK': continue
        if not event.get("name"): continue

        if event["name"] == "click":
            id = event["data"]["id"]

            if id=="buttonPay":

                droid.fullQuery()
                recipient = droid.fullQueryDetail("recipient").result.get('text')
                label  = droid.fullQueryDetail("label").result.get('text')
                amount = droid.fullQueryDetail('amount').result.get('text')

                if not is_valid(recipient):
                    modal_dialog('Error','Invalid Memorycoin address')
                    continue

                try:
                    amount = int( 100000000 * Decimal(amount) )
                except Exception:
                    modal_dialog('Error','Invalid amount')
                    continue

                result = pay_to(recipient, amount, wallet.fee, label)
                if result:
                    out = 'main'

            elif id=="buttonContacts":
                addr = select_from_contacts()
                droid.fullSetProperty("recipient","text",addr)

            elif id=="buttonQR":
                code = droid.scanBarcode()
                r = code.result
                if r:
                    data = r['extras']['SCAN_RESULT']
                    if data:
                        if re.match('^memorycoin:', data):
                            payto, amount, label, _, _, _, _ = util.parse_url(data)
                            droid.fullSetProperty("recipient", "text",payto)
                            droid.fullSetProperty("amount", "text", amount)
                            droid.fullSetProperty("label", "text", label)
                        else:
                            droid.fullSetProperty("recipient", "text", data)

                    
        elif event["name"] in menu_commands:
            out = event["name"]

        elif event["name"]=="key":
            if event["data"]["key"] == '4':
                out = 'main'

        #elif event["name"]=="screen":
        #    if event["data"]=="destroy":
        #        out = 'main'

    return out
コード例 #9
0
ファイル: android.py プロジェクト: AYCHEX/aychex-electrum
def payto_loop():
    global recipient
    if recipient:
        droid.fullSetProperty("recipient", "text", recipient)
        recipient = None

    out = None
    while out is None:
        event = droid.eventWait().result
        if not event: continue
        print "got event in payto loop", event
        if event == 'OK': continue
        if not event.get("name"): continue

        if event["name"] == "click":
            id = event["data"]["id"]

            if id == "buttonPay":

                droid.fullQuery()
                recipient = droid.fullQueryDetail("recipient").result.get(
                    'text')
                label = droid.fullQueryDetail("label").result.get('text')
                amount = droid.fullQueryDetail('amount').result.get('text')

                if not is_valid(recipient):
                    modal_dialog('Error', 'Invalid Bitcoin address')
                    continue

                try:
                    amount = int(100000000 * Decimal(amount))
                except Exception:
                    modal_dialog('Error', 'Invalid amount')
                    continue

                result = pay_to(recipient, amount, wallet.fee, label)
                if result:
                    out = 'main'

            elif id == "buttonContacts":
                addr = select_from_contacts()
                droid.fullSetProperty("recipient", "text", addr)

            elif id == "buttonQR":
                code = droid.scanBarcode()
                r = code.result
                if r:
                    data = r['extras']['SCAN_RESULT']
                    if data:
                        if re.match('^bitcoin:', data):
                            payto, amount, label, _, _, _, _ = util.parse_url(
                                data)
                            droid.fullSetProperty("recipient", "text", payto)
                            droid.fullSetProperty("amount", "text", amount)
                            droid.fullSetProperty("label", "text", label)
                        else:
                            droid.fullSetProperty("recipient", "text", data)

        elif event["name"] in menu_commands:
            out = event["name"]

        elif event["name"] == "key":
            if event["data"]["key"] == '4':
                out = 'main'

        #elif event["name"]=="screen":
        #    if event["data"]=="destroy":
        #        out = 'main'

    return out