element-x-ada/docs/build-logs/phase6-nft-result.md

3 KiB

Phase 6 Feature 3: NFT Display - COMPLETED

Date: 2026-03-29 Commit: 2d8df4f23f Branch: phase1-dev

Summary

Successfully implemented NFT thumbnail and metadata display in the Element X ADA wallet's Assets tab.

What Was Built

1. NFT Metadata Fetching (KoiosCardanoClient)

  • Added getNftMetadata(policyId, assetName) method to CardanoClient interface
  • Implemented Koios asset_info POST endpoint to fetch CIP-25 metadata
  • Parses onchain_metadata for: name, image, description, mediaType
  • Handles both string and array-based image URLs (some NFTs split URLs)
  • Caches metadata for 30 minutes to reduce API calls

2. IPFS URL Resolution (NftMetadata.kt)

  • New NftMetadata data class in wallet API module
  • resolveImageUrl() converts ipfs:// to https://ipfs.io/ipfs/
  • Also handles raw IPFS CIDs starting with Qm or bafy
  • joinImageParts() for NFTs that split URLs across array elements

3. Metadata Enrichment (WalletPanelPresenter)

  • enrichAssetsWithMetadata() identifies potential NFTs (quantity == 1)
  • Parallel metadata fetching using coroutines (batches of 10)
  • Graceful failure - continues even if some metadata fails to load
  • Updates asset objects with displayName, imageUrl, description, isNft flag

4. NFT Thumbnails (AssetsTabView)

  • 64dp square thumbnails with 8dp rounded corners
  • Uses Coil 3.4.0 AsyncImage for async image loading
  • Loading spinner while image loads
  • Error icon placeholder on failure (never crashes)
  • Clickable cards for NFTs with images

5. NFT Detail Bottom Sheet

  • NftDetailBottomSheet composable
  • Shows larger image (full width, aspect ratio 1:1)
  • Displays: NFT name, truncated policy ID, description (if available)
  • Quantity badge at bottom

Files Changed

features/wallet/api/src/main/kotlin/.../NftMetadata.kt (NEW)
features/wallet/api/src/main/kotlin/.../CardanoClient.kt (added getNftMetadata)
features/wallet/impl/build.gradle.kts (added Coil Compose deps)
features/wallet/impl/src/main/kotlin/.../KoiosCardanoClient.kt
features/wallet/impl/src/main/kotlin/.../WalletPanelPresenter.kt
features/wallet/impl/src/main/kotlin/.../WalletPanelView.kt
features/wallet/impl/src/main/kotlin/.../WalletPanelNode.kt
features/wallet/impl/src/main/kotlin/.../tabs/AssetsTabView.kt
features/wallet/test/src/main/kotlin/.../FakeCardanoClient.kt

Dependencies Added

implementation(libs.coil.compose)
implementation(libs.coil.network.okhttp)

Build Status

Full build :app:assembleFdroidDebug passes APK copied to /tmp/apk-server/element-x-ada-mainnet.apk (210 MB)

Testing Notes

  • NFT metadata will be visible for assets with quantity == 1
  • Images load asynchronously - expect brief loading spinners
  • IPFS images may be slow on first load (gateway fetch)
  • Tap any NFT card to see full-size image in bottom sheet

Phase 6 Status

Feature Status
1. ADA Handle Resolution Complete
2. Token Send Complete
3. NFT Display Complete

Phase 6 is COMPLETE!