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

stxn-sdk

v0.1.10

Published

A TypeScript/JavaScript SDK for Smart Transaction Development on Lestnet. Build hybrid dApps with STXN protocol, enabling advanced transaction flows and programmable transaction management.

Readme

stxn-sdk

A TypeScript/JavaScript SDK for Smart Transaction Development on Lestnet. Build hybrid dApps with STXN protocol, enabling advanced transaction flows and programmable transaction management.

npm version License: ISC

Features

  • 🚀 Easy-to-use API for Lestnet blockchain interactions
  • 💼 Comprehensive wallet management
  • 💸 Transaction handling and utilities
  • 🔄 Built-in retry mechanisms for network operations
  • 📊 Unit conversion helpers
  • 🔧 TypeScript support with full type definitions

Installation

npm install stxn-sdk

Quick Start

import { lestnet, createRandom, sendTx, lethToWei } from 'stxn-sdk';

// Initialize provider
const provider = lestnet();

// Create a new wallet
const wallet = createRandom();
console.log('New wallet:', wallet.address);

// Send transaction
const tx = await sendTx({
  to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  value: lethToWei('1.5'),
  privateKey: wallet.privateKey
});
console.log('Transaction hash:', tx.hash);

API Reference

Provider

import { lestnet } from 'stxn-sdk';

// Initialize provider
const provider = lestnet();

// Get network information
const network = await provider.getNetwork();
console.log('Chain ID:', network.chainId);

// Get account balance
const balance = await provider.getBalance('0x...');

Wallet Operations

import { createRandom } from 'stxn-sdk';

// Create new wallet
const wallet = createRandom();
console.log({
  address: wallet.address,
  privateKey: wallet.privateKey,
  mnemonic: wallet.mnemonic.phrase
});

Transaction Management

import { sendTx, lethToWei } from 'stxn-sdk';

// Send LETH
const tx = await sendTx({
  to: '0x...',
  value: lethToWei('1.5'),
  privateKey: '0x...'
});

// Wait for confirmation
const receipt = await tx.wait();

Unit Conversions

import { lethToWei, weiToLeth, formatLeth } from 'stxn-sdk';

// Convert LETH to Wei
const wei = lethToWei('1.5');

// Convert Wei to LETH
const leth = weiToLeth('1500000000000000000');

// Format LETH amount with units
const formatted = formatLeth('1500000000000000000');
// Output: "1.5 LETH"

Error Handling

The SDK includes built-in error handling and retry mechanisms for network operations:

import { sendTx } from 'stxn-sdk';

try {
  const tx = await sendTx({
    to: '0x...',
    value: lethToWei('1.5'),
    privateKey: '0x...'
  });
} catch (error) {
  if (error.code === 'INSUFFICIENT_FUNDS') {
    console.error('Not enough LETH to send transaction');
  } else if (error.code === 'NETWORK_ERROR') {
    console.error('Network connection issue');
  } else {
    console.error('Unknown error:', error);
  }
}

CLI Tool

For command-line interactions with Lestnet, check out our dedicated CLI tool: stxn-cli.

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

# Run linter
npm run lint

Requirements

  • Node.js >= 16.0.0
  • npm >= 7.0.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  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 ISC License - see the LICENSE file for details.

Related Projects

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.