Ledgered
Python libraries and CLI tools for Ledger embedded applications (Nano S+, Nano X, Stax, Flex, ...).
Originally meant to regroup LedgerComm, Ledgerblue and Ledgerctl, it currently provides:
| Module | CLI | Purpose |
|---|---|---|
ledgered.manifest |
ledger-manifest |
Parse and check an app ledger_app.toml manifest |
ledgered.binary |
ledger-binary |
Extract metadata from a compiled app ELF file |
ledgered.github |
List and filter LedgerHQ app repositories, read their content | |
ledgered.devices |
Ledger devices reference (names, resolution, ...) |
pip install ledgered
Manifest
Every Ledger embedded application provides a ledger_app.toml manifest at the root of its repository.
It describes how to build and test the application, and is used by the
reusable workflows and the VSCode extension.
Example
[app]
build_directory = "./"
sdk = "C"
devices = ["nanox", "nanos+", "stax", "flex"]
[use_cases]
debug = "DEBUG=1"
test_with_feature_activated = "TEST_FLAG_TO_SET=1"
[unit_tests]
directory = "./unit-tests/"
[metadata]
author = "Ledger"
contact = "support@ledger.com"
compatible_wallets = ["Ledger Wallet"]
[pytest.standalone]
directory = "tests/"
[pytest.swap]
directory = "tests_swap/"
self_use_case = "test_with_feature_activated"
[pytest.swap.dependencies]
testing_with_latest = [
{url = "https://github.com/LedgerHQ/app-exchange", ref = "develop", use_case = "dbg_use_test_keys"},
]
testing_with_prod = [
{url = "https://github.com/LedgerHQ/app-exchange", ref = "master"},
]
Sections
| Section | Required | Fields |
|---|---|---|
[app] |
yes | sdk (C or Rust), build_directory (where the Makefile / Cargo.toml is), devices |
[use_cases] |
no | <use_case> = "<options>": make variables for C apps (DEBUG=1), Cargo options for Rust apps. default is implicit (no option) |
[unit_tests] |
no | directory |
[metadata] |
no | author, contact (email address), required; publisher, support_url, compatible_wallets (list), optional. Unknown fields are rejected |
[pytest.<name>] |
no | directory (contains a conftest.py), self_use_case (use case to build the app with for these tests) |
[pytest.<name>.dependencies] |
no | <scenario> = [{url, ref, use_case}, ...]: apps to sideload for the tests |
Dependencies notes:
use_caserefers to the dependency's own manifest, and defaults todefault.- Dependencies are checked out in
<directory>/.dependencies/<repo_name>-<ref>-<use_case>.
Reusable workflows
Manifest values take precedence over workflow inputs, except devices, which is overridden by the
run_for_devices input (tests may only run on a subset of devices). In
reusable_ragger_tests.yml,
pytest_directory takes precedence over the test_dir input.
ledger-manifest
ledger-manifest ledger_app.toml -os -od # outputs the SDK and the devices
ledger-manifest ledger_app.toml -c . # checks the manifest against the given directory
ledger-manifest app-boilerplate -u -od -j # fetches the manifest from GitHub, outputs as JSON
See ledger-manifest --help for all the outputs (build directory, use cases, tests directories and dependencies, ...).
Binary
Ledger app ELF files embed metadata (target, SDK, API level, ...) used by tools like
Speculos. ledger-binary extracts them:
$ ledger-binary build/stax/bin/app.elf
api_level 15
app_name Boilerplate
app_version 2.1.0
sdk_graphics bagl
sdk_hash a23bad84cbf39a5071644d2191b177191c089b23
sdk_name ledger-secure-sdk
sdk_version v15.1.0
target stax
target_id 0x33200004
target_name TARGET_STAX
Use -j for a JSON-like output.
GitHub
from ledgered.github import Condition, GitHubLedgerHQ
gh = GitHubLedgerHQ(auth=...) # same arguments as `github.Github`
apps = gh.apps.filter(archived=Condition.WITHOUT, plugin=Condition.WITHOUT, sdk=["rust"])
app = gh.get_app("app-boilerplate")
app.current_branch = "develop"
print(app.manifest.app.devices, app.variant_param, app.variants)
Metadata
Release files for ledgered 0.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ledgered-0.17.0.tar.gz | 36.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ledgered-0.17.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.7 kB
Release files / ledgered-0.17.0.tar.gz
| Download URL | ledgered-0.17.0.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe0e93a12b610737c5010e65a9f516a3630d297ff16e520afba778c95bd5a806
|
|
BLAKE2b-256 checksum How to use checksums |
0621469278c4cf86a4631345d5493c0588fe0a90a15bdad44a56865faf66e78e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / ledgered-0.17.0-py3-none-any.whl
| Download URL | ledgered-0.17.0-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b7e3a85c53f177e9d9505890a033cdd951ef4ad357d80a4d5821c35245cf66d
|
|
BLAKE2b-256 checksum How to use checksums |
69ac8a45d052e46c3ed40cf46fb899b448f26f85505220eb5d0c9dd931c55639
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|