Skip to content

Refactor address page - #84

Merged
AugustoL merged 5 commits into
openscan-explorer:devfrom
AugustoL:refactor-address-page
Dec 6, 2025
Merged

AugustoL merged 5 commits into
openscan-explorer:devfrom
AugustoL:refactor-address-page

Conversation

@AugustoL

@AugustoL AugustoL commented Dec 5, 2025 •

Copy link
Copy Markdown
Collaborator

mere after #83

Summary

This PR refactors the address page with type-based display components and adds dedicated NFT token detail pages.

Address Page Refactor

  • Type-based display components: Address pages now use specialized components based on address type (Account, Contract, ERC20, ERC721, ERC1155)
  • Address type detection: Automatic detection via metadata lookup first, then ERC165/ERC20 on-chain detection as fallback
  • Shared components: Extract reusable components (AddressHeader, BalanceSection, ContractDetails, TransactionHistory, ENSRecordsDisplay)
  • CSS cleanup: Move all inline styles to CSS classes in components.css

NFT Token Detail Pages

Add dedicated token detail pages accessible via /:networkId/address/:contract/:tokenId route:

  • Token metadata display: Image, name, description, and properties/attributes from token URI
  • Collection info: Name and symbol fetched from contract via on-chain calls
  • Ownership info:
    • ERC721: Owner address and approved address
    • ERC1155: Balance lookup by address
  • Token URI section: Display raw URI with link to open metadata
  • Raw metadata: Collapsible JSON section showing full metadata

Technical Changes

  • Create hexUtils.ts for browser-compatible hex decoding (replaces Node.js Buffer)
  • Add erc721Metadata.ts and erc1155Metadata.ts utility modules
  • Add NFTTokenDetail wrapper with auto-detection via ERC165 supportsInterface
  • Add utility CSS classes (.hidden, .word-break-all)

New Files

  • src/components/pages/address/displays/ - Type-specific display components
  • src/components/pages/address/shared/ - Reusable address components
  • src/components/pages/tokenDetails/ - NFT token detail pages
  • src/utils/hexUtils.ts - Hex decoding utilities
  • src/utils/erc721Metadata.ts - ERC721 metadata fetching
  • src/utils/erc1155Metadata.ts - ERC1155 metadata fetching"

- Move all inline styles from AddressDisplay.tsx to components.css
- Add CSS classes for address header, ENS name display
- Add CSS classes for wallet connect buttons and chain selector
- Add CSS classes for contract function buttons (read/write)
- Add CSS classes for function forms, inputs, and results
- Add CSS classes for transaction status and history section
- Add CSS classes for sourcify link and table links
- Add AddressType for account, contract, erc20, erc721, erc1155
- Create fetchAddressWithType utility combining data fetch and type detection
- Detect token types via metadata first, then ERC165/ERC20 on-chain detection
- Add separate display components for each address type
- Extract shared components: AddressHeader, BalanceSection, ContractDetails, etc.
- Add CSS classes for address type indicators and token badges
Add dedicated token detail pages accessible via /:networkId/address/:contract/:tokenId
route that display individual NFT metadata including:
- Token image, name, description, and properties/attributes
- Collection info (name, symbol) fetched from contract
- Owner and approval status (ERC721) / balance lookup (ERC1155)
- Token URI with link to raw metadata
- Collapsible raw metadata JSON section

Technical changes:
- Create shared hexUtils.ts for browser-compatible hex decoding
- Add erc721Metadata.ts and erc1155Metadata.ts utility modules
- Add NFTTokenDetail wrapper with auto-detection via ERC165
- Remove inline CSS styles in favor of utility classes
- Add NFT-specific CSS styles to components.css
@AugustoL
AugustoL changed the base branch from main to dev December 5, 2025 20:32
@AugustoL
AugustoL marked this pull request as ready for review December 6, 2025 00:37
@AugustoL AugustoL self-assigned this Dec 6, 2025
@AugustoL
AugustoL merged commit 82d5f47 into openscan-explorer:dev Dec 6, 2025
1 check 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.

1 participant