Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Tmp #57

Closed
wants to merge 8 commits into from
Closed

Tmp #57

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/swap/handle_get_printable_amount.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,5 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params) {
return 0;
}

size_t amount_len = strlen(params->printable_amount);
size_t remaining_len = sizeof(params->printable_amount) - amount_len;

// Check that we have enough space left to append ticker.
if (remaining_len < sizeof(TICKER_WITH_SPACE)) {
return 0;
}

// Append the ticker at the end of the amount.
strlcat(params->printable_amount, TICKER_WITH_SPACE, sizeof(params->printable_amount));

return 1;
}
2 changes: 0 additions & 2 deletions src/swap/swap_lib_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#define CHECK_ADDRESS 3
#define GET_PRINTABLE_AMOUNT 4

#define TICKER_WITH_SPACE " XTZ"

// structure that should be sent to specific coin application to get address
typedef struct check_address_parameters_s {
// IN
Expand Down
17 changes: 14 additions & 3 deletions src/to_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#define TEZOS_HASH_CHECKSUM_SIZE 4

#define TICKER_WITH_SPACE " XTZ"

void pkh_to_string(char *const buff,
size_t const buff_size,
signature_type_t const signature_type,
Expand Down Expand Up @@ -266,7 +268,7 @@ void microtez_to_string_indirect(char *const dest,
uint64_t const *const number) {
check_null(dest);
check_null(number);
if (buff_size < MAX_INT_DIGITS + 1)
if (buff_size < MAX_INT_DIGITS + sizeof(TICKER_WITH_SPACE) + 1)
THROW(EXC_WRONG_LENGTH); // + terminating null + decimal point
microtez_to_string(dest, *number);
}
Expand All @@ -278,7 +280,8 @@ int microtez_to_string_indirect_no_throw(char *const dest,
if (!dest || !number) {
return (0);
}
if (buff_size < MAX_INT_DIGITS + 1) { // + terminating null + decimal point
if (buff_size <
MAX_INT_DIGITS + sizeof(TICKER_WITH_SPACE) + 1) { // + terminating null + decimal point
return (0);
}
// Can safely call `microtez_to_string` because we know dest is not NULL.
Expand Down Expand Up @@ -308,6 +311,10 @@ size_t microtez_to_string(char *const dest, uint64_t number) {
uint64_t fractional = number % TEZ_SCALE;
size_t off = number_to_string(dest, whole_tez);
if (fractional == 0) {
// Append the ticker at the end of the amount.
memcpy(dest + off, TICKER_WITH_SPACE, sizeof(TICKER_WITH_SPACE));
off += sizeof(TICKER_WITH_SPACE);

return off;
}
dest[off++] = '.';
Expand All @@ -328,7 +335,11 @@ size_t microtez_to_string(char *const dest, uint64_t number) {
size_t length = end - start;
memcpy(dest + off, start, length);
off += length;
dest[off] = '\0';

// Append the ticker at the end of the amount.
memcpy(dest + off, TICKER_WITH_SPACE, sizeof(TICKER_WITH_SPACE));
off += sizeof(TICKER_WITH_SPACE);

return off;
}

Expand Down
8 changes: 7 additions & 1 deletion src/ui_sign_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ bool prompt_transaction(struct parsed_operation_group const *const ops,

push_ui_callback("Fee", microtez_to_string_indirect, &ops->total_fee);
push_ui_callback("Source", parsed_contract_to_string, &ops->operation.source);
push_ui_callback("Delegate", parsed_contract_to_string, &ops->operation.destination);
if (withdrawal) {
push_ui_callback("Delegate",
parsed_contract_to_string,
&ops->operation.destination);
} else {
push_ui_callback("Operation", copy_string, "Withdraw delegation");
}
push_ui_callback("Delegate Name",
lookup_parsed_contract_name,
&ops->operation.destination);
Expand Down
11 changes: 8 additions & 3 deletions src/ui_sign_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ bool prompt_transaction(struct parsed_operation_group const *const ops,

char *type_msg;
if (withdrawal) {
transactionContext.confirmed_status = "DELEGATION\nCONFIRMED";
transactionContext.confirmed_status = "DELEGATION\nWITHDRAWN";
transactionContext.cancelled_status = "Delegation withdrawal\ncancelled";

type_msg = "Withdraw Delegation";
Expand Down Expand Up @@ -395,8 +395,13 @@ bool prompt_transaction(struct parsed_operation_group const *const ops,
transactionContext.tagValuePair[1].item = "Source";
transactionContext.tagValuePair[1].value = transactionContext.buffer[1];

transactionContext.tagValuePair[2].item = "Delegate";
transactionContext.tagValuePair[2].value = transactionContext.buffer[2];
if (withdrawal) {
transactionContext.tagValuePair[2].item = "Operation";
transactionContext.tagValuePair[2].value = "Withdraw delegation";
} else {
transactionContext.tagValuePair[2].item = "Delegate";
transactionContext.tagValuePair[2].value = transactionContext.buffer[2];
}

transactionContext.tagValuePair[3].item = "Delegate Name";
transactionContext.tagValuePair[3].value = transactionContext.buffer[3];
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/python/tests_baking/snapshots/stax/test_reset_HMW/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tools/BakersRegistryCoreUnfilteredData.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"bakerName": "Obsidian",
"bakerAccount": "tz1eY5Aqa1kXDFoiebL28emyXFoneAoVg1zh"
"bakerAccount": "tz1N4GQ8gYgMdq6gUsja783KJButHUHn5K7z"
},
{
"bakerName": "Tezos Capital Legacy",
Expand Down Expand Up @@ -420,7 +420,7 @@
"bakerAccount": "tz1Z3KCf8CLGAYfvVWPEr562jDDyWkwNF7sT"
},
{
"bakerName": "Figment Networks",
"bakerName": "Chorus One - 2",
"bakerAccount": "tz1Scdr2HsZiQjc7bHMeBbmDRXYVvdhjJbBh"
},
{
Expand Down