feat: Stellar Name Service (SNS) integration — closes #112, closes #79 - #371
Merged
Emmy123222 merged 2 commits intoJul 28, 2026
Merged
Conversation
## What Adds human-readable Stellar name resolution (.xlm / federation) so users can type e.g. alice.xlm in the Send Payment form instead of a raw G... address. ## Implementation ### Protocol choice Uses the built-in Stellar Federation protocol (SEP-0002) via the @stellar/stellar-sdk FederationServer already in the project. No new runtime dependency added. .xlm shorthand names are translated to alice*stellarnames.org federation lookups (documented in the code so the mapping is easy to swap). ### frontend/lib/stellar.ts - Added ResolvedName interface (name, address, resolvedAt) for the cache - Replaced the previous opaque cache shape with ResolvedName entries - Rewrote resolveStellarName with full JSDoc: .xlm -> federation mapping explained, raw G... bypass, TTL cache using resolvedAt timestamp - Exported clearNameCache() helper for tests - Added full JSDoc to isStellarName ### frontend/components/SendPaymentForm.tsx - Imports isStellarName and resolveStellarName from lib/stellar - New snsResolvedAddress / snsResolving state for the destination field - useEffect with 400ms debounce triggers resolveStellarName whenever the destination matches isStellarName(); cancels on cleanup - Inline spinner (aria-live) shown while resolving - 'Resolves to: GABC...XYZ' confirmation line shown on success - Inline red error shown on failure; submit blocked until fixed - canSubmit gates on !snsResolving and requires snsResolvedAddress for SNS names so raw name strings are never submitted - resolveDestinationForPayment prefers the already-resolved snsResolvedAddress to avoid a redundant second lookup at submit time - SNS state cleared on destination change, contact select, and form reset ### frontend/pages/settings.tsx - Fixed bug: SNS card was accidentally nested inside the Mainnet Warning Modal div — moved it out as a standalone settings card - Card explains .xlm names, Federation protocol, StellarNames provider, 10-min cache TTL, and the stellar.toml limitation - Links directly to stellarnames.org registration (opens in new tab) ### Tests (frontend/__tests__/) - resolveStellarName.test.ts — isStellarName, resolveStellarName: raw bypass, successful .xlm and federation resolution, cache hit/miss, TTL expiry, clearNameCache, error propagation, no caching of failures - SendPaymentFormSNS.test.tsx — spinner during resolution, resolved address shown, error shown + submit blocked, submit uses resolved address not typed name, raw G... skips resolution - settingsSNS.test.tsx — section renders, .xlm copy present, link to stellarnames.org with target=_blank, limitation disclaimer visible, card is not inside the modal ## Limitations Resolution depends on the recipient's domain publishing a valid stellar.toml; names not registered with a federation server will fail to resolve (documented in the UI).
|
@udeachudivine-spec is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
| render(<SettingsPage {...defaultProps} />); | ||
| const links = screen | ||
| .getAllByRole("link") | ||
| .filter((el) => el.getAttribute("href")?.includes("stellarnames.org")); |
| render(<SettingsPage {...defaultProps} />); | ||
| const link = screen | ||
| .getAllByRole("link") | ||
| .find((el) => el.getAttribute("href")?.includes("stellarnames.org") && el.textContent?.includes("Register")); |
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.
What
Adds human-readable Stellar name resolution (.xlm / federation) so users can type e.g. alice.xlm in the Send Payment form instead of a raw G... address.
Implementation
Protocol choice
Uses the built-in Stellar Federation protocol (SEP-0002) via the @stellar/stellar-sdk FederationServer already in the project. No new runtime dependency added. .xlm shorthand names are translated to alice*stellarnames.org federation lookups (documented in the code so the mapping is easy to swap).
frontend/lib/stellar.ts
frontend/components/SendPaymentForm.tsx
frontend/pages/settings.tsx
Tests (frontend/tests/)
Limitations
Resolution depends on the recipient's domain publishing a valid stellar.toml; names not registered with a federation server will fail to resolve (documented in the UI).
Summary
Type of change
Related issue
Closes #
Changes
Testing
Screenshots (if UI change)
Checklist
main