Skip to content

Commit

Permalink
Now shows non-zero amounts in blind-signing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Dec 13, 2024
1 parent 61eef99 commit 26fcd2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/shared_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ typedef struct txStringProperties_s {
char maxFee[50];
char nonce[8]; // 10M tx per account ought to be enough for everybody
char network_name[NETWORK_STRING_MAX_SIZE + 1];
char tx_hash[2 + (INT256_LENGTH * 2) + 1];
} txStringProperties_t;

#ifdef TARGET_NANOS
Expand Down
9 changes: 5 additions & 4 deletions src_bagl/ui_flow_signTx.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ UX_STEP_NOCB(ux_approval_tx_hash_step,
#else
.title = "Transaction hash",
#endif
.text = strings.common.fullAmount
.text = strings.common.tx_hash
});
UX_STEP_NOCB(
ux_approval_amount_step,
Expand Down Expand Up @@ -249,8 +249,8 @@ void ux_approve_tx(bool fromPlugin) {
} else {
if (tmpContent.txContent.dataPresent) {
#pragma GCC diagnostic ignored "-Wformat"
snprintf(strings.common.fullAmount,
sizeof(strings.common.fullAmount),
snprintf(strings.common.tx_hash,
sizeof(strings.common.tx_hash),
"0x%.*h",
sizeof(tmpCtx.transactionContext.hash),
tmpCtx.transactionContext.hash);
Expand All @@ -261,7 +261,8 @@ void ux_approve_tx(bool fromPlugin) {
if (strings.common.fromAddress[0] != 0) {
ux_approval_tx_flow[step++] = &ux_approval_from_step;
}
if (!tmpContent.txContent.dataPresent) {
if (!tmpContent.txContent.dataPresent ||
!allzeroes(tmpContent.txContent.value.value, tmpContent.txContent.value.length)) {
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
}
#ifdef HAVE_TRUSTED_NAME
Expand Down
9 changes: 5 additions & 4 deletions src_nbgl/ui_approve_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ static uint8_t setTagValuePairs(void) {
} else {
if (tmpContent.txContent.dataPresent) {
#pragma GCC diagnostic ignored "-Wformat"
snprintf(strings.common.fullAmount,
sizeof(strings.common.fullAmount),
snprintf(strings.common.tx_hash,
sizeof(strings.common.tx_hash),
"0x%.*h",
sizeof(tmpCtx.transactionContext.hash),
tmpCtx.transactionContext.hash);
#pragma GCC diagnostic warning "-Wformat"
pairs[nbPairs].item = "Transaction hash";
pairs[nbPairs].value = strings.common.fullAmount;
pairs[nbPairs].value = strings.common.tx_hash;
nbPairs++;
}

Expand All @@ -139,7 +139,8 @@ static uint8_t setTagValuePairs(void) {
nbPairs++;
}

if (!tmpContent.txContent.dataPresent) {
if (!tmpContent.txContent.dataPresent ||
!allzeroes(tmpContent.txContent.value.value, tmpContent.txContent.value.length)) {
pairs[nbPairs].item = "Amount";
pairs[nbPairs].value = strings.common.fullAmount;
nbPairs++;
Expand Down

0 comments on commit 26fcd2a

Please sign in to comment.