Amount-join EIP-712 filtering implementation

This commit is contained in:
Alexandre Paillier
2024-04-12 11:09:06 +02:00
parent c68b4186ed
commit e76e429148
6 changed files with 486 additions and 162 deletions

View File

@@ -5,9 +5,7 @@
#include <stdint.h>
#include "ux.h"
#define UI_712_FIELD_SHOWN (1 << 0)
#define UI_712_FIELD_NAME_PROVIDED (1 << 1)
#include "uint256.h"
typedef enum { EIP712_FILTERING_BASIC, EIP712_FILTERING_FULL } e_eip712_filtering_mode;
typedef enum {
@@ -16,15 +14,6 @@ typedef enum {
EIP712_NO_MORE_FIELD
} e_eip712_nfs; // next field state
typedef struct {
bool shown;
bool end_reached;
uint8_t filtering_mode;
uint8_t filters_to_process;
uint8_t field_flags;
uint8_t structs_to_review;
} t_ui_context;
bool ui_712_init(void);
void ui_712_deinit(void);
e_eip712_nfs ui_712_next_field(void);
@@ -37,7 +26,7 @@ void ui_712_set_title(const char *const str, uint8_t length);
void ui_712_set_value(const char *const str, uint8_t length);
void ui_712_message_hash(void);
void ui_712_redraw_generic_step(void);
void ui_712_flag_field(bool show, bool name_provided);
void ui_712_flag_field(bool show, bool name_provided, bool token_join);
void ui_712_field_flags_reset(void);
void ui_712_finalize_field(void);
void ui_712_set_filtering_mode(e_eip712_filtering_mode mode);
@@ -46,6 +35,8 @@ void ui_712_set_filters_count(uint8_t count);
uint8_t ui_712_remaining_filters(void);
void ui_712_queue_struct_to_review(void);
void ui_712_notify_filter_change(void);
void ui_712_token_join_prepare_addr_check(uint8_t index);
void ui_712_token_join_prepare_amount(uint8_t index, const char *name, uint8_t name_length);
#endif // HAVE_EIP712_FULL_SUPPORT