Skip to content

Comments

fix(explorer): fix contract interact for unverified contracts#598

Open
gakonst wants to merge 2 commits intomainfrom
georgios/fix-explorer-contract-interact
Open

fix(explorer): fix contract interact for unverified contracts#598
gakonst wants to merge 2 commits intomainfrom
georgios/fix-explorer-contract-interact

Conversation

@gakonst
Copy link
Contributor

@gakonst gakonst commented Feb 18, 2026

Summary

Fixes contract interaction issues on the explorer for unverified/partially-verified contracts.

Addresses WEB-396 and the LayerZero contract issue (0xbb95...e8e0 showing only Ownable2Step functions).

Changes

Raw call decoding fixes (ContractReader.tsx)

  • Extract shared decodeRawCallResult helper — deduplicates ~160 lines of identical heuristic decoding
  • Fix empty array decoding: length >= 0 (was > 0) so empty address[] returns decode correctly
  • Add uint256[] fallback when array elements don't look like addresses
  • Improve string heuristic: only accept printable ASCII to avoid false positives
  • Use fnId consistently in useReadContract (fixes unnamed whatsabi functions)

Show unnamed whatsabi functions (contracts.ts)

  • Include unnamed functions (selector-only from bytecode extraction) in both Read and Write sections
  • Previously, functions extracted by whatsabi that couldn't be resolved via signature databases (OpenChain/4byte/Samczsun) were completely invisible in the interact tab
  • Now they show by their 4-byte selector so users can still interact

Better write error messages (ContractWriter.tsx)

  • Surface nested revert reasons from viem error chain
  • Add authorization hint for 'unknown reason' reverts

Root cause note

The LayerZero contract at 0xbb95...e8e0 is not verified on contracts.tempo.xyz (returns contract_not_found). Sourcify also doesn't support chain 4217. The user may need to re-verify using Foundry pointed at https://contracts.tempo.xyz instead of Sourcify.

Testing

  • pnpm check:types
  • pnpm check:biome

Prompted by: georgios

- 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>
@gakonst gakonst self-assigned this Feb 18, 2026
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Bundle Size Report

Metric Size Δ Change
Total 5.3 MB +512.2 KB (+10.5%)
Gzip 1.5 MB +188.7 KB (+14.1%)
Brotli 1.3 MB +157.6 KB (+13.7%)
Chunk changes (>1KB)
Chunk Change
assets/QueryBuilder.js (removed) -423.4 KB
assets/createSsrRpc.js (removed) -43.8 KB
assets/stringify.js (removed) -19.7 KB
assets/base.js (removed) -12.8 KB
assets/useWatchBlockNumber.js (removed) -2.1 KB
assets/utils.js -1.7 KB
assets/Intro.js +1.2 KB
assets/profiling.js +1.3 KB
assets/useChainId.js +1.7 KB
assets/_layout.js +1.7 KB
assets/wagmi.config.js +3.9 KB
assets/block-number.js (new) +4.3 KB
assets/_address.js +8.7 KB
assets/isAddressEqual.js +19.0 KB
index.js +92.4 KB
assets/router.js +156.8 KB
assets/fetch.js (new) +249.2 KB
assets/tempo-queries.js (new) +474.9 KB

Compared against main branch (baseline from 2/4/2026, 5:13:51 PM)

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Cloudflare Deployments

App Environment Status Preview
api - [>>] Skipped No changes
explorer devnet [OK] Deployed View Preview
explorer moderato [OK] Deployed View Preview
explorer presto [OK] Deployed View Preview
explorer testnet [OK] Deployed View Preview
fee-payer devnet [>>] Skipped No changes
fee-payer privy [>>] Skipped No changes
fee-payer testnet [>>] Skipped No changes
og - [>>] Skipped No changes
tokenlist - [>>] Skipped No changes

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>
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.

1 participant