Repository navigation
refactor(ledger): expose the Ledger signers in a typed starknet/ledge… - #1723
Merged
PhilippeR26 merged 1 commit intoOct 8, 2026
Merged
Conversation
…r entry point The Ledger signers and their path functions can now be imported from `starknet/ledger`, with the transport typed by `@ledgerhq/hw-transport` (optional peer dependency). Importing them from `starknet` still works, but it is deprecated and will be removed in v12. The main bundles are unchanged. The new entry point has its own API pages and a unit test; the guides use it, and state Ledger APP support from v2.3.1 to v2.4.3.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Resolution
The Ledger transport was typed as
any(type _Transport = any):@ledgerhq/hw-transportwas removed from the dependencies in 2024, after a packaging bug (LedgerHQ/ledger-live#7448). Importing the LedgerTransporttype into the singledist/index.d.tswould break every project that does not use a Ledger and compiles withskipLibCheck: false(TS2307).This PR adds a
starknet/ledgerentry point, with its own types file. There, the transport is typed with the LedgerTransportclass. Nothing breaks in v11: the exports ofstarknetstay, deprecated. In v12, the code moves tosrc/ledger/and these exports are removed.RPC version (if applicable)
Not applicable.
Usage related changes
starknet/ledger:LedgerSigner111,LedgerSigner221,LedgerSigner231,getLedgerPathBuffer111,getLedgerPathBuffer221, and the aliasesLedgerSignerandgetLedgerPathBuffer.transporterhas the type of the transport you pass (it wasanyfor 221 and 231), and a value that is not a Ledger transport is refused at compile time.starknetstill works, but is marked@deprecated(removed in v12).@ledgerhq/hw-transportis an optional peer dependency (^6.0.0). The Ledger transport packages already install it. Projects without a Ledger see no change and no install warning (checked with npm, pnpm and yarn 1).starknet/ledger; the signature and migration guides use the new import. Ledger Starknet APP support is stated from v2.3.1 to v2.4.3 (tested on a device with v2.4.3).Development related changes
dist/ledger/index.{js,mjs,d.ts}, withstarknetkept external. The IIFE build keeps the main entry only and the ESM build has no shared chunk, sodist/index.js,dist/index.mjsanddist/index.global.jsare unchanged except for comments (compared with a build ofdevelop).tsconfig.json(paths) and both Jest configs (moduleNameMapper) mapstarknettosrc/index.ts. An ESLint rule forbids importingstarknetinsrcoutsidesrc/ledger.__tests__/utils/ledgerSigner.test.ts(no node needed).docusaurus-plugin-typedocinstance writes todocs/API/ledger/, so the addresses of the existing API pages do not change; new sidebar category.moduleResolutionbundler,node16andnode.Checklist: