Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Add ENS name resolution support to Contacts#1729

Merged
gemcoder21 merged 6 commits intomainfrom
support-domain-for-contacts
Feb 26, 2026
Merged

Add ENS name resolution support to Contacts#1729
gemcoder21 merged 6 commits intomainfrom
support-domain-for-contacts

Conversation

@DRadmir
Copy link
Copy Markdown
Contributor

@DRadmir DRadmir commented Feb 24, 2026

Integrate NameService into ManageContactAddressViewModel to allow resolving domain names (e.g., vitalik.eth) when adding contact addresses. Validates address on save if no name was resolved.

Simulator Screenshot - iPhone 17 Pro Max - 2026-02-24 at 13 57 22 Simulator Screenshot - iPhone 17 Pro Max - 2026-02-24 at 13 57 27 Simulator Screenshot - iPhone 17 Pro Max - 2026-02-25 at 23 28 40

Integrate NameService into ManageContactAddressViewModel to allow
resolving domain names (e.g., vitalik.eth) when adding contact addresses.
Validates address on save if no name was resolved.
@DRadmir DRadmir self-assigned this Feb 24, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces support for Ethereum Name Service (ENS) and similar domain name resolution within the Contacts feature. It allows users to input human-readable domain names instead of raw blockchain addresses, which are then resolved to their corresponding addresses. The changes include updating the data flow to incorporate the NameService, enhancing the user interface to show resolution status, and modifying validation logic to handle both resolved and direct address inputs, significantly improving the user experience for managing contacts.

Highlights

  • ENS Name Resolution Integration: Integrated the NameService into the Contacts feature, enabling users to resolve domain names (e.g., vitalik.eth) to blockchain addresses when adding or managing contact addresses.
  • Dynamic Address Validation: Implemented dynamic address validation that considers the name resolution state. If a name is resolved, the resolved address is used; otherwise, the input address is validated, ensuring correct data entry.
  • UI/UX Enhancements for Name Resolution: Updated the Manage Contact Address UI to display the name resolution state (loading, error, complete) and incorporated a new NameRecordView component to provide visual feedback during the resolution process.
  • Dependency Injection for NameService: Propagated the NameService dependency through various ViewModels and Scenes within the Contacts feature, ensuring that name resolution capabilities are available where needed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Features/Contacts/Package.swift
    • Added ChainServices package dependency.
    • Included NameService and NameServiceTestKit products as dependencies for the Contacts feature and its tests.
  • Features/Contacts/Sources/Scenes/ContactsScene.swift
    • Modified ManageContactViewModel initialization to accept and pass the nameService dependency for both adding and editing contacts.
  • Features/Contacts/Sources/Scenes/ManageContactAddressScene.swift
    • Added an onChange modifier to observe nameResolveState changes and trigger onChangeNameResolverState.
    • Integrated NameRecordView into the address input's trailing view to display name resolution status.
    • Adjusted the layout of input actions to accommodate the new NameRecordView.
  • Features/Contacts/Sources/Scenes/ManageContactNavigationStack.swift
    • Updated ManageContactAddressViewModel initialization to pass the nameService dependency when adding or editing contact addresses.
  • Features/Contacts/Sources/ViewModels/ContactsViewModel.swift
    • Introduced a nameService property of type any NameServiceable.
    • Modified the initializer to accept nameService as a parameter and assign it.
  • Features/Contacts/Sources/ViewModels/ManageContactAddressViewModel.swift
    • Added nameService as a private property and to the initializer.
    • Introduced nameResolveState to track the status of name resolution.
    • Added a computed property nameRecordViewModel to provide data for NameRecordView.
    • Updated buttonState logic to disable the button during name resolution (loading/error states).
    • Implemented resolvedAddress to return the resolved address if available, otherwise the trimmed input address.
    • Modified currentAddress to use resolvedAddress for checksumming.
    • Reset nameResolveState to .none when onSelectChain is called.
    • Added onChangeNameResolverState to clear address input errors if a name is successfully resolved.
    • Updated the complete() method with a guard clause to ensure either a name is resolved or the address input is valid before proceeding.
  • Features/Contacts/Sources/ViewModels/ManageContactViewModel.swift
    • Added a nameService property of type any NameServiceable.
    • Modified the initializer to accept nameService as a parameter and assign it.
  • Features/Contacts/Tests/ContactsTests/ManageContactAddressViewModelTests.swift
    • Imported NameServiceTestKit for testing name service functionality.
    • Added a new test case nameResolveState() to verify button state changes based on nameResolveState.
    • Updated the mock initializer to accept an optional nameService parameter.
  • Features/Contacts/Tests/ContactsTests/ManageContactViewModelTests.swift
    • Imported NameServiceTestKit.
    • Updated the mock initializer to accept an optional nameService parameter.
  • Gem/Navigation/Settings/SettingsNavigationStack.swift
    • Added @Environment(\.nameService) to inject the nameService environment object.
    • Modified the ContactsScene initialization to pass the injected nameService to ContactsViewModel.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully integrates the NameService into the Contacts feature, allowing for ENS name resolution when adding contact addresses. The changes are well-implemented, including dependency injection of the NameService across relevant ViewModels and Views. The ManageContactAddressViewModel correctly handles the nameResolveState to manage button states and ensures proper address validation, prioritizing resolved addresses. Unit tests have been updated to cover the new name resolution logic, which is a good practice. Overall, the changes are clean, functional, and align with the stated objective.

Copy link
Copy Markdown
Contributor

@gemcoder21 gemcoder21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it reusable across 3 different screens

DRadmir and others added 5 commits February 25, 2026 10:31
…servable

Extract duplicated address input + name resolution logic from Transfer and Contacts
into reusable AddressInputView + AddressInputViewModel in PrimitivesComponents.
Refactor NameRecordViewModel from a simple struct to @observable class that owns
resolve state and task, simplifying NameRecordView to a pure display component.
…lidation

- Add ContactsNavigationView coordinator with push navigation for contact editing
- Replace sheet-based contact editing with NavigationLink push (hides tab bar)
- Keep sheet presentation for adding new contacts
- Consolidate address sheet into ManageContactScene (remove duplication)
- Replace StateButton with toolbar checkmark button matching iOS Contacts style
- Unify isPresentingAddAddress/isPresentingContactAddress into single isPresentingAddress
- Fix AddressInputViewModel.validate() to properly reject invalid addresses
- Add Scenes.Contact for type-safe navigation
- Add AddressInputViewModel unit tests
- Add semibold title and secondary subtitle styles to contact list items
- Increase type-based asset image text size from 0.3 to 0.35
@gemcoder21 gemcoder21 merged commit c163503 into main Feb 26, 2026
1 check passed
@gemcoder21 gemcoder21 deleted the support-domain-for-contacts branch February 26, 2026 21:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants