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

@mnee/ts-sdk

v1.0.3

Published

Official typescript SDK of MNEE USD stablecoin

Readme

MNEE TypeScript SDK

The MNEE TypeScript SDK provides a comprehensive and efficient way to interact with the MNEE USD token. It offers a full suite of features including balance checking, UTXO management, transaction validation and parsing, token transfers (including multi-source), HD wallet support, and high-performance batch operations for processing large numbers of addresses.

Build & Test License: MIT npm version

Documentation

📚 Full documentation is available at https://docs.mnee.io

For detailed API references and advanced usage, see the docs directory:

Installation

npm install @mnee/ts-sdk

Quick Start

Basic Setup

import Mnee from '@mnee/ts-sdk';

// Initialize the SDK
const mnee = new Mnee({
  environment: 'production', // or 'sandbox'
  apiKey: 'your-api-key', // optional but recommended
});

Check Balance

// Single address
const balance = await mnee.balance('1YourAddressHere...');
console.log(`Balance: ${balance.decimalAmount} MNEE`);

// Multiple addresses
const balances = await mnee.balances(['address1', 'address2']);

Transfer MNEE

const recipients = [
  { address: '1RecipientAddress...', amount: 10.5 },
  { address: '1AnotherAddress...', amount: 5.25 },
];

const response = await mnee.transfer(recipients, 'your-private-key-wif');
console.log('Ticket ID:', response.ticketId);

// Get transaction ID after broadcast
const status = await mnee.getTxStatus(response.ticketId);
console.log('Transaction ID:', status.tx_id);

HD Wallet

import { HDWallet } from '@mnee/ts-sdk';

// Generate a new wallet
const mnemonic = HDWallet.generateMnemonic();
const hdWallet = mnee.HDWallet(mnemonic, {
  derivationPath: "m/44'/236'/0'",
});

// Derive addresses
const address = hdWallet.deriveAddress(0, false);
console.log('Address:', address.address);
console.log('Private Key:', address.privateKey);

Batch Operations

Process hundreds or thousands of addresses efficiently:

const batch = mnee.batch();

// Get balances for many addresses with progress tracking
const result = await batch.getBalances(addresses, {
  chunkSize: 50,
  continueOnError: true,
  onProgress: (completed, total, errors) => {
    console.log(`Progress: ${completed}/${total} chunks, Errors: ${errors}`);
  },
});

console.log(`Successfully processed ${result.results.length} addresses`);
console.log(`Errors: ${result.errors.length}`);

Key Features

🔐 HD Wallet Support

Full BIP32/BIP44 hierarchical deterministic wallet implementation for managing multiple addresses from a single seed.

Batch Processing

High-performance batch operations with automatic chunking, rate limiting, and error recovery.

💸 Flexible Transfers

  • Simple transfers with automatic UTXO selection
  • Multi-source transfers for complex scenarios
  • Support for multiple change addresses

🔍 Transaction Analysis

  • Parse transactions by ID or raw hex
  • Validate transactions before broadcasting
  • Extract inscription and cosigner data

📊 Comprehensive Data Access

  • Real-time balance queries
  • UTXO management
  • Transaction history with pagination
  • BSV21 token data support

Common Use Cases

Portfolio Management

// Check total balance across multiple addresses
const addresses = ['address1', 'address2', 'address3'];
const balances = await mnee.balances(addresses);

const total = balances.reduce((sum, bal) => sum + bal.decimalAmount, 0);
console.log(`Total portfolio: ${total} MNEE`);

Automated Payments

// Send payments to multiple recipients
const payments = [
  { address: '1Employee1Address...', amount: 1000 },
  { address: '1Employee2Address...', amount: 1500 },
  { address: '1ContractorAddress...', amount: 750 },
];

try {
  const result = await mnee.transfer(payments, payerWif);
  console.log('Payments sent, ticket:', result.ticketId);

  // Wait for confirmation
  const status = await mnee.getTxStatus(result.ticketId);
  console.log('Transaction confirmed:', status.tx_id);
} catch (error) {
  console.error('Payment failed:', error.message);
}

UTXO Consolidation

// Consolidate UTXOs from multiple addresses
// Note: getUtxos defaults to 10, specify larger size or use pagination
const utxos = await mnee.getUtxos(['1Address1...', '1Address2...'], 0, 1000);
const inputs = utxos.map((utxo) => ({
  txid: utxo.outpoint.split(':')[0],
  vout: parseInt(utxo.outpoint.split(':')[1]),
  wif: getWifForAddress(utxo.owners[0]),
}));

const totalAmount = utxos.reduce((sum, utxo) => sum + mnee.fromAtomicAmount(utxo.data.bsv21.amt), 0);

const result = await mnee.transferMulti({
  inputs,
  recipients: [
    {
      address: '1ConsolidationAddress...',
      amount: totalAmount - 0.01, // Leave room for fees
    },
  ],
});

// Get transaction ID after broadcast
const status = await mnee.getTxStatus(result.ticketId);
console.log('Consolidation transaction:', status.tx_id);

Error Handling

The SDK provides detailed error messages for common scenarios:

try {
  const result = await mnee.transfer(recipients, wif);
} catch (error) {
  switch (true) {
    case error.message.includes('Insufficient MNEE balance'):
      console.error('Not enough tokens');
      break;
    case error.menssage.includes('Invalid API key'):
      console.error('Authentication failed');
      break;
    case error.message.includes('Failed to broadcast transaction'):
      console.error('Transaction rejected by network');
      break;
    default:
      console.error('Transfer failed:', error.message);
  }
}

Unit Conversion

MNEE uses atomic units internally (1 MNEE = 100,000 atomic units):

// Convert to atomic units for precise calculations
const atomic = mnee.toAtomicAmount(1.5); // Returns: 150000

// Convert from atomic to MNEE for display
const mneeAmount = mnee.fromAtomicAmount(150000); // Returns: 1.5

Advanced Features

For advanced usage including:

  • Transaction validation with custom rules
  • Multi-signature support
  • Custom change address strategies
  • Inscription parsing
  • Gap limit scanning for HD wallets
  • And more...

Please refer to the full documentation or the docs directory.

Support

Contributing

Contributions are welcome! Please submit a pull request or open an issue on the repository to suggest improvements or report bugs.

Local QA-test

npm test

License

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