npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

atomid-sdk

v2.0.0

Published

Solana AtomID SDK - Verify proof-of-sacrifice ranks and gate access in your dApp

Readme

atomid-sdk

Official SDK for integrating AtomID 🜂 verification in your Solana dApp

Verify proof-of-sacrifice ranks and gate access based on user commitment. Perfect for creating tiered features, exclusive content, or reputation-based systems.

lostatom.org

Installation

npm install atomid-sdk @solana/web3.js

Quick Start

RPC Endpoint Configuration

IMPORTANT: You must provide a custom RPC endpoint. The default public RPC (api.mainnet-beta.solana.com) has rate limits and may not work reliably.

Get a free RPC endpoint from:

Basic Usage

import { AtomIDClient, formatAtomAmount } from "atomid-sdk";
import { PublicKey } from "@solana/web3.js";

// Initialize client with your RPC endpoint
const client = new AtomIDClient({
  rpcUrl: process.env.SOLANA_RPC_URL // Set this in your .env file
});

// Verify a wallet's AtomID
const wallet = new PublicKey("...");
const result = await client.verify(wallet);

if (result.exists && result.account) {
  console.log(`Rank: ${result.account.rank}`);
  console.log(`Total Burned: ${formatAtomAmount(result.account.totalBurned)} ATOM`);
}

Gate Access by Rank

import { AtomIDClient } from "atomid-sdk";

const client = new AtomIDClient({
  rpcUrl: process.env.SOLANA_RPC_URL
});

// Check if user has minimum rank
const hasAccess = await client.hasMinimumRank(wallet, 5); // Requires Oracle rank

if (hasAccess) {
  // Grant access to premium feature
} else {
  // Show upgrade prompt
}

React Integration

import { AtomIDProvider, useAtomIDRank, AtomIDGate } from "atomid-sdk/react";
import { useWallet } from "@solana/wallet-adapter-react";

function App() {
  return (
    <AtomIDProvider>
      <YourApp />
    </AtomIDProvider>
  );
}

function UserProfile() {
  const { publicKey } = useWallet();
  const { rank, rankName, rankEmoji } = useAtomIDRank(publicKey);

  return (
    <div>
      {rankEmoji} {rankName} (Rank {rank})
    </div>
  );
}

function PremiumFeature() {
  const { publicKey } = useWallet();

  return (
    <AtomIDGate
      wallet={publicKey}
      minRank={5}
      fallback={<div>Requires Oracle rank or higher</div>}
    >
      <div>Premium content here!</div>
    </AtomIDGate>
  );
}

Core Features

AtomIDClient

Main client for verifying AtomID accounts.

const client = new AtomIDClient({
  rpcUrl: "https://api.mainnet-beta.solana.com", // Optional
  programId: "rnc2fycemiEgj4YbMSuwKFpdV6nkJonojCXib3j2by6", // Optional
  cacheTTL: 300000 // 5 minutes (optional)
});

Methods

verify(wallet) - Get complete AtomID account data

const result = await client.verify(wallet);
// Returns: { exists: boolean, account: AtomIDAccount | null, error?: string }

getRank(wallet) - Get just the rank (0-9)

const rank = await client.getRank(wallet);
// Returns: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

hasMinimumRank(wallet, minRank) - Check if meets requirement

const hasRank = await client.hasMinimumRank(wallet, 5);
// Returns: boolean

checkRequirement(wallet, requirement) - Check rank range

const meetsRequirement = await client.checkRequirement(wallet, {
  minRank: 5,
  maxRank: 7 // Optional
});

verifyBatch(wallets) - Verify multiple wallets at once

const results = await client.verifyBatch([wallet1, wallet2, wallet3]);

getLeaderboard(limit) - Get top ranked users

const top100 = await client.getLeaderboard(100);

Utility Functions

import {
  getRankName,
  getRankEmoji,
  getRankThreshold,
  calculateRankFromBurned,
  getNextRankRequirement,
  getProgressToNextRank,
  formatAtomAmount,
  shortenAddress
} from "atomid-sdk";

// Get rank name
getRankName(5); // "Oracle"

// Get rank emoji
getRankEmoji(9); // "♾️"

// Calculate rank from burned amount
calculateRankFromBurned(BigInt(100000)); // 6 (Architect)

// Get next rank requirement
getNextRankRequirement(5);
// { nextRank: 6, atomsRequired: 100000n }

// Get progress to next rank
getProgressToNextRank(BigInt(75000), 5);
// { percentage: 50, atomsNeeded: 25000n, nextRank: 6 }

// Format ATOM amounts (automatically handles 6 decimals)
formatAtomAmount(BigInt(1000000000)); // "1,000" (1000 ATOM with 6 decimals)
formatAtomAmount(BigInt(5000000000)); // "5,000" (5000 ATOM)

