Skip to content

Commit 2fa1c33

Browse files
committed
fix comments
1 parent b506eef commit 2fa1c33

File tree

97 files changed

+2617
-1774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2617
-1774
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ app_flex.json
99
# Temporary directory with snapshots taken during test runs
1010
tests/snapshots-tmp/
1111

12+
.DS_Store
13+
1214
# Python
1315
*.pyc[cod]
1416
*.egg
@@ -21,4 +23,4 @@ __pycache__/
2123
# Virtual env for sideload (macOS and Windows)
2224
ledger/
2325
# Build directory
24-
build/
26+
build/

Cargo.lock

Lines changed: 36 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "mintlayer-app"
3-
version = "1.7.1"
4-
authors = ["Ledger"]
3+
version = "0.1.0"
54
edition = "2021"
65

76
[dependencies]
8-
ledger_device_sdk = "1.27.2"
9-
ledger_secure_sdk_sys = "1.11.4"
7+
messages = { path = "./messages" }
8+
ledger_device_sdk = "1.27.3"
9+
ledger_secure_sdk_sys = "1.11.5"
1010
include_gif = "1.2.4"
1111
serde = { version = "1.0.228", default-features = false, features = ["derive"] }
1212
serde-json-core = { git = "https://github.com/rust-embedded-community/serde-json-core" }
@@ -30,7 +30,7 @@ parity-scale-codec = { git = "https://github.com/OBorce/parity-scale-codec.git",
3030
ml_common = { git = "https://github.com/mintlayer/mintlayer-core", package = "trezor-common", branch = "feature/hardware-wallet-common2" }
3131

3232
[build-dependencies]
33-
image = "0.25.7"
33+
image = "0.25.8"
3434

3535
[profile.release]
3636
opt-level = 'z'
@@ -47,18 +47,18 @@ path = ["44'/19788'", "44'/1'"]
4747
name = "Mintlayer"
4848

4949
[package.metadata.ledger.nanox]
50-
icon = "crab_14x14.gif"
50+
icon = "icons/mintlayer_14x14.gif"
5151

5252
[package.metadata.ledger.nanosplus]
53-
icon = "crab_14x14.gif"
53+
icon = "icons/mintlayer_14x14.gif"
5454

5555
[package.metadata.ledger.stax]
56-
icon = "crab_32x32.gif"
56+
icon = "icons/mintlayer_32x32.gif"
5757

5858
[package.metadata.ledger.flex]
59-
icon = "crab_40x40.gif"
59+
icon = "icons/mintlayer_40x40.gif"
6060

6161
[lints.rust]
6262
unexpected_cfgs = { level = "warn", check-cfg = [
63-
'cfg(target_os, values("stax", "flex", "nanos", "nanox", "nanosplus"))',
63+
'cfg(target_os, values("apex_p", "stax", "flex", "nanos", "nanox", "nanosplus"))',
6464
] }

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 61 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
# Ledger Rust Mintlayer Application
22

3-
![Rule enforcer](https://github.com/LedgerHQ/app-boilerplate-rust/actions/workflows/guidelines_enforcer.yml/badge.svg) ![Build and tests](https://github.com/LedgerHQ/app-boilerplate-rust/actions/workflows/build_and_functional_tests.yml/badge.svg)
3+
![Rule enforcer](https://github.com/mintlayer/mintlayer-ledger-app/actions/workflows/guidelines_enforcer.yml/badge.svg) ![Build and tests](https://github.com/mintlayer/mintlayer-ledger-app/actions/workflows/build_and_functional_tests.yml/badge.svg)
44

5-
This is a boilerplate application written in Rust which can be forked to start a new project for the Ledger Nano X, S+, Stax and Flex devices.
5+
This is the Mintlayer ledger application for the Ledger Nano X, S+, Stax and Flex devices.
66

77
:warning: Nano S is not supported
88

9-
* Implements standard features (display address, transaction signature...),
10-
* Has functional tests using [Ragger](https://github.com/LedgerHQ/ragger),
11-
* Has CI workflows mandatory for app deployment in the Ledger store.
12-
13-
### Links
14-
15-
* 📚 [Developer's documentation](https://developers.ledger.com/)<br/>
16-
* 🗣️ [Ledger's Discord server](https://discord.gg/Ledger)
17-
189
## Quick start guide
1910

2011
### With VS Code
@@ -23,18 +14,18 @@ You can quickly setup a development environment on any platform (macOS, Linux or
2314

2415
By using Ledger's own developer tools [Docker image](https://github.com/LedgerHQ/ledger-app-builder/pkgs/container/ledger-app-builder%2Fledger-app-dev-tools), the extension allows you to **build** your apps with the latest SDK, **test** them on **Speculos** and **load** them on any supported device.
2516

26-
* Install and run [Docker](https://www.docker.com/products/docker-desktop/).
27-
* Make sure you have an X11 server running :
28-
* On Ubuntu Linux, it should be running by default.
29-
* On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
30-
* On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control).
31-
* Install [VScode](https://code.visualstudio.com/download) and add [Ledger's extension](https://marketplace.visualstudio.com/items?itemName=LedgerHQ.ledger-dev-tools).
32-
* Open a terminal and clone `app-boilerplate-rust` with `git clone git@github.com:LedgerHQ/app-boilerplate-rust.git`.
33-
* Open the `app-boilerplate-rust` folder with VSCode.
34-
* Use Ledger extension's sidebar menu or open the tasks menu with `ctrl + shift + b` (`command + shift + b` on a Mac) to conveniently execute actions :
35-
* **Build** the app for the device model of your choice with `Build`.
36-
* **Test** your binary on the [Speculos emulator](https://github.com/LedgerHQ/speculos) with `Run with emulator`.
37-
* You can also **run functional tests**, load the app on a physical device, and more.
17+
- Install and run [Docker](https://www.docker.com/products/docker-desktop/).
18+
- Make sure you have an X11 server running :
19+
- On Ubuntu Linux, it should be running by default.
20+
- On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
21+
- On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control).
22+
- Install [VScode](https://code.visualstudio.com/download) and add [Ledger's extension](https://marketplace.visualstudio.com/items?itemName=LedgerHQ.ledger-dev-tools).
23+
- Open a terminal and clone `app-boilerplate-rust` with `git clone git@github.com:LedgerHQ/app-boilerplate-rust.git`.
24+
- Open the `app-boilerplate-rust` folder with VSCode.
25+
- Use Ledger extension's sidebar menu or open the tasks menu with `ctrl + shift + b` (`command + shift + b` on a Mac) to conveniently execute actions :
26+
- **Build** the app for the device model of your choice with `Build`.
27+
- **Test** your binary on the [Speculos emulator](https://github.com/LedgerHQ/speculos) with `Run with emulator`.
28+
- You can also **run functional tests**, load the app on a physical device, and more.
3829

3930
ℹ️ The terminal tab of VSCode will show you what commands the extension runs behind the scene.
4031

@@ -44,24 +35,26 @@ By using Ledger's own developer tools [Docker image](https://github.com/LedgerHQ
4435

4536
If you do not wish to use the [VS Code extension](#with-vs-code), you can follow the following steps to setup a development environment on Linux, Windows or MacOS.
4637

47-
* The [ledger-app-dev-tools](https://github.com/LedgerHQ/ledger-app-builder/pkgs/container/ledger-app-builder%2Fledger-app-dev-tools) Docker image contains all the required tools and libraries to build, test and load an application on a device. You can download it from the ghcr.io docker repository:
38+
- The [ledger-app-dev-tools](https://github.com/LedgerHQ/ledger-app-builder/pkgs/container/ledger-app-builder%2Fledger-app-dev-tools) Docker image contains all the required tools and libraries to build, test and load an application on a device. You can download it from the ghcr.io docker repository:
39+
4840
```shell
4941
sudo docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
5042
```
51-
* Make sure you have an X11 server running :
52-
* On Ubuntu Linux, it should be running by default.
53-
* On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
54-
* On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control).
55-
* You can then enter into this development environment by executing the following command from the directory of the application (`git` repository):
56-
* Linux (Ubuntu):
43+
44+
- Make sure you have an X11 server running :
45+
- On Ubuntu Linux, it should be running by default.
46+
- On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
47+
- On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control).
48+
- You can then enter into this development environment by executing the following command from the directory of the application (`git` repository):
49+
- Linux (Ubuntu):
5750
```shell
5851
sudo docker run --rm -ti --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --publish 5001:5001 --publish 9999:9999 -e DISPLAY=$DISPLAY -v '/tmp/.X11-unix:/tmp/.X11-unix' ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
5952
```
60-
* macOS:
53+
- macOS:
6154
```shell
6255
sudo docker run --rm -ti --privileged -v "$(pwd -P):/app" --publish 5001:5001 --publish 9999:9999 -e DISPLAY='host.docker.internal:0' -v '/tmp/.X11-unix:/tmp/.X11-unix' ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
6356
```
64-
* Windows (with PowerShell):
57+
- Windows (with PowerShell):
6558
```shell
6659
docker run --rm -ti --privileged -v "$(Get-Location):/app" -e DISPLAY='host.docker.internal:0' --publish 5001:5001 --publish 9999:9999 ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
6760
```
@@ -70,60 +63,81 @@ The application's code will be available from inside the docker container, you c
7063

7164
### Building
7265

73-
You can build the boilerplate with the following command executed in the root directory of the app.
66+
You can build the Mintlayer app with the following command executed in the root directory of the app.
67+
7468
```bash
7569
cargo ledger build nanox
7670
```
71+
7772
This command will build the app for the Nano X, but you can use any supported device (`nanox`, `nanosplus`, `stax`, `flex`)
7873

7974
### Testing
75+
8076
#### Ragger functional tests
81-
This boilerplate app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework.
8277

83-
* Install the tests requirements
78+
This Mintlayer app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework.
79+
80+
- Install the tests requirements
81+
8482
```bash
85-
pip install -r tests/requirements.txt
83+
pip install -r tests/requirements.txt
8684
```
87-
* Run the functional tests :
85+
86+
- Run the functional tests :
8887

8988
```shell
9089
pytest tests/ --tb=short -v --device {nanosp | nanox | stax | flex}
9190
```
91+
9292
#### Emulator
93+
9394
You can also run the app directly on the [Speculos emulator](https://github.com/LedgerHQ/speculos) from the Docker container
95+
9496
#### Nano S+ or X
97+
9598
```bash
96-
speculos --apdu-port 9999 --api-port 5001 --display headless --model nanosp target/nanosplus/release/app-boilerplate-rust
99+
speculos --apdu-port 9999 --api-port 5001 --display headless --model nanosp target/nanosplus/release/mintlayer-app
97100
```
101+
98102
:warning: UI is displayed on `localhost:5001`
103+
99104
#### Stax or Flex
105+
100106
```bash
101-
speculos --apdu-port 9999 --api-port 5001 --model stax target/stax/release/app-boilerplate-rust
107+
speculos --apdu-port 9999 --api-port 5001 --model stax target/stax/release/mintlayer-app
102108
```
109+
103110
:warning: UI is displayed by your X server
104111

105112
You can then send APDU using `ledgercomm` (`pip install ledgercomm`):
113+
106114
```
107115
ledgercomm-send file test.apdu
108116
```
117+
109118
### Loading on device
119+
110120
:warning: Loading the built application on a device shall be performed out of the Docker container, by using [ledgerctl](https://github.com/LedgerHQ/ledgerctl):
121+
111122
```shell
112123
pip3 install ledgerwallet
113-
````
114-
ℹ️ Your device must be connected, unlocked and the screen showing the dashboard (not inside an application).
124+
```
125+
126+
ℹ️ Your device must be connected, unlocked and the screen showing the dashboard (not inside an application).
115127

116128
For instance, for Flex:
129+
117130
```bash
118131
ledgerctl install -f target/flex/release/app_flex.json
119132
```
120133

121134
## Continuous Integration
135+
122136
The following workflows are executed in [GitHub Actions](https://github.com/features/actions) :
123137

124-
* Ledger guidelines enforcer which verifies that an app is compliant with Ledger guidelines. The successful completion of this reusable workflow is a mandatory step for an app to be available on the Ledger application store. More information on the guidelines can be found in the repository [ledger-app-workflow](https://github.com/LedgerHQ/ledger-app-workflows)
125-
* Compilation of the application for all supported devices in the [ledger-app-builder](https://github.com/LedgerHQ/ledger-app-builder) docker image
126-
* End-to-end tests with the [Speculos](https://github.com/LedgerHQ/speculos) emulator and [ragger](https://github.com/LedgerHQ/ragger) (see [tests/](tests/))
127-
* Various lint checks :
128-
* Source code lint checks with `cargo fmt`
129-
* Python functional test code lint checks with `pylint` and `mypy`
138+
- Ledger guidelines enforcer which verifies that an app is compliant with Ledger guidelines. The successful completion of this reusable workflow is a mandatory step for an app to be available on the Ledger application store. More information on the guidelines can be found in the repository [ledger-app-workflow](https://github.com/LedgerHQ/ledger-app-workflows)
139+
- Compilation of the application for all supported devices in the [ledger-app-builder](https://github.com/LedgerHQ/ledger-app-builder) docker image
140+
- End-to-end tests with the [Speculos](https://github.com/LedgerHQ/speculos) emulator and [ragger](https://github.com/LedgerHQ/ragger) (see [tests/](tests/))
141+
- Various lint checks :
142+
- Source code lint checks with `cargo fmt`
143+
- Python functional test code lint checks with `pylint` and `mypy`

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use image::{ImageFormat, ImageReader, Pixel};
22

33
fn main() {
44
println!("cargo:rerun-if-changed=script.ld");
5-
println!("cargo:rerun-if-changed=icons/crab_14x14.gif");
5+
println!("cargo:rerun-if-changed=icons/mintlayer_14x14.gif");
66
println!("cargo:rerun-if-changed=icons/mask_14x14.gif");
77

88
let path = std::path::PathBuf::from("icons");
9-
let reader = ImageReader::open(path.join("crab_14x14.gif")).unwrap();
9+
let reader = ImageReader::open(path.join("mintlayer_14x14.gif")).unwrap();
1010
let img = reader.decode().unwrap();
1111
let mut gray = img.into_luma8();
1212

crab_14x14.gif

-854 Bytes
Binary file not shown.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)