feat(metadata): add NFD avatar and banner image resolution#16
Merged
Conversation
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.
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.
Description
This PR adds comprehensive metadata functionality to the NFD SDK for resolving avatar and banner images from NFDs. The new
MetadataModuleprovides 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
MetadataModuleextendingBaseModulefor NFD metadata operationsgetAvatarImage()andgetBannerImage()methods with method overloads for performance optimizationNfdImageResulttype for structured image resolution resultsNfdClientpublic interface with proper TypeScript overloadsMetadataModuleand IPFS utilities