stax eip712

This commit is contained in:
Clement Bouvet
2023-02-07 18:05:56 +01:00
parent 1f6cb4cb37
commit b7f83c1581
2 changed files with 78 additions and 7 deletions
+16 -4
View File
@@ -8,16 +8,17 @@ static const char* const infoContents[] = {APPVERSION, "(c) 2022 Ledger"};
enum {
BLIND_SIGNING_TOKEN = FIRST_USER_TOKEN,
DEBUG_TOKEN,
NONCE_TOKEN
NONCE_TOKEN,
EIP712_VERBOSE_TOKEN
};
static nbgl_layoutSwitch_t switches[3];
static nbgl_layoutSwitch_t switches[4];
static bool navCallback(uint8_t page, nbgl_pageContent_t* content) {
switches[0] = (nbgl_layoutSwitch_t) {
.initState = N_storage.dataAllowed ? ON_STATE : OFF_STATE,
.text = "Blind signing",
.subText = "Enable transaction blind\nsigning",
.subText = "Enable transaction blind signing",
.token = BLIND_SIGNING_TOKEN,
.tuneId = TUNE_TAP_CASUAL
};
@@ -35,12 +36,19 @@ static bool navCallback(uint8_t page, nbgl_pageContent_t* content) {
.token = NONCE_TOKEN,
.tuneId = TUNE_TAP_CASUAL
};
switches[3] = (nbgl_layoutSwitch_t) {
.initState = N_storage.verbose_eip712 ? ON_STATE : OFF_STATE,
.text = "Verbose EIP712",
.subText = "Ignore filtering and\ndisplay raw content",
.token = EIP712_VERBOSE_TOKEN,
.tuneId = TUNE_TAP_CASUAL
};
switch (page)
{
case 0:
content->type = SWITCHES_LIST;
content->switchesList.nbSwitches = 3;
content->switchesList.nbSwitches = 4;
content->switchesList.switches = (nbgl_layoutSwitch_t*)switches;
break;
@@ -75,6 +83,10 @@ static void controlsCallback(int token, uint8_t index) {
value = (N_storage.displayNonce ? 0 : 1);
nvm_write((void*) &N_storage.displayNonce, (void*) &value, sizeof(uint8_t));
break;
case EIP712_VERBOSE_TOKEN:
value = (N_storage.verbose_eip712 ? 0 : 1);
nvm_write((void*) &N_storage.verbose_eip712, (void*) &value, sizeof(uint8_t));
break;
}
}