The SDK can answer "who owns username X" (resolvePeopleUsernameOwner, the one implemented function in identity/dotns.ts) but not the direction products actually need on a results or profile screen: "what is this account's username". That read is Resources.Consumers(account), which carries both names and the credibility:
{ identifier_key, lite_username, full_username?, credibility }
Display name is full_username, else lite_username, and "eligible to claim the bare name" is exactly full_username being unset. Both humanity-design-draft (app/src/chain/identity.ts) and dim2-spa (apps/web/src/lib/membership.ts) hand-roll this decode today.
The SDK already believes it has this helper: auth/src/auth.ts:66 documents SessionAddresses.rootAddress as "the right input for lookupUsername", and skills/product-sdk-transactions/references/auth-api.md:57 repeats it. lookupUsername does not exist anywhere in the repo.
Ask:
- a typed Consumers read: account in, { liteUsername, fullUsername, credibility } out, over the same structural PeopleUsernameQueryApi pattern resolvePeopleUsernameOwner uses, so it works with any chain that has the storage shape
- while touching this surface: resolvePeopleUsernameOwner takes storage that yields SS58 and returns 0x hex. Documented and correctly typed, but asymmetric, so a Consumers round trip needs a manual conversion on the caller side. Returning SS58 to match the input side (or both forms) would remove that trap.
Part of #286
The SDK can answer "who owns username X" (resolvePeopleUsernameOwner, the one implemented function in identity/dotns.ts) but not the direction products actually need on a results or profile screen: "what is this account's username". That read is Resources.Consumers(account), which carries both names and the credibility:
Display name is full_username, else lite_username, and "eligible to claim the bare name" is exactly full_username being unset. Both humanity-design-draft (app/src/chain/identity.ts) and dim2-spa (apps/web/src/lib/membership.ts) hand-roll this decode today.
The SDK already believes it has this helper: auth/src/auth.ts:66 documents SessionAddresses.rootAddress as "the right input for lookupUsername", and skills/product-sdk-transactions/references/auth-api.md:57 repeats it. lookupUsername does not exist anywhere in the repo.
Ask:
Part of #286