This repository contains the Solana Virtual Machine (SVM) ENS SDK (also referred to as svm-ens-sdk).
Use it to resolve domain ownership, fetch on-chain metadata, and manage primary domains on Solana without relying on a separate backend.
Install via npm or Yarn:
npm install @helio-nexus/svm-ens-sdk
# or
yarn add @helio-nexus/svm-ens-sdk
import { resolveByDomainName, getPrimaryDomain } from "@helio-nexus/svm-ens-sdk";
To interact with the Solana blockchain, provide a Connection object from @solana/web3.js:
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection("https://mainnetbeta-rpc.eclipse.xyz", "confirmed");
You can fetch the on-chain record for a domain name:
(async () => {
const { result: domainInfo, error } = await resolveByDomainName(connection, "example.eclipse");
if (error) {
console.error("Error resolving domain:", error);
} else {
console.log("Resolved Domain Info:", domainInfo);
}
})();
To find the domain flagged as "primary" for a given wallet address:
(async () => {
const ownerPubkey = "YourWalletPublicKeyHere";
const { result: primaryDomainInfo, error } = await getPrimaryDomain(connection, ownerPubkey);
if (error) {
console.error("Error fetching primary domain:", error);
} else {
console.log("Primary Domain Info:", primaryDomainInfo);
}
})();