- 
                Notifications
    
You must be signed in to change notification settings  - Fork 20
 
Description
Description:
Lora currently uses Non-Fungible Domains (NFDs) from https://docs.nf.domains/ to create human-readable labels for addresses throughout the application.
About NFDs: NFDs are unique, digital identities built on Algorand that provide human-readable names for blockchain addresses (e.g., staci.algo ➡️ DC7K77...EK3Qv). They use reverse resolution to convert long, confusing addresses into readable names, making blockchain interactions more user-friendly. NFDs can also store additional metadata like social media profiles and contact information.
The Need: While NFDs provide excellent decentralized identity resolution, users often need custom labeling for addresses that don't have NFDs or want organization-specific labels (e.g., "Treasury Wallet", "Dev Team Multisig", "Marketing Budget").
The Solution: We need to add functionality that allows users to load a custom label mapping file that will take precedence over NFD labels when displaying addresses. This will enable users to define their own custom labels for specific addresses that will be displayed anywhere an address appears in Lora, while maintaining all existing NFD functionality.
Acceptance Criteria:
Primary Requirements:
- ✅ Users can upload a custom label mapping file through the Settings page
 - ✅ Custom labels take precedence over NFD labels when both exist for the same address
 - ✅ Custom labels are displayed anywhere addresses are currently shown in the application
 - ✅ Existing NFD functionality remains completely unchanged
 - ✅ Custom labels persist across application sessions
 - ✅ Users can update/replace their custom label mapping file
 - ✅ Users can clear/remove custom label mappings
 
File Format Requirements:
- ✅ Support JSON file format with address-to-label mapping
 - ✅ File validation to ensure proper format
 - ✅ Clear error messages for invalid file formats or addresses
 
Display Requirements:
- ✅ Custom labels appear in all components that currently display addresses:
- Account links and address displays
 - Transaction details (sender, receiver, etc.)
 - Asset details (creator, manager, etc.)
 - Application details
 - Transaction graphs
 - ABI method arguments
 - All other address display locations
 
 - ✅ (Suggestion) Custom labels should have visual indication they are custom (subtle styling difference)
 
User Experience:
- ✅ Clear UI in Settings page for managing custom labels
 - ✅ File upload with drag-and-drop support
 - ✅ Preview/validation of loaded labels before applying
 - ✅ Status indicators showing when custom labels are active
 
Technical Details:
Suggested Implementation Plan:
1. Data Storage (Priority 1)
- Create a new atom for storing custom label mappings using 
atomWithStorage - Location: 
src/features/settings/data/custom-labels.ts - Storage key: 
'custom-address-labels' - Type: 
Record<Address, string>(address -> label mapping) 
2. Settings UI Integration (Priority 1)
- Add custom label management section to 
src/features/settings/components/settings.tsx - Create new component: 
src/features/settings/components/custom-labels-manager.tsx - Utilize existing file upload components:
src/features/forms/components/file-form-item.tsxsrc/features/forms/components/file-input.tsx
 - Add file validation to make sure the file conforms to the format you specify.
 
3. Address Display Logic Enhancement (Priority 2)
- Modify 
src/features/accounts/components/account-link.tsxto check custom labels first - Update 
src/features/accounts/components/address-or-nfd-link.tsxto accept custom labels - Create new hook: 
src/features/settings/data/use-custom-label.tsfor label resolution - Priority order: Custom Label > NFD > Ellipsed Address
 
4. Integration Points (Priority 3)
- Update all 30+ components identified in grep search that use 
AccountLinkorAddressOrNfdLink - Ensure consistent label display across:
- Transaction components
 - Asset components
 - Application components
 - Transaction graph components
 - ABI method displays
 
 
File Format Specification:
{
  "DHMCHBN4W5MBO72C3L3ZP6GGJHQ4OR6SW2EP3VDEJ5VHT4MERQLCTVW6PU": "Treasury Wallet",
  "ANOTHER-VALID-ALGORAND-ADDRESS": "Dev Team Multisig",
  "YET-ANOTHER-ADDRESS": "Marketing Budget"
}Key Files to Modify:
src/features/settings/components/settings.tsx- Add custom labels sectionsrc/features/settings/data/custom-labels.ts- New data managementsrc/features/accounts/components/account-link.tsx- Label resolution logicsrc/features/accounts/components/address-or-nfd-link.tsx- Display logic
Testing Considerations:
- Unit tests for label resolution priority
 - Integration tests for file upload and validation
 - UI tests for settings page functionality
 - Update existing tests to show that custom labels are shown in existing components.
 
Performance Considerations:
- Use existing atom caching patterns similar to NFD implementation
 - Leverage 
atomWithStoragefor persistence similar to network configs - Check to see if there are any noticeable performance impacts.