Completely remove old Starkware internal "plugin"

This commit is contained in:
Alexandre Paillier
2024-02-13 10:40:01 +01:00
parent adbe34c696
commit ea1709b0ea
40 changed files with 1 additions and 2984 deletions

View File

@@ -1,29 +0,0 @@
#include <nbgl_page.h>
#include "shared_context.h"
#include "ui_callbacks.h"
#include "ui_nbgl.h"
static void reviewReject(void) {
io_seproxyhal_touch_address_cancel(NULL);
}
static void confirmTransation(void) {
io_seproxyhal_touch_stark_pubkey_ok(NULL);
}
static void reviewChoice(bool confirm) {
if (confirm) {
// display a status page and go back to main
nbgl_useCaseStatus("ADDRESS\nVERIFIED", true, confirmTransation);
} else {
nbgl_useCaseStatus("Address verification\ncancelled", false, reviewReject);
}
}
static void buildScreen(void) {
nbgl_useCaseAddressConfirmation(strings.tmp.tmp, reviewChoice);
}
void ui_display_stark_public(void) {
buildScreen();
}

View File

@@ -1,68 +0,0 @@
#include "common_ui.h"
#include "ui_signing.h"
#include "ui_nbgl.h"
#include "ui_callbacks.h"
#include "nbgl_use_case.h"
#include "network.h"
#ifdef HAVE_STARKWARE
static nbgl_layoutTagValue_t pairs[3];
static void reviewReject(void) {
io_seproxyhal_touch_tx_cancel(NULL);
}
static void confirmTransation(void) {
io_seproxyhal_touch_stark_ok(NULL);
}
static void reviewChoice(bool confirm) {
if (confirm) {
confirmTransation();
} else {
reviewReject();
}
}
static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
if (page == 0) {
pairs[0].item = "Sell";
pairs[0].value = strings.common.fullAmount;
pairs[1].item = "Buy";
pairs[1].value = strings.common.maxFee;
pairs[2].item = "Token Account";
pairs[2].value = strings.common.fullAddress;
content->type = TAG_VALUE_LIST;
content->tagValueList.nbPairs = 3;
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
} else if (page == 1) {
content->type = INFO_LONG_PRESS, content->infoLongPress.icon = get_app_icon(false);
content->infoLongPress.text = "Review stark limit order";
content->infoLongPress.longPressText = SIGN_BUTTON;
} else {
return false;
}
// valid page so return true
return true;
}
static void reviewContinue(void) {
nbgl_useCaseRegularReview(0, 2, REJECT_BUTTON, NULL, displayTransactionPage, reviewChoice);
}
static void buildFirstPage(void) {
nbgl_useCaseReviewStart(get_app_icon(false),
"Review stark limit order",
NULL,
REJECT_BUTTON,
reviewContinue,
reviewReject);
}
void ui_stark_limit_order(void) {
buildFirstPage();
}
#endif

View File

