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

devion-sdk

v1.0.0

Published

The complete blockchain infrastructure SDK for Web3 developers

Readme

@devion/sdk

The complete blockchain infrastructure SDK for Web3 developers. Build powerful decentralized applications with enterprise-grade blockchain infrastructure, intelligent caching, and seamless multi-chain support.

npm version License: MIT TypeScript

✨ Features

  • 🚀 High Performance - Sub-millisecond response times with Redis caching
  • 🔗 Multi-Chain Support - Ethereum, Base, Arbitrum, Polygon, BSC + testnets
  • 🛡️ Enterprise Security - Rate limiting, API key management, usage analytics
  • Developer Experience - TypeScript support, React hooks, framework integrations
  • 📊 Real-time Analytics - Usage tracking, performance metrics, cost optimization
  • 🔄 Auto-retry Logic - Intelligent retry with exponential backoff
  • 💰 Transparent Pricing - Usage-based billing with clear tier limits

🚀 Quick Start

Installation

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

Basic Usage

import { DevionSDK } from '@devion/sdk';

// Initialize SDK
const devion = new DevionSDK({
  apiKey: 'your-api-key', // Get from https://dashboard.devion.dev
  network: 'base-mainnet',
  caching: true
});

// Get account balance
const balance = await devion.getBalance('0x742d35Cc6635C0532925a3b8D007EbA3fFC2C5DD');
console.log(`Balance: ${balance} ETH`);

// Send a transaction
const txHash = await devion.sendTransaction('0xf86c808504a817c800825208...');
console.log(`Transaction sent: ${txHash}`);

// Get current block
const blockNumber = await devion.getBlockNumber();
console.log(`Current block: ${blockNumber}`);

React Integration

import { DevionProvider, useBalance, useBlockNumber } from '@devion/sdk';

// Wrap your app with DevionProvider
function App() {
  return (
    <DevionProvider config={{ apiKey: 'your-api-key', network: 'base-mainnet' }}>
      <WalletComponent />
    </DevionProvider>
  );
}

// Use hooks in components
function WalletComponent() {
  const { balance, loading } = useBalance('0x742d35Cc6635C0532925a3b8D007EbA3fFC2C5DD');
  const { blockNumber } = useBlockNumber();

  if (loading) return <div>Loading...</div>;

  return (
    <div>
      <p>Balance: {balance} ETH</p>
      <p>Current Block: {blockNumber}</p>
    </div>
  );
}

📖 Core Concepts

Networks

Devion SDK supports 8+ blockchain networks:

type SupportedNetwork = 
  | 'ethereum-mainnet' | 'ethereum-testnet'
  | 'base-mainnet' | 'base-sepolia'  
  | 'arbitrum-mainnet' | 'arbitrum-sepolia'
  | 'polygon-mainnet' | 'bsc-mainnet';

// Switch networks dynamically
devion.switchNetwork('arbitrum-mainnet');

// Or specify per request
const balance = await devion.getBalance(address, { 
  network: 'arbitrum-mainnet' 
});

API Versions

const devion = new DevionSDK({
  apiKey: 'your-api-key',
  apiVersion: 'v3', // v1, v2, or v3
  // v3 = Redis caching + advanced analytics (recommended)
  // v2 = Supabase integration + REST endpoints  
  // v1 = Basic JSON-RPC
});

Configuration

const devion = new DevionSDK({
  apiKey: 'your-api-key',          // Required: Your Devion API key
  network: 'base-mainnet',         // Default network
  apiVersion: 'v3',                // API version (v1, v2, v3)
  caching: true,                   // Enable response caching
  cacheTTL: 60000,                 // Cache TTL in milliseconds
  timeout: 30000,                  // Request timeout
  retries: 3,                      // Number of retries
  retryDelay: 1000,                // Delay between retries
  enableWebSockets: true,          // Enable real-time subscriptions
  autoSwitchNetwork: false,        // Auto-switch based on context
  debug: false                     // Enable debug logging
});

🔧 API Reference

Core Methods

RPC Operations

