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

@nanobox/nano-client

v2.0.1

Published

A simple to use Node/browser client for the Nano network

Downloads

8

Readme

npm version build

Simple Nano client for node.js and browser

A simplified client for the Nano cryptocurrency. This library aims to support the most general use-cases for interacting with the nano network. This be to update an account, list transactions and to send funds.

You can also check out Nano Ping over at examples for a sample implementation with this library.

Install

Add with yarn or npm:

$ yarn add @nanobox/nano-client

Usage

To create the client:

import { NanoClient } from "@nanobox/nano-client";

const client = new NanoClient({
    url: "https://api.nanobox.cc", // Or any other node url
    // Basic auth if the Node or proxy requires this
    // credentials: { username: 'username', password: 'password' }
})

Receive nano funds

To receive nano, we need an address, public key and private key to sign a receive block (the block is signed locally). For testing purposes this can be generated over at Nano Tools or any similar tool. There's also a convenient method in the client itself to generate a wallet: client.generateWallet(). A wallet will be used to derive new accounts.

To receive Nano, first ensure that there exists a pending block for the account by sending a small amount of Nano to the address.

const account = {
    address: "nano_.....", // Replace with YOUR address here
    publicKey: "public-key", // Replace with YOUR public key
    privateKey: "private-key", // Replace with YOUR private key
    balance: NANO.ZERO // Balance will be updated on receive/send
}

// Updates account to latest state, this will automatically process receive blocks
const accountAfterReceive = await client.update(account)

Limit number of receives processed

It's possible to specify number of receives to process by the client. Typically, to avoid loading for too long.

const accountAfterReceive = await client.update(account, 1)

Sending

To send your newly received nano:

// We re-use the account created in the previous section
const accountAfterSend = await client.send(account, 'nano_3ktybzzy14zxgb6osbhcc155pwk7osbmf5gbh5fo73bsfu9wuiz54t1uozi1', NANO.fromNumber(0.001))
// accountAfterSend now has balance subtracted sent amount

Send max

There's a utility function to send all funds from an account to an address:

const accountAfterSend = await client.sendMax(account)
// accountAfterSend now has balance: 0

Change representative

To change representative for an account:

// We re-use the account created in the previous section
account.representative = 'nano_.....'
await client.setRepresentative(account)

Websockets

There is preliminary websockets support, namely for listening on send and receive events for a given (or multiple) accounts:

Setup

To be able to use websockets, create the client with a websockets url:

const client = new NanoClient({
    // ... other options
    websocketUrl: 'wss://ws.nanobox.cc'
})

To listen for receive events (address that received nano)

client.onReceive('nano_34prihdxwz3u4ps8qjnn14p7ujyewkoxkwyxm3u665it8rg5rdqw84qrypzk', received => {
    // Prints receive information
    console.log(s)
})

To listen for send events (address that sent nano)

client.onSend('nano_34prihdxwz3u4ps8qjnn14p7ujyewkoxkwyxm3u665it8rg5rdqw84qrypzk', sent => {
    // Prints sent information
    console.log(s)
})