Skip to content

feat(tx): decode UTF-8 text in transaction input data#320

Merged
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:feat/decode-utf8-input-data
Mar 16, 2026
Merged

feat(tx): decode UTF-8 text in transaction input data#320
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:feat/decode-utf8-input-data

Conversation

@AugustoL
Copy link
Collaborator

Description

When transaction input data is not an ABI-encoded function call, attempt to decode it as UTF-8 text. If the result is mostly printable characters (≥80%), display it in a readable pre-formatted block above the raw hex.

Related Issue

Closes #311

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Performance improvement

Changes Made

  • Added tryDecodeUtf8() utility in src/utils/inputDecoder.ts — decodes hex to bytes, runs through TextDecoder, checks printable ratio
  • Updated InputDataTab to show "UTF-8 Decoded Text" section when ABI decode fails but UTF-8 decode succeeds
  • Added .tx-input-utf8 CSS styles (scrollable pre block, max 400px height)
  • Added analyser.utf8Text i18n key to all 5 locales

Test Transaction

  • EF Mandate tx — self-transfer with the full Ethereum Foundation Mandate encoded as UTF-8 in input data

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • My code follows the project's architecture patterns

When ABI decoding fails, attempt to decode the hex input as UTF-8 text.
If ≥80% of characters are printable, show the decoded text above the
raw hex in a readable pre-formatted block. This handles text messages
embedded in transactions like the Ethereum Foundation mandate.

Closes openscan-explorer#311
@github-actions
Copy link

🚀 Preview: https://pr-320--openscan.netlify.app
📝 Commit: ef25cf5ccfaae2ce092ad7ceac147207a5a31d85

@AugustoL AugustoL requested review from MatiasOS March 16, 2026 16:47
@AugustoL AugustoL merged commit 1426f3b into openscan-explorer:dev Mar 16, 2026
4 of 7 checks passed
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