Add setting to display detailed fees
This commit is contained in:
@@ -61,6 +61,7 @@ void handle_swap_sign_transaction(chain_config_t* config) {
|
||||
storage.contractDetails = 0x00;
|
||||
storage.initialized = 0x01;
|
||||
storage.displayNonce = 0x00;
|
||||
storage.contractDetails = 0x00;
|
||||
nvm_write((void*) &N_storage, (void*) &storage, sizeof(internalStorage_t));
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ strings_t strings;
|
||||
cx_sha3_t global_sha3;
|
||||
|
||||
uint8_t appState;
|
||||
bool dataPresent;
|
||||
bool called_from_swap;
|
||||
bool externalPluginIsSet;
|
||||
#ifdef HAVE_STARKWARE
|
||||
@@ -779,6 +778,7 @@ void coin_main(chain_config_t *coin_config) {
|
||||
#endif
|
||||
storage.contractDetails = 0x00;
|
||||
storage.displayNonce = 0x00;
|
||||
storage.displayFeeDetails = 0x00;
|
||||
storage.initialized = 0x01;
|
||||
nvm_write((void *) &N_storage, (void *) &storage, sizeof(internalStorage_t));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ typedef struct internalStorage_t {
|
||||
unsigned char dataAllowed;
|
||||
unsigned char contractDetails;
|
||||
unsigned char displayNonce;
|
||||
unsigned char displayFeeDetails;
|
||||
uint8_t initialized;
|
||||
} internalStorage_t;
|
||||
|
||||
@@ -165,7 +166,8 @@ typedef enum {
|
||||
typedef struct txStringProperties_t {
|
||||
char fullAddress[43];
|
||||
char fullAmount[50];
|
||||
char maxFee[50];
|
||||
char maxFee[50]; // Used as BaseFee when detailing fees
|
||||
char priorityFee[50];
|
||||
char nonce[8]; // 10M tx per account ought to be enough for everybody
|
||||
char chainID[8]; // 10M different chainID ought to be enough for people to find a unique
|
||||
// chainID for their token / chain.
|
||||
@@ -195,7 +197,6 @@ extern cx_sha3_t global_sha3;
|
||||
extern const internalStorage_t N_storage_real;
|
||||
|
||||
extern bool called_from_swap;
|
||||
extern bool dataPresent;
|
||||
extern bool externalPluginIsSet;
|
||||
extern uint8_t appState;
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
@@ -5,6 +5,7 @@ void display_settings(const ux_flow_step_t* const start_step);
|
||||
void switch_settings_contract_data(void);
|
||||
void switch_settings_display_data(void);
|
||||
void switch_settings_display_nonce(void);
|
||||
void switch_settings_display_fee_details(void);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// clang-format off
|
||||
@@ -78,6 +79,15 @@ UX_STEP_CB(
|
||||
.text = strings.common.fullAddress + 26
|
||||
});
|
||||
|
||||
UX_STEP_CB(
|
||||
ux_settings_flow_4_step,
|
||||
bnnn_paging,
|
||||
switch_settings_display_fee_details(),
|
||||
{
|
||||
.title = "Fee Details",
|
||||
.text = strings.common.fullAddress + 40
|
||||
});
|
||||
|
||||
#else
|
||||
|
||||
UX_STEP_CB(
|
||||
@@ -113,10 +123,21 @@ UX_STEP_CB(
|
||||
strings.common.fullAddress + 26
|
||||
});
|
||||
|
||||
UX_STEP_CB(
|
||||
ux_settings_flow_4_step,
|
||||
bnnn,
|
||||
switch_settings_display_fee_details(),
|
||||
{
|
||||
"Fee Details",
|
||||
"Display fee details",
|
||||
"when possible",
|
||||
strings.common.fullAddress + 40
|
||||
});
|
||||
|
||||
#endif
|
||||
|
||||
UX_STEP_CB(
|
||||
ux_settings_flow_4_step,
|
||||
ux_settings_flow_5_step,
|
||||
pb,
|
||||
ui_idle(),
|
||||
{
|
||||
@@ -129,7 +150,8 @@ UX_FLOW(ux_settings_flow,
|
||||
&ux_settings_flow_1_step,
|
||||
&ux_settings_flow_2_step,
|
||||
&ux_settings_flow_3_step,
|
||||
&ux_settings_flow_4_step);
|
||||
&ux_settings_flow_4_step,
|
||||
&ux_settings_flow_5_step);
|
||||
|
||||
void display_settings(const ux_flow_step_t* const start_step) {
|
||||
strcpy(strings.common.fullAddress, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"));
|
||||
@@ -137,6 +159,8 @@ void display_settings(const ux_flow_step_t* const start_step) {
|
||||
(N_storage.contractDetails ? "Displayed" : "NOT Displayed"));
|
||||
strcpy(strings.common.fullAddress + 26,
|
||||
(N_storage.displayNonce ? "Displayed" : "NOT Displayed"));
|
||||
strcpy(strings.common.fullAddress + 40,
|
||||
(N_storage.displayFeeDetails ? "Displayed" : "NOT Displayed"));
|
||||
ux_flow_init(0, ux_settings_flow, start_step);
|
||||
}
|
||||
|
||||
@@ -157,3 +181,9 @@ void switch_settings_display_nonce() {
|
||||
nvm_write((void*) &N_storage.displayNonce, (void*) &value, sizeof(uint8_t));
|
||||
display_settings(&ux_settings_flow_3_step);
|
||||
}
|
||||
|
||||
void switch_settings_display_fee_details() {
|
||||
uint8_t value = (N_storage.displayFeeDetails ? 0 : 1);
|
||||
nvm_write((void*) &N_storage.displayFeeDetails, (void*) &value, sizeof(uint8_t));
|
||||
display_settings(&ux_settings_flow_4_step);
|
||||
}
|
||||
Reference in New Issue
Block a user