Skip to content

feat: tron Ledger Transaction Data disabled error handling#11443

Merged
gomesalexandre merged 7 commits intodevelopfrom
fix_thor_tron_ledger
Dec 18, 2025
Merged

feat: tron Ledger Transaction Data disabled error handling#11443
gomesalexandre merged 7 commits intodevelopfrom
fix_thor_tron_ledger

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Dec 17, 2025

Description

Does the thing similar to blind signing for other chains.

When Ledger users attempt to sign TRON transactions with memos (required for Thorchain/Mayachain swaps), the Ledger TRON app requires the "Transactions Data" setting to be enabled. This PR implements smart validation that checks the Ledger device configuration and only blocks when truly incompatible, following the same ChainAdapterError pattern used for blind signing errors.

Issue (if applicable)

N/A

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

  • Wallets: Ledger hardware wallets with TRON support
  • Protocols: Thorchain, Mayachain (any swapper that uses memos on TRON)
  • Transaction Types: TRON transactions with raw_data.data field (memos)
  • Risk Level: Low - only affects error handling, doesn't modify transaction building logic

Testing

  • Ensure without Transaction data enabled, you see a toast error prompting you to enable it
  • THOR TRON Txs are happy with Tx data enabled
  • Ensure you do not get Sun.io TRON quotes with Ledger (payload is too big for the device, unfixable)

Engineering

  • ^

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

  • ^

Screenshots (if applicable)

https://jam.dev/c/4182b062-be21-4945-82fd-0ed58d00190f

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messaging for Ledger TRON hardware wallet users, providing clear guidance when transaction data permissions need to be enabled in device app settings.
  • Updates

    • Updated multiple hardware wallet device support libraries to the latest version for enhanced compatibility and functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

@gomesalexandre gomesalexandre requested a review from a team as a code owner December 17, 2025 10:16
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Warning

Rate limit exceeded

@gomesalexandre has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 16ab460 and 81d21f5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • package.json (1 hunks)
  • packages/chain-adapters/package.json (1 hunks)
  • packages/chain-adapters/src/error/ErrorHandler.ts (1 hunks)
  • packages/swapper/package.json (1 hunks)
  • src/assets/translations/en/main.json (1 hunks)
  • src/state/helpers.ts (3 hunks)
📝 Walkthrough

Walkthrough

This PR updates hdwallet library dependencies to version 1.62.31-thor-tron-ledger.5 across multiple package manifests, adds error handling for a Ledger TRON-specific constraint, introduces corresponding translation strings, and switches the npm registry to a local endpoint.

Changes

Cohort / File(s) Summary
Registry Configuration
\.yarnrc\.yml
Changed npmRegistryServer from official npm registry to local registry (http://127.0.0.1:4873)
Dependency Version Updates
package\.json, packages/chain-adapters/package\.json, packages/swapper/package\.json
Updated @shapeshiftoss/hdwallet-* dependencies from 1.62.30 to 1.62.31-thor-tron-ledger.5 across 18 hdwallet packages in root manifest and ledger/core packages in chain-adapters and swapper
Error Handling
packages/chain-adapters/src/error/ErrorHandler\.ts
Added conditional branch to handle 'LedgerTronAllowDataDisabled' error name and throw ChainAdapterError with translation key 'chainAdapters.errors.ledgerTronAllowDataDisabled'
Translation Strings
src/assets/translations/en/main\.json
Added new translation entry for ledgerTronAllowDataDisabled error: "Please enable Transactions Data in your Ledger TRON app settings and try again."
Formatting
src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution\.tsx
Added blank line spacing in error-handling block (whitespace only)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the new hdwallet version (1.62.31-thor-tron-ledger.5) contains the intended Ledger TRON fixes and has no breaking changes
  • Confirm the 'LedgerTronAllowDataDisabled' error name matches the upstream hdwallet library implementation
  • Validate that switching to local npm registry (127.0.0.1:4873) is intentional and test-specific

Possibly related PRs

Suggested reviewers

  • NeOMakinG
  • kaladinlight
  • 0xApotheosis

Poem

🐰 A hop through hdwallet lands so bright,
With Ledger TRON support shining light,
Errors caught, translations in place,
Registry switched to a local space,
One version bump makes the journey right! 🌟

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding Ledger TRON Transaction Data disabled error handling, which is the primary feature added across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Detects when Ledger users attempt to sign TRON transactions with memos
(required for Thorchain/Mayachain swaps) and the "Transactions Data"
setting is disabled.

Follows the same ChainAdapterError pattern as blind signing errors:
- ErrorHandler catches LedgerTronAllowDataDisabled by error.name
- Wraps in ChainAdapterError with translation key
- Shows user-friendly message matching blind signing UX

Error message:
  "Please enable Transactions Data in your Ledger TRON app settings and try again."

Requires: hdwallet-ledger with allowData validation
Fixes: Cryptic 0x6a8b error for Thorchain TRON swaps on Ledger

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sun.io TRON swaps use complex smart contract calls with arrays that
encode to 300-500+ bytes, exceeding Ledger TRON app's 250-byte protobuf
field limit (CHUNK_SIZE in @ledgerhq/hw-app-trx).

This causes 'Too many bytes to encode' errors when signing.

Thorchain works because it uses simple transfers (68 bytes) with small
memos (40-80 bytes), well under the limit.

This is a fundamental Ledger hardware limitation that cannot be worked
around. Sun.io quotes are now silently disabled for Ledger + TRON,
similar to how GridPlus UTXO swaps are restricted.

Error from Ledger: Trx.signTransaction() throws at line 142 when any
single protobuf field exceeds 250 bytes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gomesalexandre gomesalexandre enabled auto-merge (squash) December 18, 2025 12:33
@gomesalexandre gomesalexandre merged commit 4d14ceb into develop Dec 18, 2025
4 checks passed
@gomesalexandre gomesalexandre deleted the fix_thor_tron_ledger branch December 18, 2025 12:51
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