1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 21:48:17 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Veljko Vuckovic
681caed5da
Merge 50f7a41490 into 13df961317 2024-12-02 22:40:26 +01:00
Ioan Bizău
13df961317 refactor(core/ui): introduce show_danger
This is a unified interface for flow_warning_hi_prio,
which was available only on Mercury before.

[no changelog]
2024-12-02 22:28:00 +01:00
Martin Milata
92a0e9d6c7 ci: work around rate limit, no UI comment for legacy 2024-12-02 21:41:13 +01:00
Veljko Vuckovic
50f7a41490
Added Avian AVN coin support 2024-06-19 02:15:21 +02:00
13 changed files with 476 additions and 394 deletions

View File

@ -712,6 +712,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sleep 1m # try avoiding github api rate limit
- uses: ./.github/actions/ui-comment
core_upload_emu:

View File

@ -139,6 +139,8 @@ jobs:
status: ${{ job.status }}
continue-on-error: true
if: ${{ always() && matrix.coins == 'universal' }}
- run: echo "${{ env.PULL_COMMENT }}" >> $GITHUB_STEP_SUMMARY
if: ${{ always() && matrix.coins == 'universal' }}
legacy_upgrade_test:
name: Upgrade test
@ -217,14 +219,6 @@ jobs:
aws s3 sync --only-show-errors master_diff s3://data.trezor.io/dev/firmware/master_diff/${{ github.run_id }}
continue-on-error: true
legacy_ui_comment:
name: Post comment with UI diff URLs
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ui-comment
legacy_upload_emu:
name: Upload emulator binaries
if: github.event_name == 'schedule'

View File

