Skip to content

Commit

Permalink
get_displayable_ticker now returns a ??? ticker when it is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Feb 13, 2024
1 parent 8a1ce2f commit 729214f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ typedef struct network_info_s {
uint64_t chain_id;
} network_info_t;

static const char *unknown_ticker = "???";

// Mappping of chain ids to networks.
static const network_info_t NETWORK_MAPPING[] = {
{.chain_id = 1, .name = "Ethereum", .ticker = "ETH"},
Expand Down Expand Up @@ -140,7 +142,11 @@ const char *get_displayable_ticker(const uint64_t *chain_id, const chain_config_
const char *ticker = get_network_ticker_from_chain_id(chain_id);

if (ticker == NULL) {
ticker = chain_cfg->coinName;
if (*chain_id == chain_cfg->chainId) {
ticker = chain_cfg->coinName;
} else {
ticker = unknown_ticker;
}
}
return ticker;
}
Expand Down

0 comments on commit 729214f

Please sign in to comment.