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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ore-sdk-core

v1.0.0

Published

TypeScript SDK for interacting with ORE mining protocol on Solana

Downloads

13

Readme

ORE SDK

TypeScript SDK for interacting with the ORE mining protocol on Solana. Built for Next.js and modern web applications.

Installation

npm install ore-sdk-core
# or
yarn add ore-sdk-core
# or
pnpm add ore-sdk-core

Peer Dependencies

Make sure you have these installed:

npm install @solana/web3.js @solana/spl-token

Quick Start

import { Connection } from "@solana/web3.js";
import { OreSDK } from "ore-sdk-core";

// Initialize SDK
const connection = new Connection("https://api.mainnet-beta.solana.com");
const sdk = new OreSDK(connection);

// Get board state
const board = await sdk.getBoard();
console.log("Current round:", board?.roundId);

// Get miner state
const miner = await sdk.getMiner(authorityPublicKey);
console.log("Rewards SOL:", OreSDK.toSolString(miner?.rewardsSol || 0n));
console.log("Rewards ORE:", OreSDK.toOreString(miner?.rewardsOre || 0n));

Examples

Deploy SOL to Grid

import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
import { useWallet, useConnection } from "@solana/wallet-adapter-react";
import { OreSDK } from "ore-sdk-core";

function DeployButton() {
  const { connection } = useConnection();
  const { publicKey, sendTransaction } = useWallet();
  const sdk = new OreSDK(connection);

  const handleDeploy = async () => {
    if (!publicKey) return;

    // Deploy 0.1 SOL to squares 0, 5, 10, 15, 20 (diagonal)
    const squares = Array(25).fill(false);
    squares[0] = true;
    squares[5] = true;
    squares[10] = true;
    squares[15] = true;
    squares[20] = true;

    const transaction = await sdk.buildDeployTransaction(
      publicKey,
      publicKey,
      {
        amount: OreSDK.fromSolString("0.1"),
        squares,
      }
    );

    const signature = await sendTransaction(transaction, connection);
    await connection.confirmTransaction(signature);
  };

  return <button onClick={handleDeploy}>Deploy</button>;
}

Claim Rewards

async function claimRewards() {
  const sdk = new OreSDK(connection);
  
  // Claim SOL rewards
  const solTx = sdk.buildClaimSolTransaction(publicKey);
  await sendTransaction(solTx, connection);

  // Claim ORE rewards
  const oreTx = await sdk.buildClaimOreTransaction(publicKey);
  await sendTransaction(oreTx, connection);
}

Checkpoint

async function checkpoint() {
  const sdk = new OreSDK(connection);
  const miner = await sdk.getMiner(publicKey);
  
  if (miner) {
    const tx = sdk.buildCheckpointTransaction(
      publicKey,
      publicKey,
      miner.roundId
    );
    await sendTransaction(tx, connection);
  }
}

Staking

async function stake() {
  const sdk = new OreSDK(connection);
  
  // Deposit ORE
  const depositTx = await sdk.buildDepositTransaction(
    publicKey,
    publicKey,
    OreSDK.fromOreString("100") // 100 ORE
  );
  await sendTransaction(depositTx, connection);

  // Withdraw ORE
  const withdrawTx = await sdk.buildWithdrawTransaction(
    publicKey,
    OreSDK.fromOreString("50") // 50 ORE
  );
  await sendTransaction(withdrawTx, connection);

  // Claim yield
  const stake = await sdk.getStake(publicKey);
  if (stake && stake.rewards > 0) {
    const claimTx = await sdk.buildClaimYieldTransaction(
      publicKey,
      stake.rewards
    );
    await sendTransaction(claimTx, connection);
  }
}

API Reference

OreSDK Class

Constructor

new OreSDK(connection: Connection)

Methods

State Fetching
  • getBoard(): Promise<Board | null> - Get current board state
  • getRound(roundId: number | bigint): Promise<Round | null> - Get round state
  • getMiner(authority: PublicKey): Promise<Miner | null> - Get miner state
  • getStake(authority: PublicKey): Promise<Stake | null> - Get stake state
  • getTreasury(): Promise<Treasury | null> - Get treasury state