@ -0,0 +1,44 @@
{
"coin_name": "Avian",
"coin_shortcut": "AVN",
"coin_label": "Avian",
"website": "https://avn.network",
"github": "https://github.com/AvianNetwork/Avian",
"maintainer": "Admin <contact@avn.network>",
"curve_name": "secp256k1",
"decimals": 8,
"address_type": 60,
"address_type_p2sh": 122,
"maxfee_kb": 170000000000,
"minfee_kb": 1000,
"signed_message_header": "Raven Signed Message:\n",
"hash_genesis_block": "000000cdb10fc01df7fba251f2168ef7cd7854b571049db4902c315694461dd0",
"xprv_magic": 76066276,
"xpub_magic": 76067358,
"xpub_magic_segwit_p2sh": null,
"xpub_magic_segwit_native": null,
"xpub_magic_multisig_segwit_p2sh": null,
"xpub_magic_multisig_segwit_native": null,
"bech32_prefix": null,
"cashaddr_prefix": null,
"slip44": 921,
"segwit": false,
"taproot": false,
"decred": false,
"fork_id": 64,
"force_bip143": false,
"default_fee_b": {
"Low": 10
},
"dust_limit": 546,
"blocktime_seconds": 30,
"uri_prefix": "avian",
"min_address_length": 27,
"max_address_length": 34,
"negative_fee": false,
"cooldown": 100,
"overwintered": false,
"extra_data": false,
"timestamp": false,
"confidential_assets": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -262,7 +262,6 @@ static void _librust_qstrs(void) {
MP_QSTR_flow_request_number;
MP_QSTR_flow_request_passphrase;
MP_QSTR_flow_show_share_words;
MP_QSTR_flow_warning_hi_prio;
MP_QSTR_get_language;
MP_QSTR_get_transition_out;
MP_QSTR_haptic_feedback__disable;
@ -652,6 +651,7 @@ static void _librust_qstrs(void) {
MP_QSTR_share_words__wrote_down_all;
MP_QSTR_show_address_details;
MP_QSTR_show_checklist;
MP_QSTR_show_danger;
MP_QSTR_show_error;
MP_QSTR_show_group_share_success;
MP_QSTR_show_homescreen;

View File

@ -12,10 +12,10 @@ pub mod prompt_backup;
pub mod request_number;
pub mod request_passphrase;
pub mod set_brightness;
pub mod show_danger;
pub mod show_share_words;
pub mod show_tutorial;
pub mod util;
pub mod warning_hi_prio;
pub use confirm_action::{
new_confirm_action, new_confirm_action_simple, ConfirmActionExtra, ConfirmActionMenuStrings,
@ -34,7 +34,7 @@ pub use prompt_backup::PromptBackup;
pub use request_number::RequestNumber;
pub use request_passphrase::RequestPassphrase;
pub use set_brightness::SetBrightness;
pub use show_danger::ShowDanger;
pub use show_share_words::ShowShareWords;
pub use show_tutorial::ShowTutorial;
pub use util::{ConfirmBlobParams, ShowInfoParams};
pub use warning_hi_prio::WarningHiPrio;

View File

@ -22,13 +22,13 @@ use super::super::{
};
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum WarningHiPrio {
pub enum ShowDanger {
Message,
Menu,
Cancelled,
}
impl FlowController for WarningHiPrio {
impl FlowController for ShowDanger {
#[inline]
fn index(&'static self) -> usize {
*self as usize
@ -57,7 +57,7 @@ impl FlowController for WarningHiPrio {
const EXTRA_PADDING: i16 = 6;
pub fn new_warning_hi_prio(
pub fn new_show_danger(
title: TString<'static>,
description: TString<'static>,
value: TString<'static>,
@ -106,9 +106,9 @@ pub fn new_warning_hi_prio(
.with_result_icon(theme::ICON_BULLET_CHECKMARK, theme::GREY_DARK)
.map(|_| Some(FlowMsg::Cancelled));
let res = SwipeFlow::new(&WarningHiPrio::Message)?
.with_page(&WarningHiPrio::Message, content_message)?
.with_page(&WarningHiPrio::Menu, content_menu)?
.with_page(&WarningHiPrio::Cancelled, content_cancelled)?;
let res = SwipeFlow::new(&ShowDanger::Message)?
.with_page(&ShowDanger::Message, content_message)?
.with_page(&ShowDanger::Menu, content_menu)?
.with_page(&ShowDanger::Cancelled, content_cancelled)?;
Ok(res)
}

View File

@ -1491,7 +1491,7 @@ extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map
panic!();
}
extern "C" fn new_warning_hi_prio(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
extern "C" fn new_show_danger(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
@ -1501,8 +1501,7 @@ extern "C" fn new_warning_hi_prio(n_args: usize, args: *const Obj, kwargs: *mut
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;
let flow =
flow::warning_hi_prio::new_warning_hi_prio(title, description, value, verb_cancel)?;
let flow = flow::show_danger::new_show_danger(title, description, value, verb_cancel)?;
Ok(LayoutObj::new_root(flow)?.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
@ -1717,6 +1716,16 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// """Warning modal. No buttons shown when `button` is empty string."""
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
/// def show_danger(
/// *,
/// title: str,
/// description: str,
/// value: str = "",
/// verb_cancel: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """Warning modal that makes it easier to cancel than to continue."""
Qstr::MP_QSTR_show_danger => obj_fn_kw!(0, new_show_danger).as_obj(),
/// def show_success(
/// *,
/// title: str,
@ -1971,16 +1980,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// """Get address / receive funds."""
Qstr::MP_QSTR_flow_get_address => obj_fn_kw!(0, new_get_address).as_obj(),
/// def flow_warning_hi_prio(
/// *,
/// title: str,
/// description: str,
/// value: str = "",
/// verb_cancel: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """Warning modal with multiple steps to confirm."""
Qstr::MP_QSTR_flow_warning_hi_prio => obj_fn_kw!(0, new_warning_hi_prio).as_obj(),
/// def flow_confirm_output(
/// *,
/// title: str | None,

View File

@ -216,6 +216,17 @@ def show_warning(
"""Warning modal. No buttons shown when `button` is empty string."""
# rust/src/ui/model_mercury/layout.rs
def show_danger(
*,
title: str,
description: str,
value: str = "",
verb_cancel: str | None = None,
) -> LayoutObj[UiResult]:
"""Warning modal that makes it easier to cancel than to continue."""
# rust/src/ui/model_mercury/layout.rs
def show_success(
*,
@ -497,17 +508,6 @@ def flow_get_address(
"""Get address / receive funds."""
# rust/src/ui/model_mercury/layout.rs
def flow_warning_hi_prio(
*,
title: str,
description: str,
value: str = "",
verb_cancel: str | None = None,
) -> LayoutObj[UiResult]:
"""Warning modal with multiple steps to confirm."""
# rust/src/ui/model_mercury/layout.rs
def flow_confirm_output(
*,

View File

@ -119,29 +119,27 @@ def confirm_path_warning(
if not path_type
else f"{TR.words__unknown} {path_type.lower()}."
)
return raise_if_not_confirmed(
trezorui2.flow_warning_hi_prio(
title=f"{TR.words__warning}!", description=description, value=path
),
return show_danger(
"path_warning",
description,
value=path,
verb_cancel=TR.words__cancel_and_exit,
br_code=ButtonRequestType.UnknownDerivationPath,
)
def confirm_multisig_warning() -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui2.flow_warning_hi_prio(
title=f"{TR.words__important}!",
description=TR.send__receiving_to_multisig,
),
return show_danger(
"warning_multisig",
br_code=ButtonRequestType.Warning,
TR.send__receiving_to_multisig,
title=TR.words__important,
verb_cancel=TR.words__cancel_and_exit,
)
def confirm_multisig_different_paths_warning() -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui2.flow_warning_hi_prio(
trezorui2.show_danger(
title=f"{TR.words__important}!",
description="Using different paths for different XPUBs.",
),
@ -327,6 +325,28 @@ def show_warning(
)
def show_danger(
br_name: str,
content: str,
value: str | None = None,
title: str | None = None,
verb_cancel: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.Warning,
) -> Awaitable[None]:
title = title or TR.words__warning
verb_cancel = verb_cancel or TR.buttons__cancel
return raise_if_not_confirmed(
trezorui2.show_danger(
title=title,
description=content,
value=(value or ""),
verb_cancel=verb_cancel,
),
br_name,
br_code,
)
def show_success(
br_name: str,
content: str,
@ -724,14 +744,10 @@ def _confirm_summary(
if not utils.BITCOIN_ONLY:
def confirm_ethereum_unknown_contract_warning() -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui2.flow_warning_hi_prio(
title=TR.words__warning,
description=TR.ethereum__unknown_contract_address,
verb_cancel=TR.send__cancel_sign,
),
return show_danger(
"unknown_contract_warning",
ButtonRequestType.Warning,
TR.ethereum__unknown_contract_address,
verb_cancel=TR.send__cancel_sign,
)
async def confirm_ethereum_tx(

View File

@ -420,6 +420,24 @@ def show_warning(
)
def show_danger(
br_name: str,
content: str,
value: str | None = None,
title: str | None = None,
verb_cancel: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.Warning,
) -> Awaitable[ui.UiResult]:
title = title or TR.words__warning
return show_warning(
br_name,
title,
content,
TR.words__continue_anyway,
br_code=br_code,
)
def show_success(
br_name: str,
content: str,
@ -564,7 +582,6 @@ def confirm_blob(
title: str,
data: bytes | str,
description: str | None = None,
text_mono: bool = True,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None, # icon
@ -815,11 +832,8 @@ def confirm_total(
if not utils.BITCOIN_ONLY:
def confirm_ethereum_unknown_contract_warning() -> Awaitable[ui.UiResult]:
return show_warning(
"unknown_contract_warning",
TR.words__warning,
TR.ethereum__unknown_contract_address_short,
TR.words__continue_anyway,
return show_danger(
"unknown_contract_warning", TR.ethereum__unknown_contract_address_short
)
async def confirm_ethereum_staking_tx(

View File

@ -372,6 +372,22 @@ def show_warning(
)
def show_danger(
br_name: str,
content: str,
value: str | None = None,
title: str | None = None,
verb_cancel: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.Warning,
) -> Awaitable[None]:
return show_warning(
br_name,
content,
TR.words__continue_anyway_question,
br_code=br_code,
)
def show_success(
br_name: str,
content: str,
@ -779,10 +795,8 @@ def _confirm_summary(
if not utils.BITCOIN_ONLY:
def confirm_ethereum_unknown_contract_warning() -> Awaitable[None]:
return show_warning(
"unknown_contract_warning",
TR.ethereum__unknown_contract_address_short,
TR.words__continue_anyway_question,
return show_danger(
"unknown_contract_warning", TR.ethereum__unknown_contract_address_short
)
async def confirm_ethereum_tx(

File diff suppressed because it is too large Load Diff