fix: issue #271 Arbitrum contract shown as account#272
Merged
AugustoL merged 2 commits intoopenscan-explorer:devfrom Mar 4, 2026
Merged
Conversation
|
🚀 Preview: https://pr-272--openscan.netlify.app |
AugustoL
approved these changes
Mar 3, 2026
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 false
accountclassification on address pages when type detection RPC calls fail.Root cause
In
src/components/pages/evm/address/index.tsx, the address page:dataService.networkAdapter.getAddress()(which includescodefrometh_getCode)fetchAddressWithType()to detect the specific type (ERC-20, ERC-721, etc.)If step 2 failed (RPC error, timeout, etc.), the
.catch()handler always fell back to"account"— even when the already-fetchedcodeclearly showed non-empty bytecode, indicating a contract.This caused contracts on Arbitrum (and potentially other networks) to be displayed as EOA accounts.
Changes
src/utils/addressTypeDetection.tshasContractCode()so it can be reused (was previously private)src/components/pages/evm/address/index.tsxhasContractCodefrom the detection utility (no logic duplication).catch()fallback: usehasContractCode(addressData.code)to infer type from already-fetched data instead of forcing"account"else): same fallback instead of leaving type as default"account"src/utils/addressTypeDetection.test.ts(new)hasContractCode(null, empty,0x,0x0, real bytecode, case sensitivity)checkEIP7702DelegationandgetEIP7702DelegateAddressgetAddressTypeLabelandgetAddressTypeIconVerification
eth_getCodefor0xc27F8a94Df88C4f57B09067e07EA6bC11CA47e11on Arbitrum returns ~33KB of bytecode (definitively a contract)vitest run)Issue
Closes #271