fix(explorer): fix contract interact for unverified contracts#598
Open
fix(explorer): fix contract interact for unverified contracts#598
Conversation
- Extract shared decodeRawCallResult helper (deduplicates StaticReadFunction and DynamicReadFunction heuristic decoding) - Fix empty array decoding: allow length >= 0 (not > 0) so empty address[] returns are decoded correctly instead of falling through to string - Add uint256[] fallback when array elements don't look like addresses - Improve string heuristic: only accept printable ASCII strings to avoid false positives that hide real array/uint results - Use fnId consistently in useReadContract (fixes unnamed whatsabi functions) - Improve write error messages: surface nested revert reasons and add authorization hint for 'unknown reason' reverts Amp-Thread-ID: https://ampcode.com/threads/T-019c7304-001e-7159-b236-acaf3e0690a8 Co-authored-by: Amp <amp@ampcode.com>
Bundle Size Report
Chunk changes (>1KB)
Compared against main branch (baseline from 2/4/2026, 5:13:51 PM) |
Cloudflare Deployments
|
For unverified contracts where whatsabi extracts selectors from bytecode but can't resolve names from signature databases, include the unnamed functions in both Read and Write sections so users can still interact via selector. Previously these functions were invisible. Amp-Thread-ID: https://ampcode.com/threads/T-019c7304-001e-7159-b236-acaf3e0690a8 Co-authored-by: Amp <amp@ampcode.com>
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
Fixes contract interaction issues on the explorer for unverified/partially-verified contracts.
Addresses WEB-396 and the LayerZero contract issue (
0xbb95...e8e0showing only Ownable2Step functions).Changes
Raw call decoding fixes (
ContractReader.tsx)decodeRawCallResulthelper — deduplicates ~160 lines of identical heuristic decodinglength >= 0(was> 0) so emptyaddress[]returns decode correctlyuint256[]fallback when array elements don't look like addressesfnIdconsistently inuseReadContract(fixes unnamed whatsabi functions)Show unnamed whatsabi functions (
contracts.ts)Better write error messages (
ContractWriter.tsx)Root cause note
The LayerZero contract at
0xbb95...e8e0is not verified oncontracts.tempo.xyz(returns contract_not_found). Sourcify also doesn't support chain 4217. The user may need to re-verify using Foundry pointed athttps://contracts.tempo.xyzinstead of Sourcify.Testing
pnpm check:types✅pnpm check:biome✅Prompted by: georgios