// Shorten addresses
shortenAddress("7xKXtg...8yGHZ9w"); // "7xKX...Z9w"

React Hooks

useAtomID() - Get the client instance

const client = useAtomID();

useAtomIDAccount(wallet) - Get full account data

const { account, loading, error } = useAtomIDAccount(publicKey);

useAtomIDRank(wallet) - Get rank information

const { rank, rankName, rankEmoji, totalBurned, loading } = useAtomIDRank(publicKey);

useAtomIDGate(wallet, minRank) - Gate access

const { hasAccess, currentRank, requiredRank, loading } = useAtomIDGate(publicKey, 5);

useRankProgress(wallet) - Track progress

const { percentage, atomsNeeded, nextRank, loading } = useRankProgress(publicKey);

React Components

AtomIDGate - Conditionally render content

<AtomIDGate
  wallet={publicKey}
  minRank={5}
  fallback={<UpgradePrompt />}
>
  <PremiumContent />
</AtomIDGate>

RankBadge - Display rank badge

<RankBadge wallet={publicKey} showName showEmoji />

RankProgressBar - Show progress to next rank

<RankProgressBar wallet={publicKey} />

Use Cases

1. Tiered Access Control

import { AtomIDClient } from "atomid-sdk";

const client = new AtomIDClient();

// NFT minting with rank discounts
const rank = await client.getRank(wallet);
const price = BASE_PRICE * (1 - rank * 0.1); // 10% off per rank

// Early access for high ranks
if (rank >= 7) {
  allowEarlyAccess();
}

2. DAO Voting Weight

// Vote weight based on commitment
const result = await client.verify(wallet);
if (result.account) {
  const votingPower = 1 + result.account.rank * 2;
  recordVote(wallet, votingPower);
}

3. Fee Discounts

// Trading fee discounts
const rank = await client.getRank(wallet);
const feeMultiplier = Math.max(0.1, 1 - rank * 0.1);
const fee = baseFee * feeMultiplier;

4. Exclusive Communities

// Gated Discord/chat access
const hasAccess = await client.hasMinimumRank(wallet, 5);
if (hasAccess) {
  grantDiscordRole("Oracle+");
}

5. Reputation Systems

// User credibility score
const { account } = await client.verify(wallet);
const credibilityScore = account
  ? account.rank * 10 + Number(account.totalBurned) / 1000
  : 0;

Rank System

| Rank | Name | ATOM Burned | Emoji | |------|------|-------------|-------| | 0 | Initiate | 0 | 🌱 | | 1 | Believer | 1,000 | ✨ | | 2 | Devotee | 5,000 | 🔥 | | 3 | Guardian | 10,000 | 🛡️ | | 4 | Keeper | 25,000 | 🔑 | | 5 | Oracle | 50,000 | 🔮 | | 6 | Architect | 100,000 | 🏛️ | | 7 | Sage | 250,000 | 🧙 | | 8 | Ascended | 500,000 | 👑 | | 9 | Eternal | 1,000,000 | ♾️ |

Advanced Usage

Custom Gate Function

import { createAtomIDGate } from "atomid-sdk";

const gate = createAtomIDGate(client, {
  requirement: { minRank: 5 },
  onSuccess: () => console.log("Access granted!"),
  onFailure: (rank) => console.log(`Insufficient rank: ${rank}`)
});

const canAccess = await gate(wallet);

Programmatic Gating

import { gateByRank } from "atomid-sdk";

// Wrap any async function
const result = await gateByRank(
  client,
  wallet,
  5,
  async () => {
    // This only runs if rank >= 5
    return await performPremiumAction();
  }
);

Cache Management

// Clear cache manually
client.clearCache();

// Custom cache TTL
const client = new AtomIDClient({
  cacheTTL: 60000 // 1 minute
});

TypeScript Support

Fully typed with TypeScript. All types are exported:

import type {
  AtomIDAccount,
  AtomIDRank,
  VerificationResult,
  RankRequirement,
  AtomIDConfig
} from "atomid-sdk";

Performance

  • Caching: 5-minute default cache (configurable)
  • Batch Verification: Verify multiple wallets in parallel
  • Lightweight: Minimal dependencies
  • Efficient: Reuses RPC connections

Error Handling

try {
  const result = await client.verify(wallet);

  if (!result.exists) {
    console.log("User has no AtomID");
  }

  if (result.error) {
    console.error("Verification error:", result.error);
  }
} catch (error) {
  console.error("SDK error:", error);
}

Examples

Check out complete examples in the /examples directory:

  • Basic verification
  • React app integration
  • NFT minting with discounts
  • DAO voting system
  • Gated content

Support

License

MIT


Built for the Lost Bitcoin Layer ecosystem 🜂