This commit is contained in:
Alexandre Paillier
2024-06-19 11:24:13 +02:00
committed by Charles-Edouard de la Vergne
parent 18889d667b
commit e503373411
3 changed files with 28 additions and 20 deletions

View File

@@ -221,6 +221,11 @@ void ux_approve_tx(bool fromPlugin) {
if (fromPlugin) {
// Add the special dynamic display logic
ux_approval_tx_flow[step++] = &ux_plugin_approval_id_step;
if (pluginType != EXTERNAL) {
if (strings.common.fromAddress[0] != 0) {
ux_approval_tx_flow[step++] = &ux_approval_from_step;
}
}
ux_approval_tx_flow[step++] = &ux_plugin_approval_before_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_display_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_after_step;
@@ -234,6 +239,9 @@ void ux_approve_tx(bool fromPlugin) {
uint64_t chain_id = get_tx_chain_id();
if (has_domain_name(&chain_id, tmpContent.txContent.destination)) {
ux_approval_tx_flow[step++] = &ux_domain_name_step;
if (N_storage.verbose_domain_name) {
ux_approval_tx_flow[step++] = &ux_approval_to_step;
}
} else {
#endif // HAVE_DOMAIN_NAME
ux_approval_tx_flow[step++] = &ux_approval_to_step;
@@ -242,8 +250,6 @@ void ux_approve_tx(bool fromPlugin) {
#endif // HAVE_DOMAIN_NAME
}
ux_approval_tx_flow[step++] = &ux_approval_fees_step;
if (N_storage.displayNonce) {
ux_approval_tx_flow[step++] = &ux_approval_nonce_step;
}
@@ -253,6 +259,7 @@ void ux_approve_tx(bool fromPlugin) {
ux_approval_tx_flow[step++] = &ux_approval_network_step;
}
ux_approval_tx_flow[step++] = &ux_approval_fees_step;
ux_approval_tx_flow[step++] = &ux_approval_accept_step;
ux_approval_tx_flow[step++] = &ux_approval_reject_step;
ux_approval_tx_flow[step++] = FLOW_END_STEP;

View File

@@ -349,6 +349,12 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
uint8_t msg_sender[ADDRESS_LENGTH] = {0};
get_public_key(msg_sender, sizeof(msg_sender));
address_to_string(msg_sender,
ADDRESS_LENGTH,
strings.common.fromAddress,
sizeof(strings.common.fromAddress),
chainConfig->chainId);
PRINTF("FROM address displayed: %s\n", strings.common.fromAddress);
// Finalize the plugin handling
if (dataContext.tokenContext.pluginStatus >= ETH_PLUGIN_RESULT_SUCCESSFUL) {
eth_plugin_prepare_finalize(&pluginFinalize);
@@ -473,7 +479,7 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
} else {
strlcpy(strings.common.toAddress, displayBuffer, sizeof(strings.common.toAddress));
}
PRINTF("Address displayed: %s\n", strings.common.toAddress);
PRINTF("TO address displayed: %s\n", strings.common.toAddress);
// Format the amount in a temporary buffer, if in swap case compare it with validated
// amount, else commit it
@@ -499,19 +505,6 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
strlcpy(strings.common.fullAmount, displayBuffer, sizeof(strings.common.fullAmount));
}
PRINTF("Amount displayed: %s\n", strings.common.fullAmount);
if (G_called_from_swap) {
// Transaction parameters are managed by the Exchange caller app!
explicit_bzero(strings.common.fromAddress, sizeof(strings.common.fromAddress));
} else {
// Format the from address in a temporary buffer
address_to_string(msg_sender,
ADDRESS_LENGTH,
strings.common.fromAddress,
sizeof(strings.common.fromAddress),
chainConfig->chainId);
PRINTF("FROM Address displayed: %s\n", strings.common.fromAddress);
}
}
// Compute the max fee in a temporary buffer, if in swap case compare it with validated max fee,

View File

@@ -93,6 +93,13 @@ static uint8_t setTagValuePairs(void) {
// Setup data to display
if (tx_approval_context.fromPlugin) {
if (pluginType != EXTERNAL) {
if (strings.common.fromAddress[0] != 0) {
pairs[nbPairs].item = "From";
pairs[nbPairs].value = strings.common.fromAddress;
nbPairs++;
}
}
for (pairIndex = 0; pairIndex < dataContext.tokenContext.pluginUiMaxItems; pairIndex++) {
// for the next dataContext.tokenContext.pluginUiMaxItems items, get tag/value from
// plugin_ui_get_item_internal()
@@ -143,15 +150,16 @@ static uint8_t setTagValuePairs(void) {
#ifdef HAVE_DOMAIN_NAME
}
#endif
pairs[nbPairs].item = "Max fees";
pairs[nbPairs].value = strings.common.maxFee;
nbPairs++;
if (N_storage.displayNonce) {
pairs[nbPairs].item = "Nonce";
pairs[nbPairs].value = strings.common.nonce;
nbPairs++;
}
pairs[nbPairs].item = "Max fees";
pairs[nbPairs].value = strings.common.maxFee;
nbPairs++;
if (tx_approval_context.displayNetwork) {
pairs[nbPairs].item = "Network";
pairs[nbPairs].value = strings.common.network_name;