Skip to content

Ledger UI Enhancement: Auto-open apps, improved error messages, and transaction display fixes#3541

Closed
Copilot wants to merge 1 commit intoledgerUiFixfrom
copilot/sub-pr-3524-again
Closed

Ledger UI Enhancement: Auto-open apps, improved error messages, and transaction display fixes#3541
Copilot wants to merge 1 commit intoledgerUiFixfrom
copilot/sub-pr-3524-again

Conversation

Copy link

Copilot AI commented Feb 4, 2026

Description

Ticket: CP-13165 CP-13167 CP-13173

Enhances Ledger integration with automatic app switching, consolidated error handling, and activity screen fixes for ERC20 transactions.

Key Changes:

  • Auto-open Ledger apps: Sends APDU commands to automatically open Avalanche/Solana apps during connection setup and transaction approval. Best-effort approach—fails gracefully if device is locked or app is already open.

  • Consolidated error handling: Centralized error message mapping in handleLedgerError utility. Maps Ledger error codes (0x6a80, 0x6985, 0x6511, etc.) to user-friendly messages. Added support for transport race conditions ("Ledger is processing another request") and disconnected device errors.

  • Single approval invocation: Uses React useRef to prevent duplicate transaction approval attempts when Ledger reconnects during approval flow.

  • ERC20 transaction display: Fixed activity screen to correctly show ERC20 sent transactions.

Technical Implementation:

// Auto-open app using APDU command (CLA=0xE0, INS=0xD8)
async openApp(app: LedgerAppType): Promise<void> {
  const apdu = this.buildOpenAppApdu(app)
  const response = await this.transport.exchange(apdu)
  // Best-effort: logs success/failure, never throws
}

// Centralized error handling
handleLedgerError({ error, network }) {
  if (message.includes(LEDGER_ERROR_CODES.TRANSPORT_RACE_CONDITION)) {
    throw new Error('Ledger is processing another request. Please try again later.')
  }
  // ... other error mappings
}

Added comprehensive unit tests covering APDU construction, status code parsing, and error scenarios.

Screenshots/Videos

Auto connect app in ledger
https://github.com/user-attachments/assets/bf2d086e-4aac-4bfb-839f-291dec7da506

CP-13165: ERC20 transaction display

CP-13167: Transport race condition error

CP-13173: Disconnected device error

Testing

Dev Testing (if applicable)

  • Test transaction signing flow: connect Ledger → initiate transaction → verify single approval prompt
  • Test error cases: wrong app open, device locked, user rejection
  • Test race conditions: rapid navigation/reconnection during approval flow
  • Verify transport race condition error displays correct message
  • Test auto-open app functionality for both Avalanche and Solana

QA Testing (if applicable)

  • Transaction approval should only trigger once per transaction
  • Error messages should be user-friendly and actionable
  • No duplicate transaction attempts when Ledger reconnects during approval
  • Transport busy errors show "Ledger is processing another request" message
  • Auto-open attempts should not block transaction flow if they fail

Checklist

Please check all that apply (if applicable)

  • I have performed a self-review of my code
  • I have verified the code works
  • I have included screenshots / videos of android and ios
  • I have added testing steps
  • I have added/updated necessary unit tests
  • I have updated the documentation

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Feb 4, 2026
6 tasks
Copilot AI changed the title [WIP] Improve Ledger UI with user-friendly messages and auto app connection Ledger UI Enhancement: Auto-open apps, improved error messages, and transaction display fixes Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants