mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-08 07:38:11 +00:00
WIP - delete some unnecessary kwargs
This commit is contained in:
parent
c5c47ce1bb
commit
3c32a2097a
@ -442,11 +442,12 @@ async def _placeholder_confirm(
|
|||||||
ctx: GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str,
|
br_type: str,
|
||||||
title: str,
|
title: str,
|
||||||
data: str,
|
data: str | None = None,
|
||||||
|
description: str | None = None,
|
||||||
|
*,
|
||||||
verb: str = "CONFIRM",
|
verb: str = "CONFIRM",
|
||||||
verb_cancel: str | bytes | None = "",
|
verb_cancel: str | bytes | None = "",
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
description: str | None = None,
|
|
||||||
br_code: ButtonRequestType = BR_TYPE_OTHER,
|
br_code: ButtonRequestType = BR_TYPE_OTHER,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
return await confirm_action(
|
return await confirm_action(
|
||||||
@ -573,11 +574,9 @@ async def confirm_reset_device(
|
|||||||
to_show += "\nUse you backup to recover your wallet."
|
to_show += "\nUse you backup to recover your wallet."
|
||||||
|
|
||||||
return await _placeholder_confirm(
|
return await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="recover_device" if recovery else "setup_device",
|
"recover_device" if recovery else "setup_device",
|
||||||
title="WALLET RECOVERY" if recovery else "WALLET BACKUP",
|
"WALLET RECOVERY" if recovery else "WALLET BACKUP",
|
||||||
# data=f"{common_data}\n\n{special_data}",
|
|
||||||
data="",
|
|
||||||
description=to_show,
|
description=to_show,
|
||||||
br_code=ButtonRequestType.ProtectCall
|
br_code=ButtonRequestType.ProtectCall
|
||||||
if recovery
|
if recovery
|
||||||
@ -588,24 +587,24 @@ async def confirm_reset_device(
|
|||||||
# TODO cleanup @ redesign
|
# TODO cleanup @ redesign
|
||||||
async def confirm_backup(ctx: GenericContext) -> bool:
|
async def confirm_backup(ctx: GenericContext) -> bool:
|
||||||
if await get_bool(
|
if await get_bool(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
title="SUCCESS",
|
"backup_device",
|
||||||
data="New wallet created successfully!\nYou should back up your new wallet right now.",
|
"SUCCESS",
|
||||||
|
"New wallet created successfully!\nYou should back up your new wallet right now.",
|
||||||
verb="BACK UP",
|
verb="BACK UP",
|
||||||
verb_cancel="SKIP",
|
verb_cancel="SKIP",
|
||||||
br_type="backup_device",
|
|
||||||
br_code=ButtonRequestType.ResetDevice,
|
br_code=ButtonRequestType.ResetDevice,
|
||||||
):
|
):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
confirmed = await get_bool(
|
confirmed = await get_bool(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
title="WARNING",
|
"backup_device",
|
||||||
data="Are you sure you want to skip the backup?\n",
|
"WARNING",
|
||||||
description="You can back up your Trezor once, at any time.",
|
"Are you sure you want to skip the backup?\n",
|
||||||
|
"You can back up your Trezor once, at any time.",
|
||||||
verb="BACK UP",
|
verb="BACK UP",
|
||||||
verb_cancel="SKIP",
|
verb_cancel="SKIP",
|
||||||
br_type="backup_device",
|
|
||||||
br_code=ButtonRequestType.ResetDevice,
|
br_code=ButtonRequestType.ResetDevice,
|
||||||
)
|
)
|
||||||
return confirmed
|
return confirmed
|
||||||
@ -615,11 +614,10 @@ async def confirm_path_warning(
|
|||||||
ctx: GenericContext, path: str, path_type: str = "Path"
|
ctx: GenericContext, path: str, path_type: str = "Path"
|
||||||
) -> None:
|
) -> None:
|
||||||
return await _placeholder_confirm(
|
return await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="path_warning",
|
"path_warning",
|
||||||
title="CONFIRM PATH",
|
"CONFIRM PATH",
|
||||||
data=f"{path_type}\n{path} is unknown.\nAre you sure?",
|
f"{path_type}\n{path} is unknown.\nAre you sure?",
|
||||||
description="",
|
|
||||||
br_code=ButtonRequestType.UnknownDerivationPath,
|
br_code=ButtonRequestType.UnknownDerivationPath,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -694,9 +692,9 @@ def show_pubkey(
|
|||||||
) -> Awaitable[None]:
|
) -> Awaitable[None]:
|
||||||
return confirm_blob(
|
return confirm_blob(
|
||||||
ctx,
|
ctx,
|
||||||
br_type="show_pubkey",
|
"show_pubkey",
|
||||||
title=title.upper(),
|
title.upper(),
|
||||||
data=pubkey,
|
pubkey,
|
||||||
br_code=ButtonRequestType.PublicKey,
|
br_code=ButtonRequestType.PublicKey,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -704,24 +702,24 @@ def show_pubkey(
|
|||||||
async def _show_modal(
|
async def _show_modal(
|
||||||
ctx: GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str,
|
br_type: str,
|
||||||
br_code: ButtonRequestType,
|
|
||||||
header: str,
|
header: str,
|
||||||
subheader: str | None,
|
subheader: str | None,
|
||||||
content: str,
|
content: str,
|
||||||
button_confirm: str | None,
|
button_confirm: str | None,
|
||||||
button_cancel: str | None,
|
button_cancel: str | None,
|
||||||
|
br_code: ButtonRequestType,
|
||||||
exc: ExceptionType = ActionCancelled,
|
exc: ExceptionType = ActionCancelled,
|
||||||
) -> None:
|
) -> None:
|
||||||
await confirm_action(
|
await confirm_action(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
br_code=br_code,
|
header.upper(),
|
||||||
title=header.upper(),
|
subheader,
|
||||||
action=subheader,
|
content,
|
||||||
description=content,
|
|
||||||
verb=button_confirm or "",
|
verb=button_confirm or "",
|
||||||
verb_cancel=button_cancel,
|
verb_cancel=button_cancel,
|
||||||
exc=exc,
|
exc=exc,
|
||||||
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -736,14 +734,14 @@ async def show_error_and_raise(
|
|||||||
exc: ExceptionType = ActionCancelled,
|
exc: ExceptionType = ActionCancelled,
|
||||||
) -> NoReturn:
|
) -> NoReturn:
|
||||||
await _show_modal(
|
await _show_modal(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
br_code=BR_TYPE_OTHER,
|
header,
|
||||||
header=header,
|
subheader,
|
||||||
subheader=subheader,
|
content,
|
||||||
content=content,
|
|
||||||
button_confirm=None,
|
button_confirm=None,
|
||||||
button_cancel=button,
|
button_cancel=button,
|
||||||
|
br_code=BR_TYPE_OTHER,
|
||||||
exc=exc,
|
exc=exc,
|
||||||
)
|
)
|
||||||
raise exc
|
raise exc
|
||||||
@ -760,13 +758,13 @@ def show_warning(
|
|||||||
) -> Awaitable[None]:
|
) -> Awaitable[None]:
|
||||||
return _show_modal(
|
return _show_modal(
|
||||||
ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
br_code=br_code,
|
header,
|
||||||
header=header,
|
subheader,
|
||||||
subheader=subheader,
|
content,
|
||||||
content=content,
|
|
||||||
button_confirm=button,
|
button_confirm=button,
|
||||||
button_cancel=None,
|
button_cancel=None,
|
||||||
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -779,13 +777,13 @@ def show_success(
|
|||||||
) -> Awaitable[None]:
|
) -> Awaitable[None]:
|
||||||
return _show_modal(
|
return _show_modal(
|
||||||
ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
br_code=ButtonRequestType.Success,
|
"Success",
|
||||||
header="Success",
|
subheader,
|
||||||
subheader=subheader,
|
content,
|
||||||
content=content,
|
|
||||||
button_confirm=button,
|
button_confirm=button,
|
||||||
button_cancel=None,
|
button_cancel=None,
|
||||||
|
br_code=ButtonRequestType.Success,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -837,11 +835,10 @@ async def confirm_payment_request(
|
|||||||
) -> Any:
|
) -> Any:
|
||||||
memos_str = "\n".join(memos)
|
memos_str = "\n".join(memos)
|
||||||
return await _placeholder_confirm(
|
return await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="confirm_payment_request",
|
"confirm_payment_request",
|
||||||
title="CONFIRM SENDING",
|
"CONFIRM SENDING",
|
||||||
data=f"{amount} to\n{recipient_name}\n{memos_str}",
|
f"{amount} to\n{recipient_name}\n{memos_str}",
|
||||||
description="",
|
|
||||||
br_code=ButtonRequestType.ConfirmOutput,
|
br_code=ButtonRequestType.ConfirmOutput,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1028,11 +1025,10 @@ async def confirm_joint_total(
|
|||||||
ctx: GenericContext, spending_amount: str, total_amount: str
|
ctx: GenericContext, spending_amount: str, total_amount: str
|
||||||
) -> None:
|
) -> None:
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="confirm_joint_total",
|
"confirm_joint_total",
|
||||||
title="JOINT TRANSACTION",
|
"JOINT TRANSACTION",
|
||||||
data=f"You are contributing:\n{spending_amount}\nto the total amount:\n{total_amount}",
|
f"You are contributing:\n{spending_amount}\nto the total amount:\n{total_amount}",
|
||||||
description="",
|
|
||||||
br_code=ButtonRequestType.SignTx,
|
br_code=ButtonRequestType.SignTx,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1047,10 +1043,10 @@ async def confirm_metadata(
|
|||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
title=title.upper(),
|
title.upper(),
|
||||||
data=content.format(param),
|
content.format(param),
|
||||||
hold=hold,
|
hold=hold,
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
@ -1058,10 +1054,10 @@ async def confirm_metadata(
|
|||||||
|
|
||||||
async def confirm_replacement(ctx: GenericContext, description: str, txid: str) -> None:
|
async def confirm_replacement(ctx: GenericContext, description: str, txid: str) -> None:
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="confirm_replacement",
|
"confirm_replacement",
|
||||||
title=description.upper(),
|
description.upper(),
|
||||||
data=f"Confirm transaction ID:\n{txid}",
|
f"Confirm transaction ID:\n{txid}",
|
||||||
br_code=ButtonRequestType.SignTx,
|
br_code=ButtonRequestType.SignTx,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1081,10 +1077,10 @@ async def confirm_modify_output(
|
|||||||
text += f"New amount:\n{amount_new}"
|
text += f"New amount:\n{amount_new}"
|
||||||
|
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="modify_output",
|
"modify_output",
|
||||||
title="MODIFY AMOUNT",
|
"MODIFY AMOUNT",
|
||||||
data=text,
|
text,
|
||||||
br_code=ButtonRequestType.ConfirmOutput,
|
br_code=ButtonRequestType.ConfirmOutput,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1110,10 +1106,10 @@ async def confirm_modify_fee(
|
|||||||
text += "\n" + fee_rate_amount
|
text += "\n" + fee_rate_amount
|
||||||
|
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="modify_fee",
|
"modify_fee",
|
||||||
title="MODIFY FEE",
|
"MODIFY FEE",
|
||||||
data=text,
|
text,
|
||||||
br_code=ButtonRequestType.SignTx,
|
br_code=ButtonRequestType.SignTx,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1122,10 +1118,10 @@ async def confirm_coinjoin(
|
|||||||
ctx: GenericContext, max_rounds: int, max_fee_per_vbyte: str
|
ctx: GenericContext, max_rounds: int, max_fee_per_vbyte: str
|
||||||
) -> None:
|
) -> None:
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="coinjoin_final",
|
"coinjoin_final",
|
||||||
title="AUTHORIZE COINJOIN",
|
"AUTHORIZE COINJOIN",
|
||||||
data=f"Maximum rounds: {max_rounds}\n\nMaximum mining fee:\n{max_fee_per_vbyte}",
|
f"Maximum rounds: {max_rounds}\n\nMaximum mining fee:\n{max_fee_per_vbyte}",
|
||||||
br_code=BR_TYPE_OTHER,
|
br_code=BR_TYPE_OTHER,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1144,10 +1140,10 @@ async def confirm_sign_identity(
|
|||||||
text += identity
|
text += identity
|
||||||
|
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type="confirm_sign_identity",
|
"confirm_sign_identity",
|
||||||
title=f"Sign {proto}".upper(),
|
f"Sign {proto}".upper(),
|
||||||
data=text,
|
text,
|
||||||
br_code=BR_TYPE_OTHER,
|
br_code=BR_TYPE_OTHER,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1171,10 +1167,10 @@ async def confirm_signverify(
|
|||||||
)
|
)
|
||||||
|
|
||||||
await _placeholder_confirm(
|
await _placeholder_confirm(
|
||||||
ctx=ctx,
|
ctx,
|
||||||
br_type=br_type,
|
br_type,
|
||||||
title=header.upper(),
|
header.upper(),
|
||||||
data=f"Confirm message:\n{message}",
|
f"Confirm message:\n{message}",
|
||||||
br_code=BR_TYPE_OTHER,
|
br_code=BR_TYPE_OTHER,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1268,7 +1264,7 @@ async def confirm_reenter_pin(
|
|||||||
ctx,
|
ctx,
|
||||||
br_type,
|
br_type,
|
||||||
"CHECK PIN",
|
"CHECK PIN",
|
||||||
action="Please re-enter to confirm.",
|
"Please re-enter to confirm.",
|
||||||
verb="BEGIN",
|
verb="BEGIN",
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
@ -1283,7 +1279,7 @@ async def pin_mismatch(
|
|||||||
ctx,
|
ctx,
|
||||||
br_type,
|
br_type,
|
||||||
"PIN MISMATCH",
|
"PIN MISMATCH",
|
||||||
action="The PINs you entered do not match.\nPlease try again.",
|
"The PINs you entered do not match.\nPlease try again.",
|
||||||
verb="TRY AGAIN",
|
verb="TRY AGAIN",
|
||||||
verb_cancel=None,
|
verb_cancel=None,
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
@ -1302,7 +1298,7 @@ async def confirm_pin_action(
|
|||||||
ctx,
|
ctx,
|
||||||
br_type,
|
br_type,
|
||||||
title,
|
title,
|
||||||
action=f"{description} {action}",
|
f"{description} {action}",
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ async def request_word_count(ctx: wire.GenericContext, dry_run: bool) -> int:
|
|||||||
count = await interact(
|
count = await interact(
|
||||||
ctx,
|
ctx,
|
||||||
RustLayout(trezorui2.select_word_count(dry_run=dry_run)),
|
RustLayout(trezorui2.select_word_count(dry_run=dry_run)),
|
||||||
br_type="word_count",
|
"word_count",
|
||||||
br_code=ButtonRequestType.MnemonicWordCount,
|
ButtonRequestType.MnemonicWordCount,
|
||||||
)
|
)
|
||||||
# It can be returning a string
|
# It can be returning a string
|
||||||
return int(count)
|
return int(count)
|
||||||
@ -34,13 +34,9 @@ async def request_word(
|
|||||||
else:
|
else:
|
||||||
word = await interact(
|
word = await interact(
|
||||||
ctx,
|
ctx,
|
||||||
RustLayout(
|
RustLayout(trezorui2.request_word_bip39(prompt=prompt)),
|
||||||
trezorui2.request_word_bip39(
|
"request_word",
|
||||||
prompt=prompt,
|
ButtonRequestType.MnemonicInput,
|
||||||
)
|
|
||||||
),
|
|
||||||
br_type="request_word",
|
|
||||||
br_code=ButtonRequestType.MnemonicInput,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return word
|
return word
|
||||||
|
@ -26,11 +26,11 @@ async def show_share_words(
|
|||||||
ctx,
|
ctx,
|
||||||
RustLayout(
|
RustLayout(
|
||||||
trezorui2.show_share_words( # type: ignore [Arguments missing for parameters "title", "pages"]
|
trezorui2.show_share_words( # type: ignore [Arguments missing for parameters "title", "pages"]
|
||||||
share_words=share_words, # type: ignore [No parameter named "share_words"]
|
share_words=share_words # type: ignore [No parameter named "share_words"]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
br_type="backup_words",
|
"backup_words",
|
||||||
br_code=ButtonRequestType.ResetDevice,
|
ButtonRequestType.ResetDevice,
|
||||||
)
|
)
|
||||||
|
|
||||||
ready_to_check = await get_bool(
|
ready_to_check = await get_bool(
|
||||||
|
Loading…
Reference in New Issue
Block a user