Files
amethyst/amethyst
mstrofnoneandm 012dae31d0 feat(onchain-zaps): inline Namecoin resolution indicator + result row
The local-cache suggestion dropdown can momentarily show a stale match
when the user types a .bit identifier. For example, after resolving
"m@testls.bit" earlier in the session, typing the bare host
"testls.bit" causes findUsersStartingWith() to return the cached
m@... profile first; the correct _@testls.bit profile only appears a
few seconds later when ElectrumX resolution finishes. There is no
visual hint that a Namecoin lookup is in flight, and on hard failures
(timeout, malformed record, no nostr field, etc.) the user gets no
feedback at all.

This adds a dedicated NamecoinResolutionRow composable mounted between
the recipient field and the local-cache dropdown:

  - "Resolving <name> on Namecoin…" spinner while the on-chain
    lookup is in flight (after a 300 ms debounce that matches the
    dropdown's own debounce).
  - On success, a tappable row showing the resolved profile with a
    distinct "Namecoin" badge (MaterialSymbols.Link), so the user
    can pick the on-chain-verified profile unambiguously.
  - On failure, a single explanatory error line covering all
    NamecoinResolveOutcome variants the resolver already produces:
    NameNotFound, NoNostrField, MalformedRecord (with the underlying
    parser error verbatim), ServersUnreachable, InvalidIdentifier and
    Timeout.

State is held in the shared NamecoinResolveState sealed class already
used by NamecoinNameService and the desktop SearchScreen — no new
state model is introduced. A small mapOutcomeToResolveState() helper
mirrors the same wording desktop ships, so all Namecoin surfaces
produce the same diagnostic string for the same outcome.

The row owns its own LaunchedEffect keyed on the typed query, so it
cancels in-flight lookups whenever the user keeps typing, and it
unmounts cleanly once a recipient is selected. It uses the existing
Amethyst.instance.namecoinResolver instance, so no DI plumbing or new
network calls beyond what was already wired up for .bit resolution.

The dropdown is left untouched: local-cache results are still valid
hits (just not necessarily the *intended* on-chain identity), so they
remain available below the new row.

Pure helpers (looksLikeNamecoinIdentifier + the outcome-to-state
mapper) are covered by unit tests in NamecoinResolutionRowTest.
2026-05-19 06:11:39 +10:00
..
2026-05-16 16:53:00 -04:00