UX issues

This commit is contained in:
scgbckbone 2023-03-29 00:07:04 +02:00 committed by doc-hex
parent 2ee65e628c
commit c566e389c8
3 changed files with 16 additions and 17 deletions

View File

@ -649,15 +649,16 @@ class ApproveTransaction(UserAuthorizedAction):
# Do some analysis/ validation
try:
await self.psbt.validate() # might do UX: accept multisig import
dis.progress_bar_show(0.10)
self.psbt.consider_inputs()
dis.fullscreen("Validating...", percent=0.33)
dis.progress_bar_show(0.33)
self.psbt.consider_keys()
dis.progress_bar(0.66)
dis.progress_bar_show(0.66)
self.psbt.consider_outputs()
dis.progress_bar(0.85)
dis.progress_bar_show(0.85)
except FraudulentChangeOutput as exc:
print('FraudulentChangeOutput: ' + exc.args[0])
return await self.failure(exc.args[0], title='Change Fraud')
@ -722,12 +723,12 @@ class ApproveTransaction(UserAuthorizedAction):
return
dis.progress_bar_show(1) # finish the Validating...
if not hsm_active:
msg.write("\nPress OK to approve and sign transaction. X to abort.")
ch = await ux_show_story(msg, title="OK TO SEND?")
else:
ch = await hsm_active.approve_transaction(self.psbt, self.psbt_sha, msg.getvalue())
dis.progress_bar(1) # finish the Validating...
except MemoryError:
# recovery? maybe.
@ -981,10 +982,9 @@ async def sign_psbt_file(filename, force_vdisk=False):
# - or from VirtualDisk (mk4)
from files import CardSlot, CardMissingError
from glob import dis
from ux import the_ux
from sram2 import tmp_buf
UserAuthorizedAction.cleanup()
#print("sign: %s" % filename)
# copy file into our spiflash
@ -1033,6 +1033,7 @@ async def sign_psbt_file(filename, force_vdisk=False):
psbt_len = total
async def done(psbt):
dis.fullscreen("Wait...")
orig_path, basename = filename.rsplit('/', 1)
orig_path += '/'
base = basename.rsplit('.', 1)[0]
@ -1140,10 +1141,9 @@ async def sign_psbt_file(filename, force_vdisk=False):
UserAuthorizedAction.cleanup()
UserAuthorizedAction.cleanup()
UserAuthorizedAction.active_request = ApproveTransaction(psbt_len, approved_cb=done)
# kill any menu stack, and put our thing at the top
abort_and_goto(UserAuthorizedAction.active_request)
the_ux.push(UserAuthorizedAction.active_request)
class RemoteBackup(UserAuthorizedAction):
def __init__(self):

View File

@ -14,8 +14,8 @@ from ubinascii import unhexlify as a2b_hex
from ubinascii import b2a_base64, a2b_base64
from ux import ux_show_story, ux_poll_key
from utils import cleanup_deriv_path, B2A, problem_file_line, parse_addr_fmt_str
from public_constants import AF_P2WPKH, AF_P2WPKH_P2SH, AF_CLASSIC
from utils import B2A, problem_file_line, parse_addr_fmt_str
from public_constants import AF_CLASSIC
# practical limit for things to share: 8k part, minus overhead
@ -396,7 +396,7 @@ class NFCHandler:
async def start_psbt_rx(self):
from auth import psbt_encoding_taster, TXN_INPUT_OFFSET
from auth import UserAuthorizedAction, ApproveTransaction
from ux import abort_and_goto
from ux import the_ux
from sffile import SFFile
data = await self.start_nfc_rx()
@ -445,7 +445,7 @@ class NFCHandler:
UserAuthorizedAction.active_request = ApproveTransaction(psbt_len, 0x0, psbt_sha=psbt_sha,
approved_cb=self.signing_done)
# kill any menu stack, and put our thing at the top
abort_and_goto(UserAuthorizedAction.active_request)
the_ux.push(UserAuthorizedAction.active_request)
async def signing_done(self, psbt):
# User approved the PSBT, and signing worked... share result over NFC (only)

View File

@ -189,9 +189,8 @@ async def show_n_parts(parts, chk_word):
msg += '\n'.join('%2d: %s' % (i+1, w) for i,w in enumerate(words))
msg += '\n\n'
if chk_word:
msg += ('The correctly reconstructed seed phrase will have this final word,'
' which we recommend recording:\n\n%d: %s\n\n' % (seed_len, chk_word))
msg += ('The correctly reconstructed seed phrase will have this final word,'
' which we recommend recording:\n\n%d: %s\n\n' % (seed_len, chk_word))
msg += 'Please check and double check your notes. There will be a test! '
@ -206,7 +205,7 @@ It does not matter the order (A/B/C or C/A/B) and the Coldcard
cannot determine when you have all the parts. You may stop at
any time and you will have a valid wallet. Combined seed parts
have to be equal length. No way to combine seed parts of different
length. Press OK for 24 words XOR, press (1) to for 12 words XOR,
length. Press OK for 24 words XOR, press (1) for 12 words XOR,
or press (2) for 18 words XOR.''', escape="12")
if ch == 'x': return