Ledger
Ledger Objects
class Ledger(LedgerProtocol)
A connection to the IOTA app on a Ledger device.
Every call completes once the device answers, which for address
verification includes waiting for the user to confirm on the device. Calls
on the same Ledger, including through the LedgerSigners created from
it, run one at a time.
from_transport
@classmethod
def from_transport(cls, transport: LedgerTransport) -> Ledger
Communicate with the device through a transport implemented in the host language.
open_app closes whichever other app the transport reports as
running, so do not call it on an emulator that reports a placeholder
app name, such as Speculos started without
SPECULOS_APPNAME=IOTA:<version>: it ends the emulated app.
native_hid
@classmethod
def native_hid(cls) -> Ledger
Connect to the first Ledger device attached over USB.
Fails in builds of the SDK without USB support, such as those for Android, iOS and the web.
speculos
@classmethod
def speculos(cls, host: str, port: int) -> Ledger
Connect to the APDU port of a Speculos emulator (by default this is
127.0.0.1:9999 in the emulator).
Calls through this connection block the thread running them until the emulator answers, and fail in the WASM bindings, which have no TCP sockets.
exit_app
async def exit_app() -> None
Close the app running on the device and return to the dashboard.
On Speculos, this ends the emulated app.
get_public_key
async def get_public_key(path: str) -> Ed25519PublicKey
Read the public key at a derivation path such as
m/44'/4218'/0'/0'/0'.
is_app_open
async def is_app_open() -> bool
Check whether the IOTA app is the app running on the device.
Speculos reports a placeholder app name unless started with
SPECULOS_APPNAME=IOTA:<version>, so this returns false there.
open_app
async def open_app() -> None
Open the IOTA app, from the dashboard or by closing another app first.
Does nothing if the IOTA app is already running, or on a speculos
connection.
signer
async def signer(path: str) -> LedgerSigner
Create a signer for the key at a derivation path such as
m/44'/4218'/0'/0'/0', reading its public key from the device.
The signer shares this Ledger's connection, which stays usable.
verify_address
async def verify_address(path: str) -> Ed25519PublicKey
Show the address at a derivation path on the device for the user to confirm, and return its public key.
version
async def version() -> LedgerAppVersion
Read the version of the IOTA app.