Skip to content

Commit 87a4791

Browse files
Unified unknown ticker definition
1 parent e721b34 commit 87a4791

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/network.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "shared_context.h"
77
#include "common_utils.h"
88

9-
static const char *unknown_ticker = "???";
9+
const char g_unknown_ticker[] = "???";
1010

1111
// Mapping of chain ids to networks.
1212
static const network_info_t NETWORK_MAPPING[] = {
@@ -180,7 +180,7 @@ const char *get_displayable_ticker(const uint64_t *chain_id, const chain_config_
180180
if (*chain_id == chain_cfg->chainId) {
181181
ticker = chain_cfg->coinName;
182182
} else {
183-
ticker = unknown_ticker;
183+
ticker = g_unknown_ticker;
184184
}
185185
}
186186
return ticker;

src/network.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typedef struct network_info_s {
2424
} while (0)
2525

2626
extern network_info_t DYNAMIC_NETWORK_INFO[];
27+
extern const char g_unknown_ticker[];
2728

2829
const char *get_network_name_from_chain_id(const uint64_t *chain_id);
2930
const char *get_network_ticker_from_chain_id(const uint64_t *chain_id);

src_features/signMessageEIP712/ui_logic.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "uint_common.h"
2121
#include "filtering.h"
2222
#include "trusted_name.h"
23+
#include "network.h"
2324

2425
#define AMOUNT_JOIN_FLAG_TOKEN (1 << 0)
2526
#define AMOUNT_JOIN_FLAG_VALUE (1 << 1)
@@ -449,12 +450,14 @@ static bool ui_712_format_amount_join(void) {
449450
ismaxint(ui_ctx->amount.joins[ui_ctx->amount.idx].value,
450451
ui_ctx->amount.joins[ui_ctx->amount.idx].value_length)) {
451452
strlcpy(strings.tmp.tmp, "Unlimited ", sizeof(strings.tmp.tmp));
452-
strlcat(strings.tmp.tmp, (token != NULL) ? token->ticker : "???", sizeof(strings.tmp.tmp));
453+
strlcat(strings.tmp.tmp,
454+
(token != NULL) ? token->ticker : g_unknown_ticker,
455+
sizeof(strings.tmp.tmp));
453456
} else {
454457
if (!amountToString(ui_ctx->amount.joins[ui_ctx->amount.idx].value,
455458
ui_ctx->amount.joins[ui_ctx->amount.idx].value_length,
456459
(token != NULL) ? token->decimals : 0,
457-
(token != NULL) ? token->ticker : "???",
460+
(token != NULL) ? token->ticker : g_unknown_ticker,
458461
strings.tmp.tmp,
459462
sizeof(strings.tmp.tmp))) {
460463
return false;

0 commit comments

Comments
 (0)