Primary Names
We can all agree 42-character long machine-optimized addresses (eg. 0x225...c3b5) are not aesthetically pleasing. In order to convert them to human-readable names, we use the reverse registrar.
The reverse registrar is a smart contract that allows users to register their preferred name, referred to as their "primary name" for simplicity purposes.
Getting a Primary Name
To get a users preferred primary name is very simple. In most libraries you can do a simple lookup by address as shown below.
Reverse Lookup
import { useEnsName } from 'wagmi';
export const Name = () => {
const { data: name, chainId } = useEnsName({
address: '0x225f137127d9067788314bc7fcc1f36746a3c3B5',
});
return <div>Name: {name}</div>;
};
And thats it!
Do's and Don'ts
TODO: Insert excerpt of design guidelines for primary names here.
Setting Primary Names
In some cases you might want to encourage users to set their primary name. This might be in the event you are issuing names, or want people to be part of a community. Most users are expected to do this through the ENS Manager, however it is totally doable from 3rd-party platforms aswell.
Reverse Lookup
// TODO: Write Code Snippet
Do's and Don'ts
It must be noted that under no situation is it recommended to force a user to change their primary name, nor doing so without clearly notifying the user of what the transaction they are about to execute could modify. Doing so could be seen as hostile or undesired behaviour by end users and might degrade their experience with your app.