|
@ -351,7 +351,9 @@ settings_layout = make_layout(""" |
|
|
def get_history_values(n): |
|
|
def get_history_values(n): |
|
|
values = [] |
|
|
values = [] |
|
|
h = wallet.get_tx_history() |
|
|
h = wallet.get_tx_history() |
|
|
for i in range(n): |
|
|
|
|
|
|
|
|
length = min(n, len(h)) |
|
|
|
|
|
for i in range(length): |
|
|
line = h[-i-1] |
|
|
line = h[-i-1] |
|
|
v = line['value'] |
|
|
v = line['value'] |
|
|
try: |
|
|
try: |
|
@ -500,9 +502,22 @@ def pay_to(recipient, amount, fee, label): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def recover(): |
|
|
def recover(): |
|
|
if not modal_question("Wallet not found","restore from seed?"): |
|
|
|
|
|
|
|
|
droid.dialogCreateAlert("Wallet not found","Do you want to create a new wallet, or restore an existing one?") |
|
|
|
|
|
droid.dialogSetPositiveButtonText('Create') |
|
|
|
|
|
droid.dialogSetNeutralButtonText('Restore') |
|
|
|
|
|
droid.dialogSetNegativeButtonText('Cancel') |
|
|
|
|
|
droid.dialogShow() |
|
|
|
|
|
response = droid.dialogGetResponse().result |
|
|
|
|
|
droid.dialogDismiss() |
|
|
|
|
|
if response.get('which') == 'negative': |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
|
|
|
is_recovery = response.get('which') == 'neutral' |
|
|
|
|
|
|
|
|
|
|
|
if not is_recovery: |
|
|
|
|
|
wallet.new_seed(None) |
|
|
|
|
|
else: |
|
|
if modal_question("Input method",None,'QR Code', 'mnemonic'): |
|
|
if modal_question("Input method",None,'QR Code', 'mnemonic'): |
|
|
code = droid.scanBarcode() |
|
|
code = droid.scanBarcode() |
|
|
r = code.result |
|
|
r = code.result |
|
@ -518,30 +533,32 @@ def recover(): |
|
|
modal_dialog('error: could not decode this seed') |
|
|
modal_dialog('error: could not decode this seed') |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
if not modal_question('Seed', seed ): |
|
|
|
|
|
exit(1) |
|
|
|
|
|
|
|
|
|
|
|
wallet.seed = str(seed) |
|
|
wallet.seed = str(seed) |
|
|
wallet.init_mpk( wallet.seed ) |
|
|
|
|
|
|
|
|
|
|
|
change_password_dialog() |
|
|
modal_dialog('Your seed is:', wallet.seed) |
|
|
|
|
|
modal_dialog('Mnemonic code:', ' '.join(mnemonic.mn_encode(wallet.seed)) ) |
|
|
|
|
|
|
|
|
droid.dialogCreateSpinnerProgress("Electrum", "recovering wallet...") |
|
|
msg = "recovering wallet..." if is_recovery else "creating wallet..." |
|
|
|
|
|
droid.dialogCreateSpinnerProgress("Electrum", msg) |
|
|
droid.dialogShow() |
|
|
droid.dialogShow() |
|
|
|
|
|
|
|
|
|
|
|
wallet.init_mpk( wallet.seed ) |
|
|
WalletSynchronizer(wallet,True).start() |
|
|
WalletSynchronizer(wallet,True).start() |
|
|
wallet.update() |
|
|
wallet.update() |
|
|
wallet.save() |
|
|
|
|
|
droid.dialogDismiss() |
|
|
droid.dialogDismiss() |
|
|
droid.vibrate() |
|
|
droid.vibrate() |
|
|
|
|
|
|
|
|
|
|
|
if is_recovery: |
|
|
if wallet.is_found(): |
|
|
if wallet.is_found(): |
|
|
# history and addressbook |
|
|
|
|
|
wallet.update_tx_history() |
|
|
wallet.update_tx_history() |
|
|
wallet.fill_addressbook() |
|
|
wallet.fill_addressbook() |
|
|
modal_dialog("recovery successful") |
|
|
modal_dialog("recovery successful") |
|
|
else: |
|
|
else: |
|
|
if not modal_question("no transactions found for this seed","do you want to keep this wallet?"): |
|
|
if not modal_question("no transactions found for this seed","do you want to keep this wallet?"): |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
|
|
|
change_password_dialog() |
|
|
wallet.save() |
|
|
wallet.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -761,8 +778,8 @@ def seed_dialog(): |
|
|
|
|
|
|
|
|
def change_password_dialog(): |
|
|
def change_password_dialog(): |
|
|
if wallet.use_encryption: |
|
|
if wallet.use_encryption: |
|
|
password = droid.dialogGetPassword('Current password').result |
|
|
password = droid.dialogGetPassword('Your wallet is encrypted').result |
|
|
if not password: return |
|
|
if password is None: return |
|
|
else: |
|
|
else: |
|
|
password = None |
|
|
password = None |
|
|
|
|
|
|
|
@ -773,6 +790,10 @@ def change_password_dialog(): |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
new_password = droid.dialogGetPassword('Choose a password').result |
|
|
new_password = droid.dialogGetPassword('Choose a password').result |
|
|
|
|
|
if new_password == None: |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if new_password != '': |
|
|
password2 = droid.dialogGetPassword('Confirm new password').result |
|
|
password2 = droid.dialogGetPassword('Confirm new password').result |
|
|
if new_password != password2: |
|
|
if new_password != password2: |
|
|
modal_dialog('error','passwords do not match') |
|
|
modal_dialog('error','passwords do not match') |
|
@ -782,7 +803,7 @@ def change_password_dialog(): |
|
|
if new_password: |
|
|
if new_password: |
|
|
modal_dialog('Password updated','your wallet is encrypted') |
|
|
modal_dialog('Password updated','your wallet is encrypted') |
|
|
else: |
|
|
else: |
|
|
modal_dialog('Password removed','your wallet is not encrypted') |
|
|
modal_dialog('No password','your wallet is not encrypted') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def settings_loop(): |
|
|
def settings_loop(): |
|
|