Ledger
Ledger
class Ledger
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.
exitApp()
func exitApp() async throws
Close the app running on the device and return to the dashboard.
On Speculos, this ends the emulated app.
getPublicKey(path:)
func getPublicKey(path: String) async throws -> Ed25519PublicKey
Read the public key at a derivation path such as
m/44'/4218'/0'/0'/0'.
isAppOpen()
func isAppOpen() async throws -> 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.
openApp()
func openApp() async throws
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(path:)
func signer(path: String) async throws -> 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.
verifyAddress(path:)
func verifyAddress(path: String) async throws -> Ed25519PublicKey
Show the address at a derivation path on the device for the user to confirm, and return its public key.
version()
func version() async throws -> LedgerAppVersion
Read the version of the IOTA app.
fromTransport(transport:)
static func fromTransport(transport: any 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.
nativeHid()
static func nativeHid() throws -> 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(host:port:)
static func speculos(host: String, port: UInt16) -> 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.