// Raw RPC call
const result = await devion.rpc('eth_blockNumber');

// Batch RPC calls
const results = await devion.batchRPC([
  { method: 'eth_blockNumber' },
  { method: 'eth_gasPrice' }
]);

Account Operations

// Get balance (formatted)
const balance = await devion.getBalance(address, { formatted: true });

// Get transaction count (nonce)  
const nonce = await devion.getTransactionCount(address);

// Get comprehensive account info
const account = await devion.getAccount(address, {
  includeTransactions: true
});

Transaction Operations

// Send signed transaction
const txHash = await devion.sendTransaction(signedTx, {
  waitForConfirmation: true,
  confirmations: 3
});

// Wait for transaction confirmation
const receipt = await devion.waitForTransaction(txHash);

// Estimate gas
const gasEstimate = await devion.estimateGas({
  to: '0x...',
  data: '0x...',
  value: '0x0'
});

Smart Contract Calls

// Read-only contract call
const result = await devion.call({
  to: contractAddress,
  data: encodedFunctionCall
});

Analytics & Usage

// Get usage statistics
const usage = await devion.getUsage();
console.log(`Used: ${usage.requestsThisMonth}/${usage.monthlyLimit}`);

// Get detailed analytics
const analytics = await devion.getAnalytics({
  period: '7d',
  breakdown: 'by-method'
});

// Get network information
const networks = await devion.getNetworks();
const currentNetwork = await devion.getCurrentNetworkInfo();

Real-time Subscriptions

// Subscribe to new blocks
const unsubscribe = devion.subscribe('newBlocks', (block) => {
  console.log('New block:', block.number);
});

// Subscribe to transaction logs
const unsubscribeLogs = devion.subscribe('logs', (log) => {
  console.log('New log:', log);
}, {
  filter: {
    address: contractAddress,
    topics: ['0x...']
  }
});

// Cleanup
unsubscribe();
unsubscribeLogs();

⚛️ React Hooks

useBalance

const { balance, loading, error, refetch } = useBalance(address, {
  network: 'base-mainnet',
  formatted: true,
  pollInterval: 30000 // Poll every 30 seconds
});

useContract

const { call, loading, error } = useContract(contractAddress, abi);

const handleCall = async () => {
  const result = await call('balanceOf', [address]);
  console.log('Token balance:', result);
};

useBlockNumber

const { blockNumber, loading, error } = useBlockNumber({
  network: 'arbitrum-mainnet',
  pollInterval: 12000 // Poll every block
});

useAccount

const { account, loading, error } = useAccount(address, {
  network: 'base-mainnet',
  includeTransactions: true
});

🧪 Testing

DevionTestSDK

import { DevionTestSDK } from '@devion/sdk/testing';

describe('My DApp', () => {
  let sdk: DevionTestSDK;

  beforeEach(() => {
    sdk = new DevionTestSDK({
      network: 'base-sepolia'
    });
  });

  it('should handle balance queries', async () => {
    // Mock responses
    sdk.mockBalance(address, '1000000000000000000'); // 1 ETH

    const balance = await sdk.getBalance(address);
    expect(balance).toBe('1000000000000000000');

    // Verify calls
    sdk.expectMethodCalled('eth_getBalance');
    sdk.expectMethodCalledWith('eth_getBalance', [address, 'latest']);
  });
});

🔗 Framework Integrations

Next.js API Routes

// pages/api/blockchain.ts
import { createDevionHandler } from '@devion/sdk/nextjs';

export default createDevionHandler({
  apiKey: process.env.DEVION_API_KEY!,
  corsOrigins: ['http://localhost:3000'],
  rateLimit: {
    windowMs: 60000,
    maxRequests: 100
  }
});

Express.js

import express from 'express';
import { DevionSDK } from '@devion/sdk';

const app = express();
const devion = new DevionSDK({ apiKey: process.env.DEVION_API_KEY! });

