From 83d3b5b644b73f55dc5921b09fc0399c493e4d47 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Tue, 13 Feb 2024 14:25:51 +0100 Subject: [PATCH] Fix swap fees ticker fallback --- src/handle_get_printable_amount.c | 4 ++++ src/handle_swap_sign_transaction.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/handle_get_printable_amount.c b/src/handle_get_printable_amount.c index a321b4f1c..5a70e881c 100644 --- a/src/handle_get_printable_amount.c +++ b/src/handle_get_printable_amount.c @@ -31,6 +31,10 @@ void handle_get_printable_amount(get_printable_amount_parameters_t* params, } // If the amount is a fee, the ticker should be the chain's native currency if (params->is_fee) { + // fallback mechanism in the absence of chain ID in swap config + if (chain_id == 0) { + chain_id = config->chainId; + } strlcpy(ticker, get_displayable_ticker(&chain_id, config), sizeof(ticker)); decimals = WEI_TO_ETHER; } diff --git a/src/handle_swap_sign_transaction.c b/src/handle_swap_sign_transaction.c index f0ca62178..fc7167a56 100644 --- a/src/handle_swap_sign_transaction.c +++ b/src/handle_swap_sign_transaction.c @@ -49,6 +49,10 @@ bool copy_transaction_parameters(create_transaction_parameters_t* sign_transacti return false; } + // fallback mechanism in the absence of chain ID in swap config + if (chain_id == 0) { + chain_id = config->chainId; + } // If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap strlcpy(ticker, get_displayable_ticker(&chain_id, config), sizeof(ticker)); decimals = WEI_TO_ETHER;