Skip to content

Instantly share code, notes, and snippets.

@thatguyintech
Last active March 19, 2023 08:53
Show Gist options
  • Save thatguyintech/a85228c00b3f1648f0b884be00d21a5b to your computer and use it in GitHub Desktop.
Save thatguyintech/a85228c00b3f1648f0b884be00d21a5b to your computer and use it in GitHub Desktop.
Find ENS domains you own using alchem-sdk
// 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