diff --git a/src/ui/nbgl_display_transaction.c b/src/ui/nbgl_display_transaction.c index 905f7c1..7799f77 100755 --- a/src/ui/nbgl_display_transaction.c +++ b/src/ui/nbgl_display_transaction.c @@ -51,8 +51,9 @@ static char g_amount[30]; // Buffer where the transaction address string is written static char g_address[ECDSA_ADDRESS_LEN + 6]; +static char g_fees[30]; -static nbgl_layoutTagValue_t pairs[2]; +static nbgl_layoutTagValue_t pairs[3]; static nbgl_layoutTagValueList_t pairList; static nbgl_pageInfoLongPress_t infoLongPress; @@ -86,12 +87,14 @@ static void review_continue(void) { // Setup data to display pairs[0].item = "Amount"; pairs[0].value = g_amount; - pairs[1].item = "Address"; - pairs[1].value = g_address; + pairs[1].item = "Fees"; + pairs[1].value = g_fees; + pairs[2].item = "To"; + pairs[2].value = g_address; // Setup list pairList.nbMaxLinesForValue = 0; - pairList.nbPairs = 2; + pairList.nbPairs = 3; pairList.pairs = pairs; // Info long press @@ -104,7 +107,7 @@ static void review_continue(void) { // Public function to start the transaction review // - Check if the app is in the right state for transaction review -// - Format the amount and address strings in g_amount and g_address buffers +// - Format the amount and address strings in g_amount, g-fees and g_address buffers // - Display the first screen of the transaction review int ui_display_transaction() { if (G_context.req_type != CONFIRM_TRANSACTION || G_context.state != STATE_PARSED) { @@ -122,6 +125,20 @@ int ui_display_transaction() { return io_send_sw(SW_DISPLAY_AMOUNT_FAIL); } snprintf(g_amount, sizeof(g_amount), "KAS %.*s", sizeof(amount), amount); + + memset(g_fees, 0, sizeof(g_fees)); + char fees[30] = {0}; + if (!format_fpu64_trimmed(fees, + sizeof(fees), + calc_fees(G_context.tx_info.transaction.tx_inputs, + G_context.tx_info.transaction.tx_input_len, + G_context.tx_info.transaction.tx_outputs, + G_context.tx_info.transaction.tx_output_len), + EXPONENT_SMALLEST_UNIT)) { + return io_send_sw(SW_DISPLAY_AMOUNT_FAIL); + } + snprintf(g_fees, sizeof(g_fees), "KAS %.*s", sizeof(fees), fees); + memset(g_address, 0, sizeof(g_address)); uint8_t address[ECDSA_ADDRESS_LEN] = {0}; diff --git a/tests/snapshots/stax/test_sign_tx_max/00001.png b/tests/snapshots/stax/test_sign_tx_max/00001.png index 53b6011..cf77cb8 100644 Binary files a/tests/snapshots/stax/test_sign_tx_max/00001.png and b/tests/snapshots/stax/test_sign_tx_max/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_p2sh/00001.png b/tests/snapshots/stax/test_sign_tx_p2sh/00001.png index 0fa48cf..9b46a96 100644 Binary files a/tests/snapshots/stax/test_sign_tx_p2sh/00001.png and b/tests/snapshots/stax/test_sign_tx_p2sh/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_refused/part1/00001.png b/tests/snapshots/stax/test_sign_tx_refused/part1/00001.png index 24e633a..8a2dbe1 100644 Binary files a/tests/snapshots/stax/test_sign_tx_refused/part1/00001.png and b/tests/snapshots/stax/test_sign_tx_refused/part1/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_refused/part2/00001.png b/tests/snapshots/stax/test_sign_tx_refused/part2/00001.png index 24e633a..8a2dbe1 100644 Binary files a/tests/snapshots/stax/test_sign_tx_refused/part2/00001.png and b/tests/snapshots/stax/test_sign_tx_refused/part2/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple/00001.png b/tests/snapshots/stax/test_sign_tx_simple/00001.png index 24e633a..8a2dbe1 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple/00001.png and b/tests/snapshots/stax/test_sign_tx_simple/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_change_idx1/00001.png b/tests/snapshots/stax/test_sign_tx_simple_change_idx1/00001.png index ab0c75e..5068657 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_change_idx1/00001.png and b/tests/snapshots/stax/test_sign_tx_simple_change_idx1/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_ecdsa/00001.png b/tests/snapshots/stax/test_sign_tx_simple_ecdsa/00001.png index 5bad9b2..c667ccb 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_ecdsa/00001.png and b/tests/snapshots/stax/test_sign_tx_simple_ecdsa/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendint/00001.png b/tests/snapshots/stax/test_sign_tx_simple_sendint/00001.png index 4486134..708d44a 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_sendint/00001.png and b/tests/snapshots/stax/test_sign_tx_simple_sendint/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00001.png b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00001.png index e97fbf5..c010fe3 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00001.png and b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00001.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00002.png b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00002.png index 3c651ba..91b61c2 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00002.png and b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00002.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00003.png b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00003.png index cd2f527..fd4ac86 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00003.png and b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00003.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00004.png b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00004.png index ad6b72e..cd2f527 100644 Binary files a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00004.png and b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00004.png differ diff --git a/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00005.png b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00005.png new file mode 100644 index 0000000..ad6b72e Binary files /dev/null and b/tests/snapshots/stax/test_sign_tx_simple_sendmaxu64/00005.png differ diff --git a/tests/snapshots/stax/test_sign_tx_with_change/00001.png b/tests/snapshots/stax/test_sign_tx_with_change/00001.png index 8b4ab2b..76b019f 100644 Binary files a/tests/snapshots/stax/test_sign_tx_with_change/00001.png and b/tests/snapshots/stax/test_sign_tx_with_change/00001.png differ