Skip to content

Commit 22004b2

Browse files
Changes to the blind-signing flow, now hides the amount but shows the TX hash
1 parent ca54030 commit 22004b2

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

src_bagl/ui_flow_signTx.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ UX_STEP_NOCB(ux_approval_review_step,
112112
"Review",
113113
"transaction",
114114
});
115+
UX_STEP_NOCB(ux_approval_tx_hash_step,
116+
bnnn_paging,
117+
{
118+
#ifdef TARGET_NANOS
119+
.title = "TX hash",
120+
#else
121+
.title = "Transaction hash",
122+
#endif
123+
.text = strings.common.fullAmount
124+
});
115125
UX_STEP_NOCB(
116126
ux_approval_amount_step,
117127
bnnn_paging,
@@ -237,11 +247,23 @@ void ux_approve_tx(bool fromPlugin) {
237247
ux_approval_tx_flow[step++] = &ux_plugin_approval_display_step;
238248
ux_approval_tx_flow[step++] = &ux_plugin_approval_after_step;
239249
} else {
250+
if (tmpContent.txContent.dataPresent) {
251+
#pragma GCC diagnostic ignored "-Wformat"
252+
snprintf(strings.common.fullAmount,
253+
sizeof(strings.common.fullAmount),
254+
"0x%.*h",
255+
sizeof(tmpCtx.transactionContext.hash),
256+
tmpCtx.transactionContext.hash);
257+
#pragma GCC diagnostic warning "-Wformat"
258+
ux_approval_tx_flow[step++] = &ux_approval_tx_hash_step;
259+
}
240260
// We're in a regular transaction, just show the amount and the address
241261
if (strings.common.fromAddress[0] != 0) {
242262
ux_approval_tx_flow[step++] = &ux_approval_from_step;
243263
}
244-
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
264+
if (!tmpContent.txContent.dataPresent) {
265+
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
266+
}
245267
#ifdef HAVE_TRUSTED_NAME
246268
uint64_t chain_id = get_tx_chain_id();
247269
e_name_type type = TYPE_ACCOUNT;

src_nbgl/ui_approve_tx.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,30 @@ static uint8_t setTagValuePairs(void) {
120120
pairs[nbPairs].value = strings.common.maxFee;
121121
nbPairs++;
122122
} else {
123+
if (tmpContent.txContent.dataPresent) {
124+
#pragma GCC diagnostic ignored "-Wformat"
125+
snprintf(strings.common.fullAmount,
126+
sizeof(strings.common.fullAmount),
127+
"0x%.*h",
128+
sizeof(tmpCtx.transactionContext.hash),
129+
tmpCtx.transactionContext.hash);
130+
#pragma GCC diagnostic warning "-Wformat"
131+
pairs[nbPairs].item = "Transaction hash";
132+
pairs[nbPairs].value = strings.common.fullAmount;
133+
nbPairs++;
134+
}
135+
123136
if (strings.common.fromAddress[0] != 0) {
124137
pairs[nbPairs].item = "From";
125138
pairs[nbPairs].value = strings.common.fromAddress;
126139
nbPairs++;
127140
}
128141

129-
pairs[nbPairs].item = "Amount";
130-
pairs[nbPairs].value = strings.common.fullAmount;
131-
nbPairs++;
142+
if (!tmpContent.txContent.dataPresent) {
143+
pairs[nbPairs].item = "Amount";
144+
pairs[nbPairs].value = strings.common.fullAmount;
145+
nbPairs++;
146+
}
132147

133148
#ifdef HAVE_TRUSTED_NAME
134149
uint64_t chain_id = get_tx_chain_id();

0 commit comments

Comments
 (0)