-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from LedgerHQ/ui-improvements
Ui improvements
- Loading branch information
Showing
37 changed files
with
1,284 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/dep | ||
/obj | ||
*.swp | ||
/src/glyphs.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/*.pyc | ||
/*.pyc |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "os.h" | ||
#include "algo_asa.h" | ||
|
||
|
||
#define ARRAY_SIZE(__arr) (sizeof(__arr) / sizeof(__arr[0])) | ||
|
||
#define ALGO_ASA(__id, __name, __unit, __decimals) { \ | ||
.assetId = __id, \ | ||
.decimals = __decimals, \ | ||
.unit = __unit, \ | ||
.name = __name, \ | ||
} | ||
|
||
|
||
static const algo_asset_info_t algo_assets[] = { | ||
ALGO_ASA(438840, "Micro-Tesla", "M-TSLA", 0), | ||
ALGO_ASA(438839, "Micro-Apple", "M-AAPL", 0), | ||
ALGO_ASA(438838, "Micro-Google", "M-GOOGL", 0), | ||
ALGO_ASA(438837, "Micro-Netflix", "M-NFLX", 0), | ||
ALGO_ASA(438836, "Micro-Twitter", "M-TWTR", 0), | ||
ALGO_ASA(438833, "Micro-Amazon", "M-AMZN", 0), | ||
ALGO_ASA(438832, "Micro-Microsoft", "M-MSFT", 0), | ||
ALGO_ASA(438831, "MESE Index Fund", "MESX", 6), | ||
ALGO_ASA(438828, "MESE USD Exchange Token", "USD-MESE", 6), | ||
ALGO_ASA(312769, "Tether USDt", "USDt", 6), | ||
ALGO_ASA(163650, "Asia Reserve Currency Coin", "ARCC", 6), | ||
}; | ||
|
||
|
||
const algo_asset_info_t * | ||
algo_asa_get(uint64_t id) | ||
{ | ||
const algo_asset_info_t *p; | ||
const algo_asset_info_t *endp = algo_assets + ARRAY_SIZE(algo_assets); | ||
|
||
for (p = algo_assets; p && p < endp; p++) { | ||
if (p->assetId == id) { | ||
return p; | ||
} | ||
} | ||
return NULL; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef __ALGO_ASA_H__ | ||
#define __ALGO_ASA_H__ | ||
|
||
#define __packed __attribute__((packed)) | ||
|
||
|
||
typedef struct { | ||
uint64_t assetId; | ||
uint8_t decimals; | ||
const char unit[15]; | ||
const char name[32]; | ||
} __packed algo_asset_info_t; | ||
|
||
|
||
const algo_asset_info_t *algo_asa_get(uint64_t id); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
#include "cx.h" | ||
#include "stdbool.h" | ||
|
||
typedef struct{ | ||
bool initialized; | ||
uint32_t accountID; | ||
uint8_t pubkey[32]; | ||
} already_computed_key_t; | ||
|
||
extern already_computed_key_t current_pubkey; | ||
|
||
void algorand_key_derive(uint32_t accountId, cx_ecfp_private_key_t *privateKey); | ||
size_t algorand_public_key(const cx_ecfp_private_key_t *privateKey, uint8_t *buf); | ||
size_t fetch_public_key(uint32_t accountId, uint8_t* pubkey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,16 @@ | ||
#if defined(TARGET_NANOX) | ||
#include "ux.h" | ||
#endif // TARGET_NANOX | ||
|
||
extern char lineBuffer[]; | ||
extern char caption[20]; | ||
extern char text[128]; | ||
|
||
void ui_loading(); | ||
void ui_idle(); | ||
void ui_address(); | ||
void ui_address_approval(); | ||
void ui_txn(); | ||
void ux_approve_txn(); | ||
|
||
void ui_text_put(const char *msg); | ||
void ui_text_putn(const char *msg, size_t maxlen); | ||
int ui_text_more(); | ||
|
||
void step_address(); | ||
|
||
// Override some of the Ledger X UI macros to enable step skipping | ||
#if defined(TARGET_NANOX) | ||
|
||
// If going backwards, skip backwards. Otherwise, skip forwards. | ||
#define SKIPEMPTY(stepnum) \ | ||
if (stepnum < ux_last_step) { \ | ||
ux_flow_prev(); \ | ||
} else { \ | ||
ux_flow_next(); \ | ||
} \ | ||
return | ||
|
||
#define ALGO_UX_STEP_NOCB_INIT(txtype, stepnum, layoutkind, preinit, ...) \ | ||
void txn_flow_ ## stepnum ##_init (unsigned int stack_slot) { \ | ||
if (txtype != ALL_TYPES && txtype != current_txn.type) { SKIPEMPTY(stepnum); }; \ | ||
if (preinit == 0) { SKIPEMPTY(stepnum); }; \ | ||
ux_last_step = stepnum; \ | ||
ux_layout_ ## layoutkind ## _init(stack_slot); \ | ||
} \ | ||
const ux_layout_ ## layoutkind ## _params_t txn_flow_ ## stepnum ##_val = __VA_ARGS__; \ | ||
const ux_flow_step_t txn_flow_ ## stepnum = { \ | ||
txn_flow_ ## stepnum ## _init, \ | ||
& txn_flow_ ## stepnum ## _val, \ | ||
NULL, \ | ||
NULL, \ | ||
} | ||
|
||
#define ALGO_UX_STEP(stepnum, layoutkind, preinit, timeout_ms, validate_cb, error_flow, ...) \ | ||
UX_FLOW_CALL(txn_flow_ ## stepnum ## _validate, { validate_cb; }) \ | ||
void txn_flow_ ## stepnum ##_init (unsigned int stack_slot) { \ | ||
preinit; \ | ||
ux_last_step = stepnum; \ | ||
ux_layout_ ## layoutkind ## _init(stack_slot); \ | ||
ux_layout_set_timeout(stack_slot, timeout_ms);\ | ||
} \ | ||
const ux_layout_ ## layoutkind ## _params_t txn_flow_ ## stepnum ##_val = __VA_ARGS__; \ | ||
const ux_flow_step_t txn_flow_ ## stepnum = { \ | ||
txn_flow_ ## stepnum ## _init, \ | ||
& txn_flow_ ## stepnum ## _val, \ | ||
txn_flow_ ## stepnum ## _validate, \ | ||
error_flow, \ | ||
} | ||
|
||
#endif // TARGET_NANOX | ||
#define ALGORAND_PUBLIC_KEY_SIZE 32 | ||
#define ALGORAND_DECIMALS 6 |
Oops, something went wrong.