2023-02-21 11:01:18 +01:00
|
|
|
#include <nbgl_page.h>
|
|
|
|
|
#include "shared_context.h"
|
|
|
|
|
#include "ui_callbacks.h"
|
|
|
|
|
#include "ui_nbgl.h"
|
2023-08-09 11:38:17 +02:00
|
|
|
#include "network.h"
|
2023-09-11 10:00:46 +02:00
|
|
|
#include "network_icons.h"
|
2023-02-21 11:01:18 +01:00
|
|
|
|
2023-08-09 11:38:17 +02:00
|
|
|
static void cancel_send(void) {
|
2023-02-21 11:01:18 +01:00
|
|
|
io_seproxyhal_touch_address_cancel(NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-09 11:38:17 +02:00
|
|
|
static void confirm_send(void) {
|
2023-02-21 11:01:18 +01:00
|
|
|
io_seproxyhal_touch_address_ok(NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-09 11:38:17 +02:00
|
|
|
static void review_choice(bool confirm) {
|
2023-02-21 11:01:18 +01:00
|
|
|
if (confirm) {
|
2024-04-09 18:52:28 +02:00
|
|
|
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, confirm_send);
|
2023-02-21 11:01:18 +01:00
|
|
|
} else {
|
2024-04-09 18:52:28 +02:00
|
|
|
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_REJECTED, cancel_send);
|
2023-02-21 11:01:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-09 11:38:17 +02:00
|
|
|
void ui_display_public_key(const uint64_t *chain_id) {
|
2023-09-11 10:00:46 +02:00
|
|
|
const nbgl_icon_details_t *icon;
|
|
|
|
|
|
2023-08-09 11:38:17 +02:00
|
|
|
// - if a chain_id is given and it's - known, we specify its network name
|
|
|
|
|
// - unknown, we don't specify anything
|
|
|
|
|
// - if no chain_id is given we specify the APPNAME (legacy behaviour)
|
|
|
|
|
strlcpy(g_stax_shared_buffer, "Verify ", sizeof(g_stax_shared_buffer));
|
|
|
|
|
if (chain_id != NULL) {
|
|
|
|
|
if (chain_is_ethereum_compatible(chain_id)) {
|
|
|
|
|
strlcat(g_stax_shared_buffer,
|
|
|
|
|
get_network_name_from_chain_id(chain_id),
|
|
|
|
|
sizeof(g_stax_shared_buffer));
|
|
|
|
|
strlcat(g_stax_shared_buffer, "\n", sizeof(g_stax_shared_buffer));
|
|
|
|
|
}
|
2023-09-11 10:00:46 +02:00
|
|
|
icon = get_network_icon_from_chain_id(chain_id);
|
2023-08-09 11:38:17 +02:00
|
|
|
} else {
|
|
|
|
|
strlcat(g_stax_shared_buffer, APPNAME "\n", sizeof(g_stax_shared_buffer));
|
2023-09-11 10:00:46 +02:00
|
|
|
icon = get_app_icon(false);
|
2023-08-09 11:38:17 +02:00
|
|
|
}
|
|
|
|
|
strlcat(g_stax_shared_buffer, "address", sizeof(g_stax_shared_buffer));
|
2024-03-11 16:14:31 +01:00
|
|
|
nbgl_useCaseAddressReview(strings.common.toAddress,
|
2024-04-09 18:52:28 +02:00
|
|
|
NULL,
|
|
|
|
|
icon,
|
|
|
|
|
g_stax_shared_buffer,
|
|
|
|
|
NULL,
|
|
|
|
|
review_choice);
|
2023-02-21 11:01:18 +01:00
|
|
|
}
|