Last active
March 19, 2023 08:53
-
-
Save thatguyintech/a85228c00b3f1648f0b884be00d21a5b to your computer and use it in GitHub Desktop.
Find ENS domains you own using alchem-sdk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install --save-dev alchemy-sdk | |
// https://www.alchemy.com/sdk | |
import { Alchemy } from 'alchemy-sdk'; | |
// Set up the Alchemy RPC provider β | |
const config = { | |
apiKey: "demo", // get your own API key π€ -> https://alchemy.com/?a=b6ad695ab6 | |
network: "eth-mainnet", | |
} | |
const alchemy = new Alchemy(config); | |
// thatguyintech.eth π | |
const walletAddress = "0xF5FFF32CF83A1A614e15F25Ce55B0c0A6b5F8F2c"; | |
const ensContractAddress = "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"; | |
// Query Alchemy NFT API β | |
const resp = await alchemy.nft.getNftsForOwner(walletAddress, {contractAddresses: [ensContractAddress]}); | |
// Print the ENS domains I own π° | |
resp.ownedNfts.map(ens => console.log(ens.title)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment