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

feat(core/ethereum): new ETH contract flow #4270

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ static void _librust_qstrs(void) {
MP_QSTR_buttons__try_again;
MP_QSTR_buttons__turn_off;
MP_QSTR_buttons__turn_on;
MP_QSTR_buttons__view_all_data;
MP_QSTR_can_go_back;
MP_QSTR_cancel_arrow;
MP_QSTR_cancel_cross;
Expand Down Expand Up @@ -217,8 +218,10 @@ static void _librust_qstrs(void) {
MP_QSTR_debug__loading_seed;
MP_QSTR_debug__loading_seed_not_recommended;
MP_QSTR_decode;
MP_QSTR_default_cancel;
MP_QSTR_deinit;
MP_QSTR_description;
MP_QSTR_description_font_green;
MP_QSTR_details_title;
MP_QSTR_device_name__change_template;
MP_QSTR_device_name__title;
Expand Down Expand Up @@ -347,6 +350,7 @@ static void _librust_qstrs(void) {
MP_QSTR_notification;
MP_QSTR_notification_level;
MP_QSTR_page_count;
MP_QSTR_page_limit;
MP_QSTR_pages;
MP_QSTR_paint;
MP_QSTR_passphrase__access_wallet;
Expand Down Expand Up @@ -728,6 +732,7 @@ static void _librust_qstrs(void) {
MP_QSTR_value;
MP_QSTR_verb;
MP_QSTR_verb_cancel;
MP_QSTR_verb_info;
MP_QSTR_verify;
MP_QSTR_version;
MP_QSTR_warning;
Expand Down Expand Up @@ -800,6 +805,7 @@ static void _librust_qstrs(void) {
MP_QSTR_words__title_threshold;
MP_QSTR_words__try_again;
MP_QSTR_words__unknown;
MP_QSTR_words__view_all_data_from_menu;
MP_QSTR_words__warning;
MP_QSTR_words__writable;
MP_QSTR_words__yes;
Expand Down Expand Up @@ -978,6 +984,7 @@ static void _librust_qstrs(void) {
MP_QSTR_ethereum__data_size_template;
MP_QSTR_ethereum__gas_limit;
MP_QSTR_ethereum__gas_price;
MP_QSTR_ethereum__interaction_contract;
MP_QSTR_ethereum__max_gas_price;
MP_QSTR_ethereum__name_and_version;
MP_QSTR_ethereum__new_contract;
Expand All @@ -996,13 +1003,15 @@ static void _librust_qstrs(void) {
MP_QSTR_ethereum__staking_stake_intro;
MP_QSTR_ethereum__staking_unstake;
MP_QSTR_ethereum__staking_unstake_intro;
MP_QSTR_ethereum__title_confirm_data;
MP_QSTR_ethereum__title_confirm_domain;
MP_QSTR_ethereum__title_confirm_message;
MP_QSTR_ethereum__title_confirm_struct;
MP_QSTR_ethereum__title_confirm_typed_data;
MP_QSTR_ethereum__title_input_data;
MP_QSTR_ethereum__title_signing_address;
MP_QSTR_ethereum__token_contract;
MP_QSTR_ethereum__units_template;
MP_QSTR_ethereum__unknown_contract_address;
MP_QSTR_ethereum__unknown_token;
MP_QSTR_ethereum__valid_signature;
MP_QSTR_fido__already_registered;
Expand Down
30 changes: 27 additions & 3 deletions core/embed/rust/src/translations/generated/translated_string.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions core/embed/rust/src/ui/flow/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct SwipePage<T> {
axis: Axis,
pages: usize,
current: usize,
limit: Option<usize>,
}

impl<T: Component + Paginate> SwipePage<T> {
Expand All @@ -23,6 +24,7 @@ impl<T: Component + Paginate> SwipePage<T> {
axis: Axis::Vertical,
pages: 1,
current: 0,
limit: None,
}
}

Expand All @@ -33,12 +35,18 @@ impl<T: Component + Paginate> SwipePage<T> {
axis: Axis::Horizontal,
pages: 1,
current: 0,
limit: None,
}
}

pub fn inner(&self) -> &T {
&self.inner
}

pub fn with_limit(mut self, limit: Option<usize>) -> Self {
self.limit = limit;
self
}
}

impl<T: Component + Paginate> Component for SwipePage<T> {
Expand All @@ -47,6 +55,9 @@ impl<T: Component + Paginate> Component for SwipePage<T> {
fn place(&mut self, bounds: Rect) -> Rect {
self.bounds = self.inner.place(bounds);
self.pages = self.inner.page_count();
if let Some(limit) = self.limit {
self.pages = self.pages.min(limit);
}
self.bounds
}

Expand Down
5 changes: 5 additions & 0 deletions core/embed/rust/src/ui/model_mercury/component/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ where
self.with_button(theme::ICON_MENU, FlowMsg::Info, true)
}

pub fn with_danger_menu_button(self) -> Self {
self.with_button(theme::ICON_MENU, FlowMsg::Info, true)
.button_styled(theme::button_warning_high())
}

pub fn with_warning_low_icon(self) -> Self {
self.with_button(theme::ICON_WARNING, FlowMsg::Info, false)
.button_styled(theme::button_warning_low())
Expand Down
Loading
Loading