app.post('/api/balance', async (req, res) => {
  try {
    const { address } = req.body;
    const balance = await devion.getBalance(address, { formatted: true });
    res.json({ address, balance });
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

💰 Pricing & Limits

Free Tier

  • 100,000 requests/month
  • 100 requests/minute
  • Community support
  • All networks supported

Growth Tier - $29/month

  • 5,000,000 requests/month
  • 1,000 requests/minute
  • Priority support
  • Real-time subscriptions
  • Advanced analytics

Scale Tier - $199/month

  • 50,000,000 requests/month
  • 5,000 requests/minute
  • Dedicated support
  • Custom integrations
  • White-label options

View detailed pricing →

🛠️ Advanced Configuration

Custom Network Endpoints

const devion = new DevionSDK({
  apiKey: 'your-api-key',
  baseURL: 'https://your-custom-endpoint.com',
  networks: {
    'custom-network': {
      chainId: 12345,
      rpcUrl: 'https://custom-rpc.com',
      name: 'Custom Network'
    }
  }
});

Error Handling

import { DevionError, NetworkError, RateLimitError } from '@devion/sdk';

try {
  const balance = await devion.getBalance(address);
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after: ${error.retryAfter}s`);
  } else if (error instanceof NetworkError) {
    console.log(`Network error: ${error.message}`);
  } else if (error instanceof DevionError) {
    console.log(`SDK error: ${error.message}`);
  }
}

Caching Strategies

const devion = new DevionSDK({
  apiKey: 'your-api-key',
  caching: true,
  cacheTTL: 60000, // 1 minute default
  cacheStrategy: {
    // Custom TTL per method
    'eth_getBalance': 30000,    // 30 seconds
    'eth_blockNumber': 10000,   // 10 seconds  
    'eth_gasPrice': 15000,      // 15 seconds
  }
});

// Manual cache management
devion.clearCache(); // Clear all
devion.clearCache('eth_getBalance'); // Clear specific method

📚 Examples

DeFi Portfolio Tracker

import { DevionSDK } from '@devion/sdk';

class PortfolioTracker {
  private devion: DevionSDK;

  constructor(apiKey: string) {
    this.devion = new DevionSDK({
      apiKey,
      caching: true,
      enableWebSockets: true
    });
  }

  async getPortfolio(address: string) {
    const networks = ['ethereum-mainnet', 'base-mainnet', 'arbitrum-mainnet'];
    
    const balances = await Promise.all(
      networks.map(async (network) => {
        const balance = await this.devion.getBalance(address, { 
          network: network as any,
          formatted: true 
        });
        return { network, balance };
      })
    );

    return balances.filter(b => parseFloat(b.balance) > 0);
  }

  subscribeToUpdates(address: string, callback: (update: any) => void) {
    return this.devion.subscribe('newBlocks', async (block) => {
      const portfolio = await this.getPortfolio(address);
      callback({ block: block.number, portfolio });
    });
  }
}

Multi-Chain Bridge Monitor

class BridgeMonitor {
  private devion: DevionSDK;

  constructor(apiKey: string) {
    this.devion = new DevionSDK({ apiKey, enableWebSockets: true });
  }

  async monitorBridge(sourceNetwork: string, targetNetwork: string, contractAddress: string) {
    // Monitor events on source chain
    const sourceUnsub = this.devion.subscribe('logs', (log) => {
      console.log(`Bridge event on ${sourceNetwork}:`, log);
    }, {
      network: sourceNetwork as any,
      filter: { address: contractAddress }
    });

    // Monitor events on target chain  
    const targetUnsub = this.devion.subscribe('logs', (log) => {
      console.log(`Bridge event on ${targetNetwork}:`, log);
    }, {
      network: targetNetwork as any,
      filter: { address: contractAddress }
    });

    return () => {
      sourceUnsub();
      targetUnsub();
    };
  }
}

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links

🚀 Get Started

Ready to build the future of Web3? Get your API key and start building:

  1. Sign up for a free account
  2. Get your API key from the dashboard
  3. Install the SDK: npm install @devion/sdk
  4. Start building! 🚀

Built with ❤️ by the Devion Team