@helio-nexus/svm-ens-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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-sdk

Basic 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);
  }
})();

Package Sidebar

Install

npm i @helio-nexus/svm-ens-sdk

Weekly Downloads

5

Version

0.1.1

License

MIT

Unpacked Size

124 kB

Total Files

10

Last publish

Collaborators

  • helio-nexus