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

@cryptforge/blockchain-evm

v0.2.1

Published

EVM-compatible blockchain adapter for CryptForge SDK (Ethereum, Sonic, Polygon, etc.)

Readme

@cryptforge/blockchain-evm

EVM-compatible blockchain adapter for the CryptForge SDK. This package provides key derivation and wallet operations for all EVM-compatible blockchains (Ethereum, Sonic, Polygon, BSC, Arbitrum, etc.) using the ethers.js library.

Installation

npm install @cryptforge/blockchain-evm
# or
pnpm add @cryptforge/blockchain-evm
# or
yarn add @cryptforge/blockchain-evm

Usage

Pre-configured Chains (Simple)

For common EVM chains, use the pre-configured adapters:

With Electron

import { setupCryptForgeHandlers } from '@cryptforge/transport-electron/main';
import { EthereumAdapter, SonicAdapter } from '@cryptforge/blockchain-evm';

setupCryptForgeHandlers({
  blockchainAdapters: {
    Ethereum: EthereumAdapter,
    Sonic: SonicAdapter,
  },
});

Network Management

Pre-configured adapters include both mainnet and testnet configurations:

import { SonicAdapter } from '@cryptforge/blockchain-evm';

// Get current network (defaults to mainnet)
const network = SonicAdapter.getNetwork();
console.log(network?.rpcUrl);    // "https://rpc.sonic.soniclabs.com"
console.log(network?.chainId);   // 146

// Switch to testnet
SonicAdapter.setNetwork('testnet');
const testnet = SonicAdapter.getNetwork();
console.log(testnet?.rpcUrl);    // "https://rpc.blaze.soniclabs.com"
console.log(testnet?.chainId);   // 57054

// Check available networks
const networks = SonicAdapter.getAvailableNetworks();
console.log(networks); // ['mainnet', 'testnet']

// Get current network key
console.log(SonicAdapter.getCurrentNetworkKey()); // 'testnet'

Custom EVM Chains (Advanced)

For custom or unlisted EVM chains, use the configurable EVMAdapter:

import { EVMAdapter } from '@cryptforge/blockchain-evm';

const PolygonAdapter = new EVMAdapter({
  chainData: {
    name: "Polygon",
    symbol: "MATIC",
    cmc_id: 3890
  },
  coinType: 60,
  standardDecimals: 18,
  networks: {
    mainnet: {
      name: "Polygon Mainnet",
      rpcUrl: "https://polygon-rpc.com",
      explorerUrl: "https://polygonscan.com",
      chainId: 137,
    },
    testnet: {
      name: "Polygon Amoy Testnet",
      rpcUrl: "https://rpc-amoy.polygon.technology",
      explorerUrl: "https://amoy.polygonscan.com",
      chainId: 80002,
    },
  },
  defaultNetwork: 'mainnet',
});

Custom RPC URLs

Override RPC URLs for Ethereum with your own provider:

import { EVMAdapter } from '@cryptforge/blockchain-evm';

const CustomEthereum = new EVMAdapter({
  chainData: {
    name: "Ethereum",
    symbol: "ETH",
    cmc_id: 1027
  },
  coinType: 60,
  standardDecimals: 18,
  networks: {
    mainnet: {
      name: "Ethereum Mainnet",
      rpcUrl: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
      explorerUrl: "https://etherscan.io",
      chainId: 1,
    },
    testnet: {
      name: "Ethereum Sepolia",
      rpcUrl: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
      explorerUrl: "https://sepolia.etherscan.io",
      chainId: 11155111,
    },
  },
});

