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

flowledger-sdk

v1.0.2

Published

Official SDK for interacting with FlowLedger smart contracts on the Stacks blockchain.

Readme

@earnwithalee/flowledger-sdk

npm version npm downloads License: MIT

The official SDK for interacting with FlowLedger smart contracts on the Stacks blockchain (Bitcoin L2).

FlowLedger is a daily transaction tracker that allows users to log income and expenses, view real-time spending analytics, and store transaction records on-chain using Clarity smart contracts.

Features

  • 🔐 Wallet Integration — Simplified connection to Stacks wallets (Leather/Hiro)
  • 📜 Contract Wrapper — Easy-to-use methods for the FlowLedger transactions-v2 contract
  • Auto-Encoding — Automatic Clarity value encoding for contract calls
  • 📊 Read-Only API — Quick access to transaction status and ledger history
  • 🛠️ Utility Functions — Address formatting, STX conversion, validation via stacks-echo-kit

Installation

npm install @earnwithalee/flowledger-sdk stacks-echo-kit

Quick Start

const { FlowLedgerSDK } = require('@earnwithalee/flowledger-sdk');

const sdk = new FlowLedgerSDK({
  network: 'mainnet' // or 'testnet'
});

// 1. Connect Wallet
const address = await sdk.connect();
console.log(`Connected: ${sdk.formatAddress(address)}`);

// 2. Add Transaction
const response = await sdk.addTransaction({
  amountSTX: 10,
  memo: "Talent Protocol reward",
  type: "income"
});
console.log('Transaction Broadcasted:', response.txId);

// 3. Get User Balance (via Hiro API)
const balance = await sdk.getBalance(address);
console.log(`Balance: ${sdk.formatSTX(balance)}`);

// 4. Get Transaction Details
const tx = await sdk.getTransaction(address, 1);
console.log('Transaction:', tx);

API Reference

new FlowLedgerSDK(config)

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | config.network | string | 'mainnet' | 'mainnet' or 'testnet' | | config.contractAddress | string | SP3AMZ74T... | Stacks address of the deployed contract | | config.contractName | string | 'transactions-v2' | Name of the Clarity contract |

Core Methods

sdk.connect()

Prompts the user to connect their Stacks wallet (Leather/Hiro). Returns the connected STX address.

sdk.addTransaction({ amountSTX, memo, type })

Calls the add-transaction public function on the smart contract.

  • amountSTX — Amount in STX (auto-converted to microSTX)
  • memo — Short memo string (max 50 chars)
  • type"income" or "expense" (max 10 chars)

sdk.getTransaction(userAddress, txId)

Retrieves a specific transaction from the ledger via the Hiro API.

sdk.getBalance(address)

Gets the STX balance of a given Stacks address.

Utility Methods

sdk.formatAddress(address)

Truncates a wallet address for UI display (e.g., SP3AM...8QMH4).

sdk.formatSTX(amount)

Formats a numeric STX amount for display.

sdk.isValidAddress(address)

Validates a Stacks address format.

sdk.getExplorerTxUrl(txId)

Returns the Stacks Explorer URL for a given transaction ID.

Utility Module

Additional utility functions are available via the utils.js module:

const { truncateAddress, formatMicroToStx, isValidAddress } = require('@earnwithalee/flowledger-sdk/utils');

truncateAddress('SP3AMZ74TRAWC92ZB110E38SZB7F1T06EHZ38QMH4');
// => "SP3AM...8QMH4"

formatMicroToStx(10000000);
// => "10.00 STX"

isValidAddress('SP3AMZ74TRAWC92ZB110E38SZB7F1T06EHZ38QMH4');
// => true

Related Projects

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

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

License

MIT © earnwithalee