Username resolution
Message Kit provides powerful username resolution capabilities through its resolver system. This allows applications to handle various types of identifiers including ENS domain and Converse usernames.
Supported identifiers
- Ethereum Addresses - Standard hex addresses (e.g.,
0x123...
) - ENS Domains - Ethereum Name Service domains (e.g.,
vitalik.eth
) - Converse Usernames - Social usernames from Converse (e.g.,
@fabri
)
Usage
The resolver provides a getUserInfo
function that returns detailed information about a user:
const userInfo = await getUserInfo(identifier);
The resolver returns a UserInfo
object containing:
ensDomain
- User's ENS domain if availableaddress
- Ethereum addresspreferredName
- Best available name to displayconverseUsername
- Converse username if availableavatar
- Profile picture URL if availableconverseEndpoint
- Converse profile endpoint
Caching
The resolver implements automatic caching to improve performance and reduce API calls. You can manage the cache using:
// Clear cache for specific address
clearInfoCache(address);
// Clear entire cache
clearInfoCache();
XMTP availability check
You can check if a user has XMTP enabled:
const { v2, v3 } = await isOnXMTP(v3client, v2client, address);
This will return an object with v2
and v3
booleans indicating if the user has XMTP enabled
v2:true
If the user has XMTP v2 enabledv3:true
If the user has XMTP v3 enabled