Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve wording of 'Sign transaction' UX flows. #252

Merged
merged 5 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"version": 1,
"rules": [
{
"regexp": "Spend from|Wallet name|Review|Amount|Address|Confirm|Fees",
"regexp": "Spend from|Wallet name|Review|Amount|Address|Fees",
"actions": [
["button", 2, true],
["button", 2, false]
]
},
{
"regexp": "Approve|Accept",
"regexp": "Approve|Continue|Sign",
"actions": [
[ "button", 1, true ],
[ "button", 2, true ],
Expand Down
42 changes: 20 additions & 22 deletions src/ui/display_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,17 @@ UX_STEP_NOCB(ux_high_fee_step,
});
#endif

UX_STEP_NOCB(ux_confirm_transaction_step, pnn, {&C_icon_eye, "Confirm", "transaction"});
UX_STEP_NOCB(ux_confirm_selftransfer_step, pnn, {&C_icon_eye, "Confirm", "self-transfer"});
UX_STEP_NOCB(ux_confirm_transaction_fees_step,
bnnn_paging,
{
.title = "Fees",
.text = g_ui_state.validate_transaction.fee,
});
UX_STEP_CB(ux_accept_and_send_step,
UX_STEP_CB(ux_sign_transaction_step,
pbb,
set_ux_flow_response(true),
{&C_icon_validate_14, "Accept", "and send"});
{&C_icon_validate_14, "Sign", "transaction"});

// Step with wallet icon and "Register wallet"
UX_STEP_NOCB(ux_display_register_wallet_step,
Expand Down Expand Up @@ -379,12 +378,12 @@ UX_FLOW(ux_display_default_wallet_address_flow,
// FLOW to display a registered wallet and authorize spending:
// #1 screen: "Spend from known wallet"
// #2 screen: wallet name
// #3 screen: approve button
// #3 screen: "Continue" button
// #4 screen: reject button
UX_FLOW(ux_display_spend_from_wallet_flow,
&ux_display_spend_from_registered_wallet_step,
&ux_display_wallet_name_step,
&ux_display_approve_step,
&ux_display_continue_step,
&ux_display_reject_step);

// FLOW to warn about external inputs
Expand Down Expand Up @@ -424,45 +423,44 @@ UX_FLOW(ux_display_nondefault_sighash_flow,
// #1 screen: eye icon + "Review" + index of output to validate
// #2 screen: output amount
// #3 screen: output address (paginated)
// #4 screen: approve button
// #4 screen: "Continue" button
// #5 screen: reject button
UX_FLOW(ux_display_output_address_amount_flow,
&ux_review_step,
&ux_validate_amount_step,
&ux_validate_address_step,
&ux_display_approve_step,
&ux_display_continue_step,
&ux_display_reject_step);

// Finalize see the transaction fees and finally accept signing
// #1 screen: eye icon + "Confirm transaction"
// #2 screen: fee amount
// #3 screen: "Continue", with approve button
// #4 screen: reject button
// FLOW to warn about fees above 10% of total
// #1 screen: eye icon + fees too high message
// #2 screen: "Continue", with approve button
// #3 screen: reject button
UX_FLOW(ux_warn_high_fee_flow,
&ux_high_fee_step,
&ux_display_continue_step,
&ux_display_reject_step);

// Finalize see the transaction fees and finally accept signing
// #1 screen: eye icon + "Confirm transaction"
// #2 screen: fee amount
// #3 screen: "Accept and send", with approve button
// #4 screen: reject button
// Show transaction fees and finally accept signing
// #1 screen: fee amount
// #2 screen: "Sign transaction", with approve button
// #3 screen: reject button
UX_FLOW(ux_accept_transaction_flow,
&ux_confirm_transaction_step,
&ux_confirm_transaction_fees_step,
&ux_accept_and_send_step,
&ux_sign_transaction_step,
&ux_display_reject_step);

// Finalize see the transaction fees and finally accept signing
// Show transaction fees and finally accept signing, in case of self-transfer
// Since there is no output to show, we add an initial screen to make sure
// the user understands the nature of the transaction.
// #1 screen: eye icon + "Confirm self-transfer"
// #2 screen: fee amount
// #3 screen: "Accept and send", with approve button
// #3 screen: "Sign transaction", with approve button
// #4 screen: reject button
UX_FLOW(ux_accept_selftransfer_flow,
&ux_confirm_selftransfer_step,
&ux_confirm_transaction_fees_step,
&ux_accept_and_send_step,
&ux_sign_transaction_step,
&ux_display_reject_step);

void ui_display_pubkey_flow(void) {
Expand Down
82 changes: 40 additions & 42 deletions tests/instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def sign_psbt_instruction_approve(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.navigate_end_of_flow()
instructions.confirm_transaction()
Expand All @@ -166,8 +166,8 @@ def sign_psbt_instruction_approve_2(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Sign")
else:
instructions.navigate_end_of_flow()
instructions.navigate_end_of_flow()
Expand All @@ -179,9 +179,9 @@ def sign_psbt_instruction_approve_3(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Continue")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.navigate_end_of_flow()
instructions.navigate_end_of_flow()
Expand All @@ -195,8 +195,8 @@ def sign_psbt_instruction_approve_4(model: Firmware) -> Instructions:

if model.name.startswith("nano"):
instructions.new_request("Continue")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.warning_accept()
instructions.navigate_end_of_flow()
Expand All @@ -208,9 +208,7 @@ def sign_psbt_instruction_approve_5(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Accept")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Sign")
else:
instructions.navigate_end_of_flow()
instructions.confirm_transaction()
Expand All @@ -221,9 +219,9 @@ def sign_psbt_instruction_approve_6(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Sign")
else:
instructions.confirm_wallet()
instructions.navigate_end_of_flow()
Expand All @@ -236,9 +234,9 @@ def sign_psbt_instruction_approve_7(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.confirm_wallet()
instructions.navigate_end_of_flow()
Expand All @@ -250,10 +248,10 @@ def sign_psbt_instruction_approve_8(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Continue")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.confirm_wallet()
instructions.warning_accept()
Expand All @@ -266,9 +264,9 @@ def sign_psbt_instruction_approve_9(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.navigate_end_of_flow()
instructions.navigate_end_of_flow()
Expand All @@ -281,12 +279,12 @@ def sign_psbt_instruction_approve_external_inputs(model: Firmware) -> Instructio

if model.name.startswith("nano"):
instructions.new_request("Continue")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.warning_accept()
instructions.navigate_end_of_flow()
Expand All @@ -303,11 +301,11 @@ def sign_psbt_instruction_approve_external_inputs_2(model: Firmware) -> Instruct

if model.name.startswith("nano"):
instructions.new_request("Continue")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.new_request("Approve")
instructions.same_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.new_request("Continue")
instructions.same_request("Sign")
else:
instructions.warning_accept()
instructions.navigate_end_of_flow()
Expand All @@ -323,8 +321,8 @@ def sign_psbt_instruction_approve_10(model: Firmware) -> Instructions:

if model.name.startswith("nano"):
instructions.new_request("Continue")
instructions.new_request("Approve")
instructions.new_request("Accept")
instructions.new_request("Continue")
instructions.new_request("Sign")
else:
instructions.warning_accept()
instructions.navigate_end_of_flow()
Expand All @@ -333,14 +331,14 @@ def sign_psbt_instruction_approve_10(model: Firmware) -> Instructions:
return instructions


def e2e_register_wallet_instruction(model: Firmware) -> Instructions:
def e2e_register_wallet_instruction(model: Firmware, n_keys) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
for _ in range(23):
for _ in range(n_keys + 1):
instructions.new_request("Approve", save_screenshot=False)
else:
for _ in range(23):
for _ in range(n_keys + 1):
instructions.choice_confirm(save_screenshot=False)
return instructions

Expand All @@ -349,9 +347,9 @@ def e2e_sign_psbt_instruction(model: Firmware) -> Instructions:
instructions = Instructions(model)

if model.name.startswith("nano"):
instructions.new_request("Approve", save_screenshot=False)
instructions.new_request("Approve", save_screenshot=False)
instructions.new_request("Accept", save_screenshot=False)
instructions.new_request("Continue", save_screenshot=False)
instructions.new_request("Continue", save_screenshot=False)
instructions.new_request("Sign", save_screenshot=False)
else:
instructions.confirm_wallet(save_screenshot=False)
instructions.navigate_end_of_flow(save_screenshot=False)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_all_anyone_sign_1_0/00005.png
Binary file modified tests/snapshots/nanos/test_sighash_all_anyone_sign_1_1/00000.png
Binary file modified tests/snapshots/nanos/test_sighash_all_anyone_sign_1_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_all_sign_psbt_0_0/00005.png
Binary file modified tests/snapshots/nanos/test_sighash_all_sign_psbt_0_1/00000.png
Binary file modified tests/snapshots/nanos/test_sighash_all_sign_psbt_0_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_none_anyone_sign_1_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_none_sign_psbt_1_0/00005.png
Binary file modified tests/snapshots/nanos/test_sighash_none_sign_psbt_1_1/00000.png
Binary file modified tests/snapshots/nanos/test_sighash_none_sign_psbt_1_1/00001.png
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_segwitv0_sighash1_1_0/00001.png
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_segwitv0_sighash2_2_0/00001.png
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_segwitv0_sighash3_2_0/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_single_sign_psbt_1_1/00001.png
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sighash_unsupported_0_0/00005.png
Binary file modified tests/snapshots/nanos/test_sighash_unsupported_0_1/00000.png
Binary file modified tests/snapshots/nanos/test_sighash_unsupported_0_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_highfee_0_0/00005.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_highfee_1_1/00000.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_highfee_1_1/00001.png
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_sh_wsh_1_1/00001.png
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_wsh_0_0/00002.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_wsh_1_0/00005.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_wsh_2_0/00000.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_wsh_2_0/00001.png
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_multisig_wsh_v1_2_0/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_taproot_1to2_v1_0_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_with_opreturn_0_0/00011.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_with_opreturn_1_0/00000.png
Binary file modified tests/snapshots/nanos/test_sign_psbt_with_opreturn_1_0/00001.png
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/nanos/test_sign_psbt_with_segwit_v16_0_1/00001.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Loading
Loading