Transaction Building
  • buildDeployTransaction(signer, authority, options): Promise<Transaction>
  • buildClaimSolTransaction(signer): Transaction
  • buildClaimOreTransaction(signer): Promise<Transaction>
  • buildCheckpointTransaction(signer, authority, roundId): Transaction
  • buildDepositTransaction(signer, payer, amount): Promise<Transaction>
  • buildWithdrawTransaction(signer, amount): Promise<Transaction>
  • buildClaimYieldTransaction(signer, amount): Promise<Transaction>
Utility Methods
  • static toOreString(amount: bigint | number): string - Convert ORE grams to string
  • static fromOreString(amount: string): bigint - Convert string to ORE grams
  • static toSolString(lamports: bigint | number): string - Convert lamports to SOL string
  • static fromSolString(sol: string): bigint - Convert SOL string to lamports

Types

Board

interface Board {
  roundId: bigint;
  startSlot: bigint;
  endSlot: bigint;
}

Round

interface Round {
  id: bigint;
  deployed: bigint[]; // 25 squares
  slotHash: Uint8Array;
  count: bigint[]; // 25 squares
  expiresAt: bigint;
  motherlode: bigint;
  rentPayer: PublicKey;
  topMiner: PublicKey;
  topMinerReward: bigint;
  totalDeployed: bigint;
  totalVaulted: bigint;
  totalWinnings: bigint;
}

Miner

interface Miner {
  authority: PublicKey;
  deployed: bigint[]; // 25 squares
  cumulative: bigint[]; // 25 squares
  checkpointFee: bigint;
  checkpointId: bigint;
  lastClaimOreAt: bigint;
  lastClaimSolAt: bigint;
  rewardsFactor: bigint;
  rewardsSol: bigint;
  rewardsOre: bigint;
  refinedOre: bigint;
  roundId: bigint;
  lifetimeRewardsSol: bigint;
  lifetimeRewardsOre: bigint;
}

Stake

interface Stake {
  authority: PublicKey;
  balance: bigint;
  lastClaimAt: bigint;
  lastDepositAt: bigint;
  lastWithdrawAt: bigint;
  rewardsFactor: bigint;
  rewards: bigint;
  lifetimeRewards: bigint;
}

Constants

  • ORE_PROGRAM_ID - ORE program address
  • MINT_ADDRESS - ORE token mint address
  • TOKEN_DECIMALS - ORE token decimals (11)
  • ONE_ORE - One ORE in grams (10^11)
  • OreInstruction - Instruction discriminants enum

Next.js Integration

Setup Wallet Adapter

// app/providers.tsx
"use client";

import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
import { WalletModalProvider } from "@solana/wallet-adapter-react-ui";
import { PhantomWalletAdapter } from "@solana/wallet-adapter-wallets";
import { clusterApiUrl } from "@solana/web3.js";
import { useMemo } from "react";

export function Providers({ children }: { children: React.ReactNode }) {
  const network = WalletAdapterNetwork.Mainnet;
  const endpoint = useMemo(() => clusterApiUrl(network), [network]);
  const wallets = useMemo(() => [new PhantomWalletAdapter()], []);

  return (
    <ConnectionProvider endpoint={endpoint}>
      <WalletProvider wallets={wallets} autoConnect>
        <WalletModalProvider>{children}</WalletModalProvider>
      </WalletProvider>
    </ConnectionProvider>
  );
}

Use SDK in Components

// app/mine/page.tsx
"use client";

import { useConnection, useWallet } from "@solana/wallet-adapter-react";
import { OreSDK } from "ore-sdk-core";
import { useEffect, useState } from "react";

export default function MinePage() {
  const { connection } = useConnection();
  const { publicKey } = useWallet();
  const [miner, setMiner] = useState(null);

  useEffect(() => {
    if (!publicKey) return;

    const sdk = new OreSDK(connection);
    sdk.getMiner(publicKey).then(setMiner);
  }, [connection, publicKey]);

  if (!miner) return <div>Loading...</div>;

  return (
    <div>
      <h1>Miner Stats</h1>
      <p>SOL Rewards: {OreSDK.toSolString(miner.rewardsSol)}</p>
      <p>ORE Rewards: {OreSDK.toOreString(miner.rewardsOre)}</p>
    </div>
  );
}

License

MIT