Merge pull request #6 from LedgerHQ/cbo-test-clone-icon
Pass clones icon to ETH for display
This commit is contained in:
@@ -69,6 +69,7 @@ ICONNAME=icons/nanos_app_$(CHAIN).gif
|
||||
else ifeq ($(TARGET_NAME),TARGET_FATSTACKS)
|
||||
ICONNAME=icons/stax_app_$(CHAIN).gif
|
||||
DEFINES += ICONGLYPH=C_stax_app_$(CHAIN)_64px
|
||||
DEFINES += ICONBITMAP=C_stax_app_$(CHAIN)_64px_bitmap
|
||||
DEFINES += ICONGLYPH_SMALL=C_stax_app_$(CHAIN)
|
||||
GLYPH_FILES += icons/stax_app_$(CHAIN)_64px.gif
|
||||
GLYPH_FILES += icons/stax_app_$(CHAIN).gif
|
||||
|
||||
@@ -76,10 +76,17 @@ typedef enum chain_kind_e {
|
||||
CHAIN_KIND_ID4GOOD
|
||||
} chain_kind_t;
|
||||
|
||||
#ifdef HAVE_NBGL
|
||||
#include "ui_nbgl.h"
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
typedef struct chain_config_s {
|
||||
char coinName[10]; // ticker
|
||||
uint64_t chainId;
|
||||
chain_kind_t kind;
|
||||
#ifdef HAVE_NBGL
|
||||
nbgl_icon_details_t coinIconDetails;
|
||||
#endif // HAVE_NBGL
|
||||
} chain_config_t;
|
||||
|
||||
#define ETHEREUM_MAINNET_CHAINID 1
|
||||
|
||||
@@ -1068,6 +1068,13 @@ __attribute__((section(".boot"))) int main(int arg0) {
|
||||
unsigned int libcall_params[5];
|
||||
chain_config_t local_chainConfig;
|
||||
init_coin_config(&local_chainConfig);
|
||||
#ifdef HAVE_NBGL
|
||||
uint8_t coinIcon[sizeof(ICONBITMAP)];
|
||||
memcpy(coinIcon, &ICONBITMAP, sizeof(ICONBITMAP));
|
||||
memcpy(&local_chainConfig.coinIconDetails, &ICONGLYPH, sizeof(ICONGLYPH));
|
||||
local_chainConfig.coinIconDetails.bitmap = coinIcon;
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
PRINTF("Hello from Eth-clone\n");
|
||||
check_api_level(CX_COMPAT_APILEVEL);
|
||||
// delegate to Ethereum app/lib
|
||||
@@ -1076,6 +1083,7 @@ __attribute__((section(".boot"))) int main(int arg0) {
|
||||
libcall_params[2] = RUN_APPLICATION;
|
||||
libcall_params[3] = (unsigned int) &local_chainConfig;
|
||||
libcall_params[4] = 0;
|
||||
|
||||
if (arg0) {
|
||||
// call as a library
|
||||
libcall_params[2] = ((unsigned int *) arg0)[1];
|
||||
|
||||
@@ -83,6 +83,17 @@ uint64_t get_app_chain_id(void) {
|
||||
return chainConfig->chainId;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NBGL
|
||||
#include "glyphs.h"
|
||||
const nbgl_icon_details_t* get_app_chain_icon(void) {
|
||||
if (chainConfig->coinIconDetails.bitmap) {
|
||||
return &chainConfig->coinIconDetails; // if called from a clone, the bitmap is correct
|
||||
} else {
|
||||
return &ICONGLYPH; // else, jsu return the ETH icon
|
||||
}
|
||||
}
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
static uint64_t get_chain_id(e_net_type type) {
|
||||
return (type == APP) ? get_app_chain_id() : get_tx_chain_id();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ typedef struct network_info_s {
|
||||
// Returns the chain ID. Defaults to 0 if txType was not found (For TX).
|
||||
uint64_t get_tx_chain_id(void);
|
||||
uint64_t get_app_chain_id(void);
|
||||
|
||||
#ifdef HAVE_NBGL
|
||||
const nbgl_icon_details_t* get_app_chain_icon(void);
|
||||
#endif // HAVE_NBGL
|
||||
// Returns a pointer to the network name, or NULL if there is none.
|
||||
const char *get_tx_network_name(void);
|
||||
const char *get_app_network_name(void);
|
||||
|
||||
@@ -191,7 +191,7 @@ static void reviewContinueCommon(void) {
|
||||
useCaseTagValueList.nbPairs = nbPairs; ///< number of pairs in pairs array
|
||||
useCaseTagValueList.smallCaseForValue = false;
|
||||
useCaseTagValueList.wrapping = false;
|
||||
infoLongPress.icon = &ICONGLYPH;
|
||||
infoLongPress.icon = get_app_chain_icon();
|
||||
infoLongPress.text = tx_approval_context.fromPlugin ? transaction_type : "Review transaction";
|
||||
infoLongPress.longPressText = "Hold to sign";
|
||||
nbgl_useCaseStaticReview(&useCaseTagValueList, &infoLongPress, "Reject transaction", reviewChoice);
|
||||
@@ -202,9 +202,9 @@ static void buildFirstPage(void) {
|
||||
if (tx_approval_context.fromPlugin) {
|
||||
plugin_ui_get_id();
|
||||
SPRINTF(transaction_type, "Review %s\ntransaction:\n%s", strings.common.fullAddress,strings.common.fullAmount);
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, transaction_type, NULL, "Reject transaction", reviewContinue, rejectTransactionQuestion);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), transaction_type, NULL, "Reject transaction", reviewContinue, rejectTransactionQuestion);
|
||||
} else {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Review transaction", NULL, "Reject transaction", reviewContinue, rejectTransactionQuestion);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Review transaction", NULL, "Reject transaction", reviewContinue, rejectTransactionQuestion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "common_ui.h"
|
||||
#include "ui_nbgl.h"
|
||||
#include "network.h"
|
||||
|
||||
static nbgl_layoutTagValue_t tlv;
|
||||
|
||||
@@ -30,7 +31,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Confirm parameter";
|
||||
content->infoLongPress.longPressText = "Hold to confirm";
|
||||
}
|
||||
@@ -47,7 +48,7 @@ static void reviewContinue(void) {
|
||||
}
|
||||
|
||||
static void buildScreen(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Verify parameter", NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Verify parameter", NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_confirm_parameter(void) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "common_ui.h"
|
||||
#include "ui_nbgl.h"
|
||||
#include "network.h"
|
||||
|
||||
static nbgl_layoutTagValue_t tlv;
|
||||
|
||||
@@ -30,7 +31,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Confirm selector";
|
||||
content->infoLongPress.longPressText = "Hold to confirm";
|
||||
}
|
||||
@@ -47,7 +48,7 @@ static void reviewContinue(void) {
|
||||
}
|
||||
|
||||
static void buildScreen(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Verify selector", NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Verify selector", NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_confirm_selector(void) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ui_nbgl.h"
|
||||
#include "ui_callbacks.h"
|
||||
#include "nbgl_use_case.h"
|
||||
#include "network.h"
|
||||
|
||||
static nbgl_layoutTagValue_t tlv[2];
|
||||
static char* review_string;
|
||||
@@ -37,7 +38,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = review_string;
|
||||
content->infoLongPress.longPressText = "Hold to approve";
|
||||
}
|
||||
@@ -53,7 +54,7 @@ static void reviewContinue(void) {
|
||||
}
|
||||
|
||||
static void buildFirstPage(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, review_string, NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), review_string, NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_display_privacy_public_key(void) {
|
||||
|
||||
+16
-17
@@ -22,14 +22,14 @@ void app_quit(void) {
|
||||
|
||||
void ui_idle(void) {
|
||||
if (plugin_name != NULL) { // plugin
|
||||
nbgl_useCasePlugInHome((char*)plugin_name,
|
||||
APPNAME,
|
||||
&ICONGLYPH_SMALL,
|
||||
NULL,
|
||||
NULL,
|
||||
true,
|
||||
ui_menu_settings,
|
||||
app_quit);
|
||||
nbgl_useCasePlugInHome((char*)plugin_name,
|
||||
APPNAME,
|
||||
&ICONGLYPH_SMALL,
|
||||
NULL,
|
||||
NULL,
|
||||
true,
|
||||
ui_menu_settings,
|
||||
app_quit);
|
||||
} else {
|
||||
char *app_name = (char*) get_app_network_name();
|
||||
|
||||
@@ -39,7 +39,7 @@ void ui_idle(void) {
|
||||
case 3: // Ropsten
|
||||
case 5: // Goerli
|
||||
nbgl_useCaseHome(app_name,
|
||||
&ICONGLYPH,
|
||||
get_app_chain_icon(),
|
||||
NULL,
|
||||
true,
|
||||
ui_menu_settings,
|
||||
@@ -47,14 +47,13 @@ void ui_idle(void) {
|
||||
break;
|
||||
// Clones
|
||||
default:
|
||||
nbgl_useCasePlugInHome(app_name ? app_name : "???",
|
||||
APPNAME,
|
||||
&ICONGLYPH_SMALL,
|
||||
NULL,
|
||||
NULL,
|
||||
true,
|
||||
ui_menu_settings,
|
||||
app_quit);
|
||||
nbgl_useCaseHome(app_name,
|
||||
get_app_chain_icon(),
|
||||
NULL,
|
||||
true,
|
||||
ui_menu_settings,
|
||||
app_quit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "ui_logic.h"
|
||||
#include "common_712.h"
|
||||
#include "nbgl_use_case.h"
|
||||
#include "network.h"
|
||||
|
||||
// 4 pairs of tag/value to display
|
||||
static nbgl_layoutTagValue_t tlv;
|
||||
@@ -25,7 +26,7 @@ static void reviewChoice(bool confirm) {
|
||||
static bool displaySignPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
(void)page;
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Sign typed message";
|
||||
content->infoLongPress.longPressText = "Hold to sign";
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "common_ui.h"
|
||||
#include "ui_nbgl.h"
|
||||
#include "common_712.h"
|
||||
#include "network.h"
|
||||
|
||||
static nbgl_layoutTagValue_t tlv[2];
|
||||
|
||||
@@ -43,7 +44,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Sign typed message";
|
||||
content->infoLongPress.longPressText = "Hold to sign";
|
||||
}
|
||||
@@ -59,7 +60,7 @@ static void reviewContinue(void) {
|
||||
|
||||
|
||||
static void buildFirstPage(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Sign typed message", NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Sign typed message", NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_sign_712_v0(void) {
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
#include "ui_nbgl.h"
|
||||
#include "ui_callbacks.h"
|
||||
#include "nbgl_use_case.h"
|
||||
#include "network.h"
|
||||
|
||||
static nbgl_layoutTagValue_t tlv[3];
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
static nbgl_layoutTagValue_t tlv[3];
|
||||
|
||||
static void reviewReject(void) {
|
||||
io_seproxyhal_touch_tx_cancel(NULL);
|
||||
ui_idle();
|
||||
@@ -40,7 +42,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Review stark limit order";
|
||||
content->infoLongPress.longPressText = "Hold to sign";
|
||||
}
|
||||
@@ -57,7 +59,7 @@ static void reviewContinue(void) {
|
||||
|
||||
|
||||
static void buildFirstPage(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Review stark limit order", NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Review stark limit order", NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_stark_limit_order(void) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "ui_nbgl.h"
|
||||
#include "starkDisplayUtils.h"
|
||||
#include "ethUtils.h"
|
||||
#include "network.h"
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
@@ -85,7 +86,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
if (page == 2) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Review transaction";
|
||||
content->infoLongPress.longPressText = "Hold to sign";
|
||||
}
|
||||
@@ -114,7 +115,7 @@ void ui_stark_transfer(bool selfTransfer, bool conditional) {
|
||||
subTitle = "Transfer";
|
||||
}
|
||||
}
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH, "Review stark transaction", subTitle, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(), "Review stark transaction", subTitle, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
#endif // #ifdef HAVE_STARKWARE
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "ui_nbgl.h"
|
||||
#include "ui_callbacks.h"
|
||||
#include "nbgl_use_case.h"
|
||||
#include "network.h"
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
@@ -43,7 +44,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
|
||||
}
|
||||
else if (page == 1) {
|
||||
content->type = INFO_LONG_PRESS,
|
||||
content->infoLongPress.icon = &ICONGLYPH;
|
||||
content->infoLongPress.icon = get_app_chain_icon();
|
||||
content->infoLongPress.text = "Unsafe Stark Sign";
|
||||
content->infoLongPress.longPressText = "Hold to sign";
|
||||
}
|
||||
@@ -59,7 +60,7 @@ static void reviewContinue(void) {
|
||||
}
|
||||
|
||||
static void buildFirstPage(void) {
|
||||
nbgl_useCaseReviewStart(&ICONGLYPH,"Unsafe Stark Sign", NULL, "Reject", reviewContinue, reviewReject);
|
||||
nbgl_useCaseReviewStart(get_app_chain_icon(),"Unsafe Stark Sign", NULL, "Reject", reviewContinue, reviewReject);
|
||||
}
|
||||
|
||||
void ui_stark_unsafe_sign(void) {
|
||||
|
||||
Reference in New Issue
Block a user