From 4a492cae4caf9d41d1690cad14f47d63add664a1 Mon Sep 17 00:00:00 2001 From: Emma Turner Date: Fri, 5 Jan 2024 14:07:15 +0000 Subject: [PATCH] app: fix swap tests --- .github/workflows/swap.yml | 2 +- app/src/handle_swap.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/swap.yml b/.github/workflows/swap.yml index 69f993ba2..479379992 100644 --- a/.github/workflows/swap.yml +++ b/.github/workflows/swap.yml @@ -12,7 +12,7 @@ jobs: uses: functori/app-exchange/.github/workflows/reusable_swap_functional_tests.yml@ebc5932d939e2bad5eaf3d5e316626169da6ff23 with: repo_for_exchange: 'functori/app-exchange' - branch_for_exchange: 'ajinkyaraj-23@display-source-field' + branch_for_exchange: 'develop' branch_for_tezos: ${{ github.ref }} run_for_devices: '["nanos", "nanosp", "stax"]' test_filter: '"tezos_new"' diff --git a/app/src/handle_swap.c b/app/src/handle_swap.c index 7d4278801..c83bed8e6 100644 --- a/app/src/handle_swap.c +++ b/app/src/handle_swap.c @@ -33,8 +33,10 @@ #include "parser/num_parser.h" // based on app-exchange -#define TICKER_MAX_SIZE 9 +#define TICKER "XTZ" #define ADDRESS_MAX_SIZE 63 +/* the smallest unit is microtez */ +#define DECIMALS 6 /* Check check_address_parameters_t.address_to_check against specified * parameters. @@ -102,15 +104,6 @@ swap_handle_get_printable_amount(get_printable_amount_parameters_t *params) FUNC_ENTER(("params=%p", params)); uint64_t amount; - uint8_t decimals; - char ticker[TICKER_MAX_SIZE]; - - if (!swap_parse_config(params->coin_configuration, - params->coin_configuration_length, ticker, - sizeof(ticker), &decimals)) { - PRINTF("[ERROR] Fail to parse config\n"); - goto error; - } if (!swap_str_to_u64(params->amount, params->amount_length, &amount)) { PRINTF("[ERROR] Fail to parse amount\n"); @@ -119,13 +112,13 @@ swap_handle_get_printable_amount(get_printable_amount_parameters_t *params) if (!format_fpu64_trimmed(params->printable_amount, sizeof(params->printable_amount), amount, - decimals)) { + DECIMALS)) { PRINTF("[ERROR] Fail to print amount\n"); goto error; } strlcat(params->printable_amount, " ", sizeof(params->printable_amount)); - strlcat(params->printable_amount, ticker, + strlcat(params->printable_amount, TICKER, sizeof(params->printable_amount)); FUNC_LEAVE();