
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
@ensdomains/avatar-resolver
Advanced tools
Avatar resolution library for both nodejs and browser.
Avatar resolution library for both nodejs and browser.
And good to go!
# npm
npm i @ensdomains/avatar-resolver
# yarn
yarn add @ensdomains/avatar-resolver
import { StaticJsonRpcProvider } from '@ethersproject/providers';
import { AvatarResolver, utils: avtUtils } from '@ensdomains/avatar-resolver';
// const { JSDOM } = require('jsdom'); on nodejs
// const jsdom = new JSDOM().window; on nodejs
const provider = new StaticJsonRpcProvider(
...
);
...
async function getAvatar() {
const avt = new AvatarResolver(provider);
const avatarURI = await avt.getAvatar({ ens: 'tanrikulu.eth' /*, jsdomWindow: jsdom (on nodejs) */ });
// avatarURI = https://ipfs.io/ipfs/QmUShgfoZQSHK3TQyuTfUpsc8UfeNfD8KwPUvDBUdZ4nmR
}
async function getAvatarMetadata() {
const avt = new AvatarResolver(provider);
const avatarMetadata = await avt.getMetadata({ ens: 'tanrikulu.eth' });
// avatarMetadata = { image: ... , uri: ... , name: ... , description: ... }
const avatarURI = avtUtils.getImageURI({ metadata /*, jsdomWindow: jsdom (on nodejs) */ });
// avatarURI = https://ipfs.io/ipfs/QmUShgfoZQSHK3TQyuTfUpsc8UfeNfD8KwPUvDBUdZ4nmR
}
const avt = new AvatarResolver(provider, { ttl: 300 }); // 5 min response cache in memory
const avt = new AvatarResolver(provider, { ipfs: 'https://dweb.link' });
Create .env file with INFURA_KEY env variable
Build the library
Node example
node example/node.js ENS_NAME
yarn build:demo
http-server example
FAQs
Avatar resolution library for both nodejs and browser.
The npm package @ensdomains/avatar-resolver receives a total of 0 weekly downloads. As such, @ensdomains/avatar-resolver popularity was classified as not popular.
We found that @ensdomains/avatar-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.