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

@znd/sdk

v0.1.1

Published

Official TypeScript/JavaScript SDK for Z-Node RPC endpoints

Readme

@znd/sdk

Official TypeScript/JavaScript SDK for Z-Node RPC endpoints.

Installation

npm install @znd/sdk
# or
pnpm add @znd/sdk
# or
yarn add @znd/sdk

Quick Start

import { ZNodeClient } from "@znd/sdk";

const client = new ZNodeClient({
  apiKey: "your-api-key",
});

// Get the latest block number
const blockNumber = await client.getBlockNumber();
console.log("Block number:", blockNumber);

// Get account balance
const balance = await client.getBalance("0x...");
console.log("Balance:", balance);

Configuration

const client = new ZNodeClient({
  // Required: Your Z-Node API key
  apiKey: "your-api-key",

  // Optional: Region for the endpoint
  region: "us-east",

  // Optional: Base domain (defaults to znode.dev)
  baseDomain: "znode.dev",

  // Optional: Request timeout in milliseconds (default: 30000)
  timeout: 30000,

  // Optional: Custom headers
  headers: {
    "X-Custom-Header": "value",
  },
});

Available Regions

| Region ID | Location | |-------------------|-----------------------| | us-east | US East (Virginia) | | us-west | US West (California) | | eu-west | Europe (Frankfurt) | | asia-southeast | Asia Pacific (Singapore) | | sa-east | South America (São Paulo) | | me-south | Middle East (Dubai) | | af-south | Africa (Cape Town) |

Endpoint URL Format

The SDK constructs endpoint URLs as https://{region}-rpc.znode.dev/v1/{apiKey}

Default region is eu-west if not specified.

Ethereum JSON-RPC Methods

Block Methods

// Get latest block number
const blockNumber = await client.getBlockNumber();

// Get block by number
const block = await client.getBlockByNumber("latest");
const blockWithTxs = await client.getBlockByNumber("latest", true);

// Get block by hash
const block = await client.getBlockByHash("0x...");

// Get all receipts for a block
const receipts = await client.getBlockReceipts("latest");

// Get transaction count in a block
const txCount = await client.getBlockTransactionCountByNumber("latest");
const txCountByHash = await client.getBlockTransactionCountByHash("0x...");

Account Methods

// Get balance
const balance = await client.getBalance("0x...");
const balanceAtBlock = await client.getBalance("0x...", "0x1000");

// Get transaction count (nonce)
const nonce = await client.getTransactionCount("0x...");

// Get code at address
const code = await client.getCode("0x...");

// Get storage at position
const storage = await client.getStorageAt("0x...", "0x0");

Transaction Methods

// Get transaction by hash
const tx = await client.getTransactionByHash("0x...");

// Get transaction by block hash and index
const tx = await client.getTransactionByBlockHashAndIndex("0x...", 0);

// Get transaction by block number and index
const tx = await client.getTransactionByBlockNumberAndIndex("latest", 0);

// Get transaction receipt
const receipt = await client.getTransactionReceipt("0x...");

// Send raw transaction
const txHash = await client.sendRawTransaction("0x...");

// Estimate gas
const gas = await client.estimateGas({
  from: "0x...",
  to: "0x...",
  data: "0x...",
});

Call Methods

// Execute a call
const result = await client.call({
  to: "0x...",
  data: "0x...",
});

Log Methods

// Get logs
const logs = await client.getLogs({
  fromBlock: "0x1000",
  toBlock: "latest",
  address: "0x...",
  topics: ["0x..."],
});

Fee Methods

// Get gas price
const gasPrice = await client.getGasPrice();

// Get max priority fee per gas (EIP-1559)
const maxPriorityFee = await client.getMaxPriorityFeePerGas();

// Get blob base fee (EIP-4844)
const blobBaseFee = await client.getBlobBaseFee();

// Get fee history
const feeHistory = await client.getFeeHistory(10, "latest", [25, 50, 75]);

Chain Methods

// Get chain ID
const chainId = await client.getChainId();

// Get network version
const netVersion = await client.getNetVersion();

// Get client version
const clientVersion = await client.getClientVersion();

// Get protocol version
const protocolVersion = await client.getProtocolVersion();

// Check sync status
const syncing = await client.getSyncing();
if (syncing !== false) {
  console.log("Syncing:", syncing.currentBlock, "/", syncing.highestBlock);
}

// Get accounts (returns empty array for RPC nodes)
const accounts = await client.getAccounts();

State Proofs

// Get Merkle proof for an account and storage keys (EIP-1186)
const proof = await client.getProof("0x...", ["0x0", "0x1"], "latest");
console.log("Balance:", proof.balance);
console.log("Storage proofs:", proof.storageProof);

Access Lists

// Create an access list for a transaction (EIP-2930)
const accessList = await client.createAccessList({
  from: "0x...",
  to: "0x...",
  data: "0x...",
});
console.log("Access list:", accessList.accessList);
console.log("Gas used:", accessList.gasUsed);

Tron API Methods

// Get current block
const block = await client.tron_getNowBlock();

// Get block by number
const block = await client.tron_getBlockByNum(1000000);

// Get node info
const nodeInfo = await client.tron_getNodeInfo();

// Get account
const account = await client.tron_getAccount("TAddress...");

// Get account balance
const balance = await client.tron_getAccountBalance("TAddress...");

// Broadcast transaction
const result = await client.tron_broadcastTransaction(signedTx);

Batch Requests

// Execute multiple calls in a single request
const [blockNumber, chainId, gasPrice] = await client.batch<[string, string, string]>([
  { method: "eth_blockNumber" },
  { method: "eth_chainId" },
  { method: "eth_gasPrice" },
]);

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

import type {
  Block,
  Transaction,
  TransactionReceipt,
  Log,
  FeeHistory,
  SyncStatus,
  AccessListItem,
  AccessListResult,
  AccountProof,
  StorageProof,
  TronBlock,
  TronAccount,
} from "@znd/sdk";

Error Handling

try {
  const balance = await client.getBalance("0x...");
} catch (error) {
  if (error instanceof Error) {
    console.error("Error:", error.message);
  }
}

License

MIT