-
Notifications
You must be signed in to change notification settings - Fork 39
feat(frontend): Service to load EXT NFTs #10575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a service to load EXT NFTs for ICP (Internet Computer Protocol), mirroring the existing functionality for ERC NFTs on Ethereum. The implementation adds utility functions to map EXT token data to NFT objects, a service layer to fetch NFTs from multiple collections, and comprehensive test coverage for both utilities and services.
Key changes:
- Added
loadNftsservice to fetch EXT NFTs from multiple token collections for a given identity - Created
mapExtNftutility to transform EXT token indices into standardized NFT objects with proper identifiers and image URLs - Introduced
IcNonFungibleTokentype to represent ICP-based NFTs in the type system
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/icp/services/nft.services.ts | New service implementing NFT loading logic with error handling for multiple EXT token collections |
| src/frontend/src/icp/utils/nft.utils.ts | Utility functions to map EXT token data to standardized NFT format with collection metadata |
| src/frontend/src/icp/types/nft.ts | Type definition for ICP non-fungible tokens (currently only ExtToken) |
| src/frontend/src/lib/types/nft.ts | Updated NonFungibleToken union type to include IcNonFungibleToken instead of ExtToken directly |
| src/frontend/src/tests/icp/services/nft.services.spec.ts | Comprehensive tests for loadNfts service covering edge cases and error handling |
| src/frontend/src/tests/icp/utils/nft.utils.spec.ts | Tests for mapExtNft utility including validation of negative indices |
| src/frontend/src/tests/mocks/ext-tokens.mock.ts | Added second mock EXT token for testing multiple collection scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Similar to what we have for ERC NFTs, we create a service to load EXT NFTs.