mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 14:58:09 +00:00
feat(core/rust): show fee rate in modify-fee dialogue
This commit is contained in:
parent
db38b708b4
commit
5940129bfc
@ -839,6 +839,9 @@ extern "C" fn new_confirm_modify_fee(n_args: usize, args: *const Obj, kwargs: *m
|
||||
let sign: i32 = kwargs.get(Qstr::MP_QSTR_sign)?.try_into()?;
|
||||
let user_fee_change: StrBuffer = kwargs.get(Qstr::MP_QSTR_user_fee_change)?.try_into()?;
|
||||
let total_fee_new: StrBuffer = kwargs.get(Qstr::MP_QSTR_total_fee_new)?.try_into()?;
|
||||
let fee_rate_amount: Option<StrBuffer> = kwargs
|
||||
.get(Qstr::MP_QSTR_fee_rate_amount)?
|
||||
.try_into_option()?;
|
||||
|
||||
let (description, change) = match sign {
|
||||
s if s < 0 => ("Decrease your fee by:", user_fee_change),
|
||||
@ -846,12 +849,22 @@ extern "C" fn new_confirm_modify_fee(n_args: usize, args: *const Obj, kwargs: *m
|
||||
_ => ("Your fee did not change.", StrBuffer::empty()),
|
||||
};
|
||||
|
||||
let paragraphs = Paragraphs::new([
|
||||
Paragraph::new(&theme::TEXT_NORMAL, description.into()),
|
||||
Paragraph::new(&theme::TEXT_MONO, change),
|
||||
Paragraph::new(&theme::TEXT_NORMAL, "\nTransaction fee:".into()),
|
||||
Paragraph::new(&theme::TEXT_MONO, total_fee_new),
|
||||
]);
|
||||
let mut paragraphs_vec = ParagraphVecShort::new();
|
||||
paragraphs_vec
|
||||
.add(Paragraph::new(&theme::TEXT_NORMAL, description.into()))
|
||||
.add(Paragraph::new(&theme::TEXT_MONO, change))
|
||||
.add(Paragraph::new(
|
||||
&theme::TEXT_NORMAL,
|
||||
"Transaction fee:".into(),
|
||||
))
|
||||
.add(Paragraph::new(&theme::TEXT_MONO, total_fee_new));
|
||||
|
||||
if let Some(fee_rate_amount) = fee_rate_amount {
|
||||
paragraphs_vec
|
||||
.add(Paragraph::new(&theme::TEXT_NORMAL, "Fee rate:".into()))
|
||||
.add(Paragraph::new(&theme::TEXT_MONO, fee_rate_amount));
|
||||
}
|
||||
let paragraphs = paragraphs_vec.into_paragraphs();
|
||||
|
||||
let obj = LayoutObj::new(Frame::left_aligned(
|
||||
theme::label_title(),
|
||||
@ -1692,6 +1705,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
||||
/// sign: int,
|
||||
/// user_fee_change: str,
|
||||
/// total_fee_new: str,
|
||||
/// fee_rate_amount: str | None,
|
||||
/// ) -> object:
|
||||
/// """Decrease or increase transaction fee."""
|
||||
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
||||
|
Loading…
Reference in New Issue
Block a user