feature: Ledger hardware wallet support - #174
Open
thelmaoffiong wants to merge 1 commit into
Open
Conversation
Register the Ledger module from @creit.tech/stellar-wallets-kit so users can connect a hardware device and sign every transaction on-device. The deposit and withdraw pages now surface a "confirm on your device" state while a hardware signature is awaited, and friendlyError maps Ledger-specific failures (locked device, wrong app open, on-device rejection, missing device) to clear, friendly messages instead of a generic error. Tests cover the connect and sign paths using a mocked Ledger transport.
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.
Summary
Adds Ledger hardware wallet support to the frontend wallet integration (issue #148). Users can now connect a Ledger device through the StellarWalletsKit auth modal and sign every transaction on-device, keeping signing keys on cold storage instead of a hot wallet.
Changes
frontend/src/components/WalletProvider.tsx— registers the kit'sLedgerModulealongside the five existing browser wallets and exposesisHardwareWalleton the wallet context (true when the actively connected wallet is a Ledger). The signing path was already fully async, so it resolves only after the on-device confirmation — no changes needed to the signing flow itself.frontend/src/app/deposit/page.tsx— the deposit confirm modal now shows a "Check your Ledger device — approve the transaction there" state and a "Confirm on your device…" button label while a hardware signature is awaited.frontend/src/app/withdraw/page.tsx— the signing progress step reads "Confirm on your Ledger device…" with a device hint when the connected wallet is hardware.frontend/src/app/compliance/page.tsx— no change needed: this page never signs transactions (pure report/viewing-key proof generation), so there is no signing UX to make device-aware.frontend/src/lib/errors.ts—friendlyErrornow maps hardware-specific failures to clear messages: locked device, Stellar app not open (0x6d00/0x6e00), on-device rejection, and missing/WebUSB-unreachable device.WalletProvider.test.tsx(connect + sign paths with a mocked Ledger transport, including software-wallet and disconnect cases) anderrors.test.ts(hardware error mapping).README.md; CHANGELOG entry added.Verification
pnpm vitest run src/components/WalletProvider.test.tsx src/lib/errors.test.tstsc --noEmitreports no errors in any changed file (the 17 remaining errors are pre-existing parse errors inrecurring/page.tsx,Toast.tsx, andtone.ts, present ondevbefore this change)Closes #148