Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
ifeq ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
endif
include $(BOLOS_SDK)/Makefile.defines

include $(BOLOS_SDK)/Makefile.target

########################################
# Mandatory configuration #
########################################
APPNAME = Eos

APPVERSION_M=1
APPVERSION_N=5
APPVERSION_N=6
APPVERSION_P=0
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

Expand All @@ -35,11 +36,11 @@ APP_SOURCE_PATH += src

# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOS = icons/nanos_app_eos.gif
ICON_NANOX = icons/nano_app_eos.gif
ICON_NANOSP = icons/nano_app_eos.gif
ICON_STAX = icons/stax_app_eos.gif
ICON_FLEX = icons/flex_app_eos.gif
ICON_APEX_P = icons/apex_app_eos.png

# Application allowed derivation curves.
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1
Expand Down Expand Up @@ -90,6 +91,7 @@ ENABLE_BLUETOOTH = 1
ENABLE_NBGL_QRCODE = 1
#ENABLE_NBGL_KEYBOARD = 1
#ENABLE_NBGL_KEYPAD = 1
ENABLE_NBGL_FOR_NANO_DEVICES = 1

########################################
# Features disablers #
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# app-eos

Eos wallet application framework for Ledger devices
Eos wallet application framework for Ledger devices (Nano S Plus, Nano X, Flex, Stax, Apex)

This follows the specification available in the doc/ folder

Expand Down Expand Up @@ -91,11 +91,11 @@ make DEBUG=1 # compile optionally with PRINTF

You can choose which device to compile and load for by setting the `BOLOS_SDK` environment variable to the following values:

- `BOLOS_SDK=$NANOS_SDK`
- `BOLOS_SDK=$NANOX_SDK`
- `BOLOS_SDK=$NANOSP_SDK`
- `BOLOS_SDK=$STAX_SDK`
- `BOLOS_SDK=$FLEX_SDK`
- `BOLOS_SDK=$APEX_P_SDK`

### Loading on a physical device

Expand Down Expand Up @@ -164,16 +164,16 @@ pip install -r tests/functional/requirements.txt

Then you can:

Run the functional tests (here for nanos but available for any device once you have built the binaries):
Run the functional tests (here for nanosp but available for any device once you have built the binaries):

```shell
pytest tests/functional/ --tb=short -v --device nanos
pytest tests/functional/ --tb=short -v --device nanosp
```

Or run your app directly with Speculos

```shell
speculos --model nanos build/nanos/bin/app.elf
speculos --model nanosp build/nanosp/bin/app.elf
```

### macOS / Windows
Expand Down
2 changes: 1 addition & 1 deletion docs/speculos-emulator-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pip install speculos
## Run and use the emulator

```shell
./speculos.py build/nanos/bin/app.elf
./speculos.py build/nanosp/bin/app.elf
```

> You can go to `http://127.0.0.1:5000/` for another interface and more data
Binary file added glyphs/app_eos_48px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glyphs/home_app_eos.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed glyphs/nanos_badge_eos.gif
Binary file not shown.
Binary file added icons/apex_app_eos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/nanos_app_eos.gif
Binary file not shown.
2 changes: 1 addition & 1 deletion ledger_app.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app]
build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+", "stax", "flex"]
devices = ["nanox", "nanos+", "stax", "flex", "apex_p"]

[tests]
pytest_directory = "./tests/functional"
4 changes: 3 additions & 1 deletion src/eos_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <stdbool.h>
#include "string.h"

#define MAX_SYMBOL_PRECISION 0xff

static const char *charmap = ".12345abcdefghijklmnopqrstuvwxyz";

name_t buffer_to_name_type(uint8_t *in, uint32_t size) {
Expand Down Expand Up @@ -120,7 +122,7 @@ uint8_t asset_to_string(asset_t *asset, char *out, uint32_t size) {

p = (int64_t) symbol_precision(asset->symbol);

char fraction[p + 1];
char fraction[MAX_SYMBOL_PRECISION + 1];
fraction[p] = 0;
int64_t change = asset->amount % p10;

Expand Down
7 changes: 6 additions & 1 deletion src/eos_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "os.h"
#include "cx.h"

#define MAX_BIN_SIZE \
37 // Adjust as needed (current value enough for b58enc usage in compressed_public_key_to_wif)
#define MAX_BUF_SIZE MAX_BIN_SIZE * 138 / 100 + 1 // 52

unsigned char const BASE58ALPHABET[] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
Expand All @@ -34,7 +38,8 @@ bool b58enc(uint8_t *bin, uint32_t binsz, char *b58, uint32_t *b58sz) {
while (zcount < binsz && !bin[zcount]) ++zcount;

size = (binsz - zcount) * 138 / 100 + 1;
uint8_t buf[size];
LEDGER_ASSERT(size <= MAX_BUF_SIZE, "b58enc overflow : input bin too large");
uint8_t buf[MAX_BUF_SIZE];
memset(buf, 0, size);

for (i = zcount, high = size - 1; i < binsz; ++i, high = j) {
Expand Down
14 changes: 14 additions & 0 deletions src/ui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#pragma once

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2)
#define ICON_APP_EOS C_nano_app_eos
#define ICON_APP_HOME C_home_app_eos
#define ICON_APP_WARNING C_icon_warning
#elif defined(TARGET_STAX) || defined(TARGET_FLEX)
#define ICON_APP_EOS C_app_eos_64px
#define ICON_APP_HOME ICON_APP_EOS
#define ICON_APP_WARNING LARGE_WARNING_ICON
#elif defined(TARGET_APEX_P)
#define ICON_APP_EOS C_app_eos_48px
#define ICON_APP_HOME ICON_APP_EOS
#define ICON_APP_WARNING LARGE_WARNING_ICON
#endif

void ui_idle(void);
void ui_display_public_key_flow(void);
void ui_display_public_key_done(bool validated);
Expand Down
Loading
Loading