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

blockchain-api

v1.1.0

Published

API utilities for interacting with the Exatechl2 blockchain

Readme

Blockchain API

A TypeScript library for interacting with the Exatechl2 blockchain.

Installation

npm install blockchain-api

Modular Architecture

This library is built with a modular architecture, making it easy to maintain and extend:

blockchain-api/
├── src/
│   ├── index.ts                  # Main export file
│   ├── config.ts                 # Configuration management
│   ├── types/                    # Type definitions
│   │   ├── index.ts              # Export all types
│   │   ├── block.ts              # Block-related types
│   │   ├── transaction.ts        # Transaction-related types
│   │   ├── address.ts            # Address-related types
│   │   ├── token.ts              # Token-related types
│   │   ├── events.ts             # Event-related types
│   │   └── search.ts             # Search-related types
│   ├── core/                     # Core functionality
│   │   ├── index.ts              # Export core functions
│   │   └── rpc.ts                # Basic RPC functionality
│   ├── modules/                  # Feature modules
│   │   ├── index.ts              # Export all modules
│   │   ├── blocks/               # Block-related functionality
│   │   │   ├── index.ts          # Export block functions
│   │   │   └── blocks.ts         # Block operations
│   │   ├── transactions/         # Transaction-related functionality
│   │   │   ├── index.ts          # Export transaction functions
│   │   │   └── transactions.ts   # Transaction operations
│   │   ├── addresses/            # Address-related functionality
│   │   │   ├── index.ts          # Export address functions
│   │   │   └── addresses.ts      # Address operations
│   │   ├── tokens/               # Token-related functionality
│   │   │   ├── index.ts          # Export token functions
│   │   │   └── tokens.ts         # Token operations
│   │   ├── events/               # Event log functionality
│   │   │   ├── index.ts          # Export event functions
│   │   │   ├── events.ts         # Event log operations
│   │   │   └── README.md         # Event module documentation
│   │   └── search/               # Search functionality
│   │       ├── index.ts          # Export search functions
│   │       └── search.ts         # Search operations
│   └── utils/                    # Utility functions
│       ├── index.ts              # Export utility functions
│       └── formatters.ts         # Data formatting utilities
├── examples/                     # Example scripts
│   ├── basic-usage.ts            # Basic usage examples
│   ├── list-blocks.ts            # Block listing example
│   ├── list-transactions.ts      # Transaction listing example
│   ├── batch-info.ts             # Batch info example
│   ├── list-events.ts            # Event listing example
│   └── search-example.ts         # Search functionality example
├── dist/                         # Compiled JavaScript output
├── package.json                  # Project configuration
└── tsconfig.json                 # TypeScript configuration

Basic Usage

import { getBlockByNumber, getTransaction, search } from 'blockchain-api';

// Get block information
const block = await getBlockByNumber(12345);

// Get transaction details
const tx = await getTransaction('0x123...');

// Search for a block, transaction, address, or token
const searchResult = await search('0xabc...');
if (searchResult) {
  console.log(`Found ${searchResult.type}: ${searchResult.id}`);
}

Search Functionality

The library includes a simple but powerful search feature:

import { search } from 'blockchain-api';

// Search can find blocks, transactions, addresses, or tokens
const result = await search('0x123abc...');

// Result format: { type: 'block'|'transaction'|'address'|'token', id: string }
if (result) {
  switch(result.type) {
    case 'block':
      console.log(`Found block: ${result.id}`);
      break;
    case 'transaction':
      console.log(`Found transaction: ${result.id}`);
      break;
    case 'address':
      console.log(`Found address: ${result.id}`);
      break;
    case 'token':
      console.log(`Found token: ${result.id}`);
      break;
  }
} else {
  console.log('No results found');
}

The search function returns a simple object with type and id properties, making it easy to navigate to the appropriate detail page in your application.