Use the ANS SDK to integrate in your JS/TS projects.
Install
npm install @alph-name-service/ans-sdk
Usage
import { ANS } from"@alph-name-service/ans-sdk";constans=newANS("mainnet");constprofile=awaitans.getProfile("<address>");// returns {name: "...", imgUri: "..."}// if profile exists, undefined otherwiseconstrecord=awaitans.getRecord("<name>");// returns {owner: ..., manager: ..., ttl: ...}// if name exists, undefined otherwiseconstresolvedAddress=awaitans.resolveName("<name>");// returns the resolved address string// if name exists, undefined otherwise
If you want to integrate within a more involved use-case where you need to batch and get info for multiple addresses per request, feel free to reach out in Discord, Telegram or Twitter.