Skip to content

Commit

Permalink
feat(core/ethereum): new ETH contract flow
Browse files Browse the repository at this point in the history
  • Loading branch information
ibz committed Oct 30, 2024
1 parent 2e0e8eb commit fd30397
Show file tree
Hide file tree
Showing 43 changed files with 1,149 additions and 524 deletions.
1 change: 1 addition & 0 deletions core/.changelog.d/4251.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New EVM call contract flow.
12 changes: 11 additions & 1 deletion core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ static void _librust_qstrs(void) {
MP_QSTR_button;
MP_QSTR_button_event;
MP_QSTR_button_request;
MP_QSTR_button_style_confirm;
MP_QSTR_buttons__abort;
MP_QSTR_buttons__access;
MP_QSTR_buttons__again;
Expand Down Expand Up @@ -167,6 +168,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 @@ -218,8 +220,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 @@ -307,6 +311,7 @@ static void _librust_qstrs(void) {
MP_QSTR_instructions__swipe_up;
MP_QSTR_instructions__tap_to_confirm;
MP_QSTR_instructions__tap_to_start;
MP_QSTR_instructions__view_all_data;
MP_QSTR_is_type_of;
MP_QSTR_items;
MP_QSTR_items_title;
Expand Down Expand Up @@ -349,6 +354,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 @@ -730,6 +736,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 @@ -980,6 +987,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 @@ -998,13 +1006,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
34 changes: 29 additions & 5 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.

3 changes: 3 additions & 0 deletions core/embed/rust/src/ui/component/paginated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub enum PageMsg<T> {
/// Cancelled using page controls.
Cancelled,

/// Info button pressed
Info,

/// Page component was configured to react to swipes and user swiped left.
SwipeLeft,

Expand Down
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

0 comments on commit fd30397

Please sign in to comment.