Skip to content

Conversation

@drichar
Copy link
Contributor

@drichar drichar commented Jul 10, 2025

Description

This PR adds comprehensive metadata functionality to the NFD SDK for resolving avatar and banner images from NFDs. The new MetadataModule provides both direct resolution from NFD names/IDs and optimized parsing from existing NFD data objects, with automatic IPFS to HTTPS conversion and smart fallback handling.

Details

  • Added MetadataModule extending BaseModule for NFD metadata operations
  • Implemented getAvatarImage() and getBannerImage() methods with method overloads for performance optimization
  • Created IPFS utility functions for URL validation and availability checking with support for JSON metadata parsing
  • Added automatic fallback to default NFD avatar when no custom avatar is set
  • Included verification status detection and ASA ID extraction for NFT-based images
  • Added NfdImageResult type for structured image resolution results
  • Integrated new methods into NfdClient public interface with proper TypeScript overloads
  • Created comprehensive example project demonstrating real-time avatar and banner resolution
  • Added complete test coverage for both MetadataModule and IPFS utilities
  • Updated documentation with usage examples and integration guides
  • Exported new types and utility functions for external SDK usage

drichar added 5 commits July 10, 2025 04:08
Add comprehensive metadata functionality to resolve NFD avatar and banner
images with automatic IPFS to HTTPS conversion. The new `MetadataModule`
provides both direct resolution from NFD names/IDs and optimized parsing
from existing NFD data objects.

Key features include:
- Avatar images with automatic fallback to default NFD avatar
- Banner image resolution (returns null if none set)
- IPFS URL conversion with smart fallback logic (images.nf.domains ->
  IPFS gateway)
- Verification status detection for NFT-based images
- ASA ID extraction for verified images
- Method overloads for performance optimization
- Comprehensive error handling and type safety

Add IPFS utility functions for URL validation and availability checking
with support for JSON metadata parsing. Include complete test coverage
for both metadata module and IPFS utilities.

Update documentation with usage examples and integrate new methods into
`NfdClient` public interface. Export new types and utility functions for
external use.
…resolution

Add comprehensive example project showcasing the new metadata module
functionality. The example provides an interactive React application for
testing avatar and banner image resolution with real-time display of
metadata results.

Features demonstrated include:
- Avatar image resolution with automatic fallback to default NFD avatar
- Banner image resolution (null when not configured)
- IPFS to HTTPS conversion with smart URL truncation for display
- Verification status and ASA ID display for NFT-based images
- Performance optimization with parallel image resolution
- Interactive examples with pre-populated test NFD names

Update examples documentation to include the new metadata example in the
available examples list. Configure standard React + TypeScript + Vite
setup with proper ESLint configuration and Node.js polyfills for
blockchain operations.
@drichar drichar merged commit 7fd80e2 into main Jul 10, 2025
1 check passed
@drichar drichar deleted the feat/metadata-module branch July 10, 2025 08:24
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.

2 participants