|
|
@ -1,4 +1,5 @@ |
|
|
|
import asyncio |
|
|
|
from datetime import datetime |
|
|
|
|
|
|
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject |
|
|
|
|
|
|
@ -7,6 +8,7 @@ from electrum.keystore import bip39_is_checksum_valid |
|
|
|
from electrum.bip32 import is_bip32_derivation |
|
|
|
from electrum.slip39 import decode_mnemonic, Slip39Error |
|
|
|
from electrum import mnemonic |
|
|
|
from electrum.util import parse_URI, create_bip21_uri, InvalidBitcoinURI |
|
|
|
|
|
|
|
class QEBitcoin(QObject): |
|
|
|
def __init__(self, config, parent=None): |
|
|
@ -111,3 +113,19 @@ class QEBitcoin(QObject): |
|
|
|
@pyqtSlot(str, result=bool) |
|
|
|
def verify_derivation_path(self, path): |
|
|
|
return is_bip32_derivation(path) |
|
|
|
|
|
|
|
@pyqtSlot(str, result='QVariantMap') |
|
|
|
def parse_uri(self, uri: str) -> dict: |
|
|
|
try: |
|
|
|
return parse_URI(uri) |
|
|
|
except InvalidBitcoinURI as e: |
|
|
|
return { 'error': str(e) } |
|
|
|
|
|
|
|
@pyqtSlot(str, 'qint64', str, int, int, result=str) |
|
|
|
def create_uri(self, address, satoshis, message, timestamp, expiry): |
|
|
|
extra_params = {} |
|
|
|
if expiry: |
|
|
|
extra_params['time'] = str(timestamp) |
|
|
|
extra_params['exp'] = str(expiry) |
|
|
|
|
|
|
|
return create_bip21_uri(address, satoshis, message, extra_query_params=extra_params) |
|
|
|