Offchain ENS Names (Fnames)
If the user has an offchain ENS name like@alice, you’ll need to call the Fname Registry.
to field indicates the current FID that owns the name.
Onchain ENS Names
If the user has an onchain ENS name like@alice.eth, the easiest way to do it is with the Postgres replicator. It indexes onchain and offchain data and lets you easily find what you’re looking for.
Once you have it set up, query the fnames table in the replicator database for the account’s FID:

