[SOLVED] Reverse Resolve ENS

I can’t figure out how to reverse resolve ENS addresses.

I know there’s an old rest api /resolve/{address}/reverse endpoint, but no documentation on how to properly use that. I keep getting errors on everything I’ve tried. Can I call that from the SDK?

And the SDK documentation only includes Unstoppable Domains and not ENS.

I’m trying to check for ENS when users sign up to set it as their display name
So probably looking to use it inside a cloud function.

ps: Moralis should do this automatically, save primary ENS record on User table. Bonus points for also getting user avatar from ENS and metadata is available. Seems like a basic thing every app needs.

Hey, there’s no corresponding function in the SDK to do so, if you would like to reverse resolve it use the REST API and input the address in the Request Body, plus API Key in the Request Header :raised_hands:

we found out meanwhile that this works:

options = {address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' };
resolve = await Moralis.Web3API.resolve.resolveAddress(options );
1 Like

I saw that function on the SDK, but when I try it I get an error.

code: 141
error: "Invalid function: \"resolveAddress\""

Do you have latest server version?

That’s it!! My server was on 0.0.267
Updated to 0.0.330 and it works now!

Thank you!

1 Like

it works for me when i use vitalik address but with my own address doesnt return null, returns bad request error when address doesnt have ens

POSThttps://*******.usemoralis.com:2053/server/functions/resolveAddress
[HTTP/2 400 Bad Request 1171ms]

Uncaught (in promise) Error: Web3 API error while calling /resolve/:address/reverse

although it works fine in API section dashboard with none ENS addresses and returns null object

What is the function that you used from the sdk?

1 Like
options = {address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' };
resolve = await Moralis.Web3API.resolve.resolveAddress(options );

this code

got it, we should return a better result for Moralis.Web3API.resolve.resolveAddress when the address doesn’t have an ENS domain

1 Like

ty i had to solve with try catch…another question is there a way to get ens avatar other than ethers.js lib?

I don’t know an easy way to do that now, ENS metadata is not fully synced now either for the NFTs

1 Like