![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@edgeandnode/ens
Advanced tools
Resolver for ENS names and avatars using the Graph Network Subgraph and ensdomains resolution
Resolver for ENS names and avatars using the Graph Network Subgraph and ensdomains resolution.
This lets us resolve the ENS name for a given address/addresses in a consistent way across all apps, following this business logic:
GNS
contract. Query the L1 Network Subgraph for the GraphAccount.defaultDisplayName
to resolve.EnsPublicClient
exposed by the @ensdomains/ensjs
library to resolve the primary ENS for the given address. Also exposes batch functionality to resolve multiple ENS names if given multiple addresses.The issue with the ENS subgraph is it does not have a way to determine which domain is the primary domain for a user, resulting in it resolving to any domain the user owns, causing issues (primarily in explorer).
buildEnsResolver(): EnsResolverConfig
-> has two methods:
BuildEnsResolverArgs
infuraKey
: [REQUIRED] infura key used to lookup the ENS from the EnsPublicClient
gatewayApiKey
: [OPTIONAL] used to lookup the set default name from the L1 Network SubgraphresolveEnsName
-> resolves the ENS name (using the logic above) for a single address
ResolveEnsNameArgs
address
: [REQUIRED] 0x EVM wallet address to lookup the ENS name forgatewayApiKey
: [OPTIONAL] used to lookup the set default name from the L1 Network Subgraphtestnet
: [OPTIONAL, default = false] if true, look up is performed on the L1 testnettimeout
: [OPTIONAL, default = 5000] time, in milliseconds, before the client lookup failsresolveEnsNamesBatch
-> resolves the ENS names (using the logic above) for an array of addresses
ResolveEnsNamesBulkArgs
addresses
: [REQUIRED] array of 0x EVM wallet addresses to lookup the ENS names forgatewayApiKey
: [OPTIONAL] used to lookup the set default name from the L1 network Subgraphtestnet
: [OPTIONAL, default = false] if true, look up is performed on the L1 testnetresolveAvatar
-> resolves the Avatar for a single address from the network subgraph and then ENS
ResolveAvatarArgs
address
: [REQUIRED] 0x EVM wallet address to lookup the avatar forens
: [OPTIONAL] an already resolved ENS name. Finding the avatar from ENS is found through the ENS name, so passing this removes needing to resolve the ENS name using the user address
chain
: [OPTIONAL, default = 42161 (arbitrum-one)] the chain to lookup the GraphAccount.metadata.image
from the Network Subgraph ongatewayApiKey
: [OPTIONAL] used to lookup the GraphAccount.metadata.image
from the Network Subgraphtimeout
: [OPTIONAL, default = 5000] time, in milliseconds, before the client lookup failsresolveAvatarsBatch
-> resolves the avatars for an array of addresses
ResolveAvatarsBatchArgs
addresses
: [REQUIRED] array of 0x EVM wallet addresses to lookup the avatar forchain
: [OPTIONAL, default = 42161 (arbitrum-one)] the chain to lookup the GraphAccount.metadata.image
from the Network Subgraph ongatewayApiKey
: [OPTIONAL] used to lookup the GraphAccount.metadata.image
from the Network SubgraphEnsResolverConfig.resolveEnsName
import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
import type { Address } from 'viem'
const resolver = buildEnsResolver({
infuraKey: 'key',
gatewayApiKey: 'some32digitapikey',
})
async function lookupEnsName(address: Address) {
return await resolver.resolveEnsName({ address })
}
lookupEnsName('0x123').then((ens) => {
// testuser.eth
})
EnsResolverConfig.resolveEnsNamesBatch
import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
import type { Address } from 'viem'
const resolver = buildEnsResolver({
infuraKey: 'key',
gatewayApiKey: 'some32digitapikey',
})
async function lookupEnsNames(addresses: Address[]) {
return await resolver.resolveEnsNamesBatch({ addresses })
}
lookupEnsNames(['0x123', '0x456']).then((ensMap) => {
// { '0x123': 'testuser.eth', '0x456': null }
})
EnsResolverConfig.resolveAvatar
import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
import type { Address } from 'viem'
const resolver = buildEnsResolver({
infuraKey: 'key',
gatewayApiKey: 'some32digitapikey',
})
async function lookupAvatar(address: Address) {
return await resolver.resolveAvatar({
address,
timeout: 2500, // only wait 2.5sec before timing out
})
}
lookupAvatar('0x123').then((avatar) => {
// https://api.thegraph.com/ipfs/api/v0/cat?arg=QmdFKawEFPYzDVwZrXyJcyaYyCZd6PP9N5NCuTi2XmLJMD
})
async function lookupAvatarFromENS(address: Address, ens: string) {
return await resolver.resolveAvatar({
address,
ens,
timeout: 2500, // only wait 2.5sec before timing out
})
}
lookupAvatarFromENS('0x123').then((avatar) => {
// https://ipfs.io/ipfs/QmP9ayW28pbW2V9nYAjEbxv45MTezQpz8S913VbV56nkCg/1398.png
})
EnsResolverConfig.resolveAvatarsBatch
import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
import type { Address } from 'viem'
const resolver = buildEnsResolver({
infuraKey: 'key',
gatewayApiKey: 'some32digitapikey',
})
async function lookupAvatars(addresses: Address[]) {
return await resolver.resolveAvatarsBatch({
addresses,
})
}
lookupAvatars(['0x123', '0x456']).then((avatar) => {
// { '0x123': 'https://api.thegraph.com/ipfs/api/v0/cat?arg=QmdFKawEFPYzDVwZrXyJcyaYyCZd6PP9N5NCuTi2XmLJMD', '0x456': null }
})
FAQs
Resolver for ENS names and avatars using the Graph Network Subgraph and ensdomains resolution
We found that @edgeandnode/ens demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 19 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.