@helio-nexus/svm-ens-sdk
v0.1.1
Published
TypeScript SDK for Eclipse domains
Maintainers
Readme
SVM ENS SDK
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.
Installation
Install via npm or Yarn:
npm install @helio-nexus/svm-ens-sdk
# or
yarn add @helio-nexus/svm-ens-sdkBasic Usage
Import the SDK Methods
import { resolveByDomainName, getPrimaryDomain } from "@helio-nexus/svm-ens-sdk";Initialize a Solana Connection
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");Resolve a Domain
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);
}
})();Get the Primary Domain for an Owner
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);
}
})();