Skip to content

Commit 45ddada

Browse files
committed
feat: ui refinement for sapling part
1 parent 67ed930 commit 45ddada

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

rust/apps/zcash/src/pczt/parse.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,14 @@ pub fn parse_pczt<P: consensus::Parameters>(
156156
let total_transfer_value = format_zec_value((total_output_value - total_change_value) as f64);
157157
let fee_value = format_zec_value((total_input_value - total_output_value) as f64);
158158

159+
let has_sapling = pczt.sapling().spends().len() > 0 || pczt.sapling().outputs().len() > 0;
160+
159161
Ok(ParsedPczt::new(
160162
parsed_transparent,
161163
parsed_orchard,
162164
total_transfer_value,
163165
fee_value,
166+
has_sapling,
164167
))
165168
}
166169

@@ -392,7 +395,7 @@ fn parse_orchard_output<P: consensus::Parameters>(
392395

393396
Ok(Some(ParsedTo::new(
394397
if is_internal {
395-
"wallet-internal".to_string()
398+
"<internal-address>".to_string()
396399
} else {
397400
user_address.clone().unwrap_or(ua)
398401
},

rust/apps/zcash/src/pczt/structs.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ impl_public_struct!(ParsedPczt {
55
transparent: Option<ParsedTransparent>,
66
orchard: Option<ParsedOrchard>,
77
total_transfer_value: String,
8-
fee_value: String
8+
fee_value: String,
9+
has_sapling: bool
910
});
1011

1112
impl_public_struct!(ParsedTransparent {

rust/rust_c/src/zcash/src/structs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub struct DisplayPczt {
2121
pub orchard: Ptr<DisplayOrchard>,
2222
pub total_transfer_value: PtrString,
2323
pub fee_value: PtrString,
24+
pub has_sapling: bool,
2425
}
2526

2627
impl From<&ParsedPczt> for DisplayPczt {
@@ -36,6 +37,7 @@ impl From<&ParsedPczt> for DisplayPczt {
3637
.unwrap_or(null_mut()),
3738
total_transfer_value: convert_c_char(pczt.get_total_transfer_value()),
3839
fee_value: convert_c_char(pczt.get_fee_value()),
40+
has_sapling: pczt.get_has_sapling(),
3941
}
4042
}
4143
}

src/ui/gui_chain/others/gui_zcash.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ void GuiZcashOverview(lv_obj_t *parent, void *totalData) {
5959
lv_obj_add_flag(container, LV_OBJ_FLAG_SCROLLABLE);
6060
lv_obj_add_flag(container, LV_OBJ_FLAG_CLICKABLE);
6161

62-
lv_obj_t* last_view = CreateTransactionItemView(container, _("Amount"), g_zcashData->total_transfer_value, NULL);
62+
lv_obj_t* last_view = NULL;
63+
64+
if(g_zcashData->has_sapling) {
65+
last_view = CreateTransactionItemView(container, _("Warning"), _("This transaction contains Sapling spends or outputs. Keystone does not support Sapling spend signing and output checking. Please take care of the potential risks."), last_view);
66+
}
67+
68+
last_view = CreateTransactionItemView(container, _("Amount"), g_zcashData->total_transfer_value, last_view);
6369
last_view = CreateTransactionItemView(container, _("Fee"), g_zcashData->fee_value, last_view);
6470

6571
if(g_zcashData->transparent != NULL) {

0 commit comments

Comments
 (0)