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

minimal-xec-wallet

v2.0.2

Published

A minimalist eCash (XEC) wallet npm library, for use in web apps. Supports eTokens.

Downloads

92

Readme

minimal-xec-wallet

A minimalist eCash (XEC) wallet npm library for web applications with full SLP and ALP token support.

npm version Test Coverage License: MIT

🎯 Features

✅ Core Wallet Operations

  • HD Wallets: BIP44 hierarchical deterministic key generation
  • Import/Export: Support for mnemonic phrases, WIF, and hex private keys
  • Address Management: XEC address generation and validation
  • Balance Queries: Real-time XEC balance with confirmed/unconfirmed breakdown

✅ XEC Transactions

  • Send XEC: Single and multi-output transactions
  • Send All: Empty wallet functionality
  • Fee Optimization: Intelligent UTXO selection and fee calculation
  • UTXO Consolidation: Automatic optimization for better performance

✅ eToken Support (SLP + ALP)

  • Protocol Auto-Detection: Automatic SLP/ALP protocol identification
  • Token Operations: Send, burn, list tokens across both protocols
  • Token Metadata: Automatic fetching of token info (name, symbol, decimals)
  • Hybrid Management: Unified API for both SLP and ALP tokens

✅ Advanced Features

  • OP_RETURN: Embed data in blockchain transactions
  • Security: AES-256 mnemonic encryption, dust attack protection
  • Network Resilience: Multiple Chronik endpoint failover
  • Price Queries: Real-time XEC/USD pricing

🚀 Quick Start

Installation

npm install minimal-xec-wallet

Basic Usage

const MinimalXECWallet = require('minimal-xec-wallet')

// Create new wallet
const wallet = new MinimalXECWallet()
await wallet.initialize()

// Check balance
const balance = await wallet.getXecBalance()
console.log(`Balance: ${balance} XEC`)

// Send XEC
const txid = await wallet.sendXec([
  { address: 'ecash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy', amountSats: 10000 }
])

// List all tokens (SLP + ALP)
const tokens = await wallet.listETokens()
tokens.forEach(token => {
  console.log(`${token.ticker}: ${token.balance}`)
})

// Send tokens
await wallet.sendETokens('tokenId...', [
  { address: 'ecash:qp123...', amount: 100 }
])

Browser Usage

<script src="https://unpkg.com/minimal-xec-wallet/dist/minimal-xec-wallet.min.js"></script>
<script>
  const wallet = new MinimalXecWallet()

  // Initialize with automatic browser compatibility
  wallet.initialize().then(() => {
    console.log('Wallet ready for all browsers!')
    // Use same API as Node.js
  })
</script>

Browser Compatibility: Automatic WebAssembly loading with JavaScript fallbacks for older browsers. See Browser Compatibility Guide for details.

📚 Documentation

API Reference

Quick Links

🧪 Testing

Run Tests

# All tests (424 unit + 29 integration)
npm run test:all

# Unit tests only (fast)
npm run test:unit

# Integration tests (requires network)
npm run test:integration

# Test coverage report
npm run test:coverage

# Browser compatibility test
node examples/advanced/browser-compatibility-test.js

Example Testing

# Run all examples with guided testing
node examples/test-examples.js

# Test specific functionality
node examples/tokens/list-all-tokens.js
node examples/transactions/send-xec.js

# Test browser compatibility
node examples/advanced/browser-compatibility-test.js

🏗️ Architecture

Modern Design

  • Modular Architecture: Clean separation of concerns
  • Protocol Agnostic: Supports both SLP and ALP token standards
  • Network Resilient: Multiple Chronik endpoint failover
  • Security First: Built-in protections against common attacks

Core Components

  • HybridTokenManager: Unified SLP/ALP token operations
  • RobustChronikRouter: Network failover and error handling
  • ConsolidateUtxos: UTXO optimization engine
  • KeyDerivation: HD wallet key management

Dependencies

  • chronik-client: eCash blockchain indexer
  • ecash-lib: Core eCash transaction building
  • @scure/bip39: Secure mnemonic generation
  • crypto-js: AES encryption for mnemonics

🔧 Advanced Configuration

Custom Options

const wallet = new MinimalXECWallet(mnemonic, {
  hdPath: "m/44'/899'/0'/0/0",        // Custom derivation path
  fee: 2.0,                          // Fee rate in sats/byte
  chronikUrls: ['https://chronik.e.cash'], // Custom endpoints
  enableDonations: false,            // Privacy mode
  password: 'secure123'              // Mnemonic encryption
})

Environment Variables

# Test mode
NODE_ENV=test npm test

# Development mode
NODE_ENV=development npm start

🤝 Contributing

Development Setup

git clone https://github.com/zh/minimal-xec-wallet
cd minimal-xec-wallet
npm install
npm run test:unit

Code Quality

# Linting
npm run lint

# Build for browser
npm run build

# Generate API docs
npm run docs

📊 Project Stats

  • 424 Unit Tests - Comprehensive coverage of all features
  • 29 Integration Tests - Real network validation
  • 25+ Examples - Working code for all use cases
  • 6 Token Protocols - SLP Type 1, ALP Standard, auto-detection
  • 7 Chronik Endpoints - Robust network failover

🔗 Resources

eCash Ecosystem

Development

📄 License

MIT License - see LICENSE file for details.

🤔 Support

  • Issues: GitHub Issues
  • Examples: See ./examples directory for working code
  • API Docs: Run npm run docs for detailed API documentation
  • Community: eCash developer channels

Security Notice: This library handles real cryptocurrency. Always test with small amounts first and keep your mnemonic phrases secure.