I am using Moralis for my DApp, after I login with Meatmask. I wonder how to get my registered ENS domain address. From the logged user
object, I can not find any useful info.
const serverUrl = "https://xxxxx/server";
const appId = "YOUR_APP_ID";
Moralis.start({ serverUrl, appId });
// add from here down
async function login() {
let user = Moralis.User.current();
if (!user) {
user = await Moralis.authenticate();
}
console.log("logged in user:", user);
const userEthNFTs = await Moralis.Web3API.account.getNFTs();
console.log("====== userEthNFTs: ", userEthNFTs);
}
I do see my ENS nft got printed out, but I do not see any βnameβ in it, it only shows:
amount: "1"βββ
block_number: "13809918"βββ
block_number_minted: "13809918"βββ
contract_type: "ERC721"βββ
frozen: 0βββ
is_valid: 0βββ
metadata: nullβββ
name: ""βββ
owner_of: "0xf...4"βββ
symbol: ""βββ
synced_at: nullβββ
syncing: 1βββ
token_address: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"βββ
token_id: "9215...."βββ
token_uri: null
I did a little more research on this, and found out ethers.js
has lookupAddress
function which can do it, but this reverse lookup feature is not supported in web3js
. However, Moralis only has web3js provider, is there any plans to add ethers provider?
Thanks