@@ -1,134 +0,0 @@
#include <nbgl_page.h>
#include "shared_context.h"
#include "ui_callbacks.h"
#include "ui_nbgl.h"
#include "ui_signing.h"
#include "starkDisplayUtils.h"
#include "network.h"
#ifdef HAVE_STARKWARE
static nbgl_layoutTagValue_t pairs[3];
static char condAddressBuffer[43];
struct stark_transfer_context {
bool selfTransfer;
bool conditional;
};
static struct stark_transfer_context context;
static void reviewReject(void) {
io_seproxyhal_touch_tx_cancel(NULL);
}
static void confirmTransation(void) {
io_seproxyhal_touch_stark_ok(NULL);
}
static void reviewChoice(bool confirm) {
if (confirm) {
confirmTransation();
} else {
reviewReject();
}
}
static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
uint8_t count = 0;
if (page == 0) {
pairs[count].item = "Amount";
pairs[count].value = tmpContent.tmp;
count++;
if (context.selfTransfer == false && context.conditional == false) {
pairs[count].item = "Master Account";
pairs[count].value = strings.tmp.tmp;
count++;
}
if (context.conditional) {
stark_sign_display_master_account();
pairs[count].item = "Master Account";
pairs[count].value = strings.tmp.tmp;
count++;
}
pairs[count].item = "Token Account";
pairs[count].value = strings.tmp.tmp2;
count++;
content->type = TAG_VALUE_LIST;
content->tagValueList.nbPairs = count;
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
return true;
}
if (page == 1) {
if (context.conditional) {
if (!getEthDisplayableAddress(dataContext.starkContext.conditionAddress,
condAddressBuffer,
sizeof(condAddressBuffer),
&global_sha3,
chainConfig->chainId)) {
return false;
}
pairs[0].item = "Cond. Address";
pairs[0].value = condAddressBuffer;
stark_sign_display_condition_fact();
pairs[1].item = "Cond. Address";
pairs[1].value = strings.tmp.tmp;
content->type = TAG_VALUE_LIST;
content->tagValueList.nbPairs = 2;
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
return true;
} else {
page++;
}
}
if (page == 2) {
content->type = INFO_LONG_PRESS, content->infoLongPress.icon = get_app_icon(false);
content->infoLongPress.text = "Review transaction";
content->infoLongPress.longPressText = SIGN_BUTTON;
return true;
}
return false;
}
static void reviewContinue(void) {
nbgl_useCaseRegularReview(0,
context.conditional ? 3 : 2,
REJECT_BUTTON,
NULL,
displayTransactionPage,
reviewChoice);
}
void ui_stark_transfer(bool selfTransfer, bool conditional) {
context.selfTransfer = selfTransfer;
context.conditional = conditional;
char *subTitle;
if (conditional) {
if (selfTransfer) {
subTitle = (char *) "Conditional Self Transfer";
} else {
subTitle = (char *) "Conditional Transfer";
}
} else {
if (selfTransfer) {
subTitle = (char *) "Self Transfer";
} else {
subTitle = (char *) "Transfer";
}
}
nbgl_useCaseReviewStart(get_app_icon(false),
"Review stark\ntransaction",
subTitle,
REJECT_BUTTON,
reviewContinue,
reviewReject);
}
#endif // #ifdef HAVE_STARKWARE

View File

@@ -1,70 +0,0 @@
#include "common_ui.h"
#include "ui_signing.h"
#include "ui_nbgl.h"
#include "ui_callbacks.h"
#include "nbgl_use_case.h"
#include "network.h"
#ifdef HAVE_STARKWARE
static nbgl_layoutTagValue_t pairs[2];
static char from_account[64];
static char message_hash[64];
static void reviewReject(void) {
io_seproxyhal_touch_tx_cancel(NULL);
}
static void confirmTransation(void) {
io_seproxyhal_touch_stark_unsafe_sign_ok(NULL);
}
static void reviewChoice(bool confirm) {
if (confirm) {
confirmTransation();
} else {
reviewReject();
}
}
static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
snprintf(from_account, sizeof(from_account), "0x%.*H", 32, dataContext.starkContext.w1);
snprintf(message_hash, sizeof(message_hash), "0x%.*H", 32, dataContext.starkContext.w2);
if (page == 0) {
pairs[0].item = "From Account";
pairs[0].value = from_account;
pairs[1].item = "Hash";
pairs[1].value = message_hash;
content->type = TAG_VALUE_LIST;
content->tagValueList.nbPairs = 2;
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
} else if (page == 1) {
content->type = INFO_LONG_PRESS, content->infoLongPress.icon = get_app_icon(false);
content->infoLongPress.text = "Unsafe Stark Sign";
content->infoLongPress.longPressText = SIGN_BUTTON;
} else {
return false;
}
// valid page so return true
return true;
}
static void reviewContinue(void) {
nbgl_useCaseRegularReview(0, 2, REJECT_BUTTON, NULL, displayTransactionPage, reviewChoice);
}
static void buildFirstPage(void) {
nbgl_useCaseReviewStart(get_app_icon(false),
"Unsafe Stark Sign",
NULL,
REJECT_BUTTON,
reviewContinue,
reviewReject);
}
void ui_stark_unsafe_sign(void) {
buildFirstPage();
}
#endif // HAVE_STARKWARE