Features

  • Universal EVM Support: Works with all EVM-compatible blockchains
  • Pre-configured Chains: Ready-to-use adapters for Ethereum and Sonic
  • Network Management: Built-in mainnet/testnet support with easy switching
  • Configurable: Easily create custom adapters for any EVM chain
  • Custom RPC URLs: Override default RPC providers with your own
  • BIP44 Standard: Uses standard derivation paths (default: m/44'/60'/0'/0/0)
  • ethers.js: Built on the battle-tested ethers.js v6 library
  • Type Safe: Full TypeScript support with type definitions
  • Checksummed Addresses: Returns EIP-55 checksummed addresses

API

Pre-configured Adapters

EthereumAdapter

Pre-configured adapter for Ethereum.

  • Chain: Ethereum
  • Symbol: ETH
  • Path: m/44'/60'/0'/0/0
  • Networks: Mainnet (Chain ID: 1), Sepolia Testnet (Chain ID: 11155111)
  • Note: Replace YOUR_INFURA_API_KEY in RPC URLs with your actual Infura API key

SonicAdapter

Pre-configured adapter for Sonic (EVM Layer 2).

  • Chain: Sonic
  • Symbol: S
  • Path: m/44'/60'/0'/0/0
  • Networks: Mainnet (Chain ID: 146), Testnet (Chain ID: 57054)

EVMAdapter (Configurable)

Create custom EVM chain adapters.

Constructor

new EVMAdapter(config: EVMAdapterConfig)

EVMAdapterConfig

interface NetworkConfig {
  name: string;           // Network name (e.g., "Ethereum Mainnet")
  rpcUrl: string;         // RPC endpoint URL
  explorerUrl?: string;   // Block explorer URL (optional)
  chainId: number;        // Chain ID for the network
}

interface EVMAdapterConfig {
  chainData: {
    name: string;         // Chain name (e.g., "Polygon")
    symbol: string;       // Token symbol (e.g., "MATIC")
    cmc_id: number;       // CoinMarketCap ID
  };
  coinType?: number;      // BIP44 coin type (default: 60)
  standardDecimals?: number;  // Token decimals (default: 18)
  networks?: {            // Network configurations
    mainnet?: NetworkConfig;
    testnet?: NetworkConfig;
    [key: string]: NetworkConfig | undefined;
  };
  defaultNetwork?: string;    // Default network key (default: 'mainnet')
  account?: number;           // BIP44 account (default: 0)
  change?: number;            // BIP44 change (default: 0)
  addressIndex?: number;      // BIP44 address index (default: 0)
}

Methods

Key Derivation
  • deriveKeys(mnemonic: string): Promise<KeyData>: Derives keys from a BIP39 mnemonic phrase
Network Management
  • getNetwork(): NetworkConfig | undefined: Get current network configuration
  • getCurrentNetworkKey(): string: Get current network key (e.g., 'mainnet', 'testnet')
  • setNetwork(networkKey: string): void: Switch to a different network
  • getAvailableNetworks(): string[]: Get list of configured network keys
  • hasNetwork(networkKey: string): boolean: Check if a network is configured
Properties
  • chainData: ChainData: Chain metadata (name, symbol, CMC ID)
  • standardDecimals: number: Standard decimals for the chain's native token

Supported Chains

Pre-configured

  • ✅ Ethereum
  • ✅ Sonic

Compatible (use EVMAdapter)

  • Polygon (MATIC)
  • Binance Smart Chain (BNB)
  • Arbitrum (ARB)
  • Optimism (OP)
  • Avalanche C-Chain (AVAX)
  • Fantom (FTM)
  • Any other EVM-compatible chain

Transaction Examples

Send Native Token (ETH/S)

import { createAuthClient } from '@cryptforge/auth';
import { EthereumAdapter } from '@cryptforge/blockchain-evm';

const auth = createAuthClient();
auth.registerAdapter('ethereum', EthereumAdapter);

// Unlock wallet
await auth.unlock({ password: 'password', chainId: 'ethereum' });

// Sign and send transaction
const { signedTransaction, signature } = await auth.signTransaction({
  transaction: {
    to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    value: ethers.parseEther('0.1'), // 0.1 ETH
    gasLimit: 21000,
  },
});

console.log('Signed Transaction:', signedTransaction);
console.log('Transaction Hash:', signature);

Sign Message

// Unlock wallet first
await auth.unlock({ password: 'password', chainId: 'ethereum' });

// Sign a message
const { signature, address, publicKey } = await auth.signMessage({
  message: 'Hello Ethereum!',
});

console.log('Signature:', signature);
console.log('Signed by:', address);

// Verify signature
const isValid = await auth.verifySignature(
  'Hello Ethereum!',
  signature,
  publicKey
);
console.log('Valid:', isValid);

Get Balance

const adapter = EthereumAdapter;

// Get native balance
const balance = await adapter.getNativeBalance(
  '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
);
console.log('ETH Balance:', ethers.formatEther(balance));

// Get all token balances
const tokens = await adapter.getTokenBalances(
  '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
);
tokens.forEach(token => {
  console.log(`${token.symbol}: ${token.balance}`);
});

Get Transactions

const adapter = EthereumAdapter;

// Get recent transactions
const transactions = await adapter.getTransactions(
  '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  { limit: 10 }
);

transactions.forEach(tx => {
  console.log('Hash:', tx.hash);
  console.log('From:', tx.from);
  console.log('To:', tx.to);
  console.log('Value:', ethers.formatEther(tx.value));
});

Generate Multiple Addresses

// Get addresses at different indices
const addresses = await auth.getAddresses('ethereum', 0, 5);

addresses.forEach(addr => {
  console.log(`Index ${addr.index}: ${addr.address}`);
  console.log(`Path: ${addr.path}`);
});

// Output:
// Index 0: 0xabc... Path: m/44'/60'/0'/0/0
// Index 1: 0xdef... Path: m/44'/60'/0'/0/1
// ...

Data Providers

The EVM adapter supports pluggable data providers for fetching blockchain data.

Using Alchemy Provider

import { EVMAdapter, AlchemyProvider } from '@cryptforge/blockchain-evm';

const adapter = new EVMAdapter({
  chainData: {
    name: 'Ethereum',
    symbol: 'ETH',
    cmc_id: 1027,
  },
  coinType: 60,
  networks: {
    mainnet: {
      name: 'Ethereum Mainnet',
      rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY',
      chainId: 1,
    },
  },
});

// Alchemy provider automatically detects Alchemy RPC URLs
// and provides enhanced data fetching capabilities

Using Etherscan Provider

import { EVMAdapter, EtherscanProvider } from '@cryptforge/blockchain-evm';

const adapter = new EVMAdapter({
  chainData: {
    name: 'Ethereum',
    symbol: 'ETH',
    cmc_id: 1027,
  },
  coinType: 60,
  networks: {
    mainnet: {
      name: 'Ethereum Mainnet',
      rpcUrl: 'https://mainnet.infura.io/v3/YOUR_KEY',
      explorerUrl: 'https://etherscan.io',
      chainId: 1,
    },
  },
});

// Configure Etherscan provider
const etherscanProvider = new EtherscanProvider({
  apiKey: 'YOUR_ETHERSCAN_API_KEY',
  network: 'mainnet',
});

Browser Compatibility

This package is 100% browser-compatible:

  • ✅ Chrome, Firefox, Safari, Edge
  • ✅ Node.js (v16+)
  • ✅ Electron (main and renderer)
  • ✅ React Native (with polyfills)
  • ✅ Web Workers

Uses ethers.js which is fully browser-safe.

Examples

See working examples in:

  • examples/vue-electron-example/ - Complete wallet application
  • examples/vue-web-example/ - Web-based wallet

Related Packages

License

ISC