Skip to content

Commit cbb12f2

Browse files
authored
Merge pull request #103 from LedgerHQ/y333/update_readme
Update readme
2 parents c1e8a9b + 8cf6d74 commit cbb12f2

File tree

1 file changed

+47
-52
lines changed

1 file changed

+47
-52
lines changed

README.md

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![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)
44

5-
This is a boilerplate application written in Rust which can be forked to start a new project for the Ledger Nano X/SP, Stax and Flex devices.
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.
66

77
:warning: Nano S is not supported
88

@@ -42,93 +42,88 @@ By using Ledger's own developer tools [Docker image](https://github.com/LedgerHQ
4242

4343
### Prerequisites
4444

45-
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 or MacOS.
46-
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.
48-
49-
You can download it from the ghcr.io docker repository:
45+
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.
5046

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:
5148
```shell
5249
sudo docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
5350
```
54-
55-
You can then enter into this development environment by executing the following command from the directory of the application (`git` repository):
56-
57-
**Linux (Ubuntu)**
58-
59-
```shell
60-
sudo docker run --rm -ti --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
61-
```
62-
63-
**macOS**
64-
65-
```shell
66-
sudo docker run --rm -ti --privileged -v "$(pwd -P):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
67-
```
68-
69-
**Windows (with PowerShell)**
70-
71-
```shell
72-
docker run --rm -ti --privileged -v "$(Get-Location):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
73-
```
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):
57+
```shell
58+
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
59+
```
60+
* macOS:
61+
```shell
62+
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
63+
```
64+
* Windows (with PowerShell):
65+
```shell
66+
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
67+
```
7468

7569
The application's code will be available from inside the docker container, you can proceed to the following compilation steps to build your app.
7670

7771
### Building
7872

7973
You can build the boilerplate with the following command executed in the root directory of the app.
80-
8174
```bash
8275
cargo ledger build nanox
8376
```
84-
8577
This command will build the app for the Nano X, but you can use any supported device (`nanox`, `nanosplus`, `stax`, `flex`)
8678

87-
### Loading
88-
89-
ℹ️ Your device must be connected, unlocked and the screen showing the dashboard (not inside an application).
90-
91-
[cargo-ledger](https://github.com/LedgerHQ/cargo-ledger) also allows you to side load the binary with the following command line executed in the root directory of the boilerplate app.
92-
93-
```bash
94-
cargo ledger build nanox --load
95-
```
96-
97-
As for the build command, you can replace `nanox` with `nanosplus`, `stax` or `flex`.
98-
99-
## Test
100-
101-
### Ragger functional tests
102-
79+
### Testing
80+
#### Ragger functional tests
10381
This boilerplate app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework.
10482

10583
* Install the tests requirements
106-
10784
```bash
10885
pip install -r tests/requirements.txt
10986
```
110-
11187
* Run the functional tests :
11288

11389
```shell
11490
pytest tests/ --tb=short -v --device {nanosp | nanox | stax | flex}
11591
```
92+
#### Emulator
93+
You can also run the app directly on the [Speculos emulator](https://github.com/LedgerHQ/speculos) from the Docker container
94+
#### Nano S+ or X
95+
```bash
96+
speculos --apdu-port 9999 --api-port 5001 --display headless --model nanosp target/nanosplus/release/app-boilerplate-rust
97+
```
98+
:warning: UI is displayed on `localhost:5001`
99+
#### Stax or Flex
100+
```bash
101+
speculos --apdu-port 9999 --api-port 5001 --model stax target/stax/release/app-boilerplate-rust
102+
```
103+
:warning: UI is displayed by your X server
116104

117-
### Emulator
118-
119-
You can also run the app directly on the [Speculos emulator](https://github.com/LedgerHQ/speculos)
105+
You can then send APDU using `ledgercomm` (`pip install ledgercomm`):
106+
```
107+
ledgercomm-send file test.apdu
108+
```
109+
### Loading on device
110+
:warning: Loading the built application on a device shall be performed out of the Docker container, by using [ledgerctl](https://github.com/LedgerHQ/ledgerctl):
111+
```shell
112+
pip3 install ledgerwallet
113+
````
114+
ℹ️ Your device must be connected, unlocked and the screen showing the dashboard (not inside an application).
120115

116+
For instance, for Flex:
121117
```bash
122-
speculos --model nanox target/nanox/release/app-boilerplate-rust
118+
ledgerctl install -f target/flex/release/app_flex.json
123119
```
124120

125121
## Continuous Integration
126-
127122
The following workflows are executed in [GitHub Actions](https://github.com/features/actions) :
128123

129124
* 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)
130125
* Compilation of the application for all supported devices in the [ledger-app-builder](https://github.com/LedgerHQ/ledger-app-builder) docker image
131126
* End-to-end tests with the [Speculos](https://github.com/LedgerHQ/speculos) emulator and [ragger](https://github.com/LedgerHQ/ragger) (see [tests/](tests/))
132127
* Various lint checks :
133128
* Source code lint checks with `cargo fmt`
134-
* Python functional test code lint checks with `pylint` and `mypy`
129+
* Python functional test code lint checks with `pylint` and `mypy`

0 commit comments

Comments
 (0)