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 🙏

© 2024 – Pkg Stats / Ryan Hefner

iota.coffee

v1.1.3

Published

Wrapper around iota.lib.js written in CoffeeScript

Downloads

4

Readme

Disclaimer

Don't use with your actual seed. This is experimental work and should not be trusted to work in a production environment. This is intended only for programmers that can understand the code and it's implications.

iota.coffee

Wrapper for the browser and node.js around iotaledger/iota.lib.js with local PoW using:

It exposes IOTA, IotaWallet and IotaTransaction. IOTA is a wrapped and promisyAll'ed iotaledger/iota.lib.js. It has a bunch of functions declared but most of them don't need to be used directly.

Installing

yarn add iota.coffee

nodejs

In order for PoW work in node.js you need to install @iota-pico/pow-nodejs

yarn add @iota-pico/pow-nodejs

Importing

{IOTA, IotaWallet, IotaTransaction} = require 'iota.coffee'

Selecting the node

By default it uses https://field.carriota.com:443 so you don't need to do anything.

IOTA.changeNode('https://nodes.iota.cafe:443')

WebWorkers

In node_modules/iota.coffee/dist/lib directory there's a WebWorker: new_account_worker.js. By adding at least one of them through IOTA.addWorker iota.coffee creates a pool of workers that significantly speed up wallet scanning process since _newAddress function of the iota.lib.js can work in parallel off of the main thread.

for i in [0...3]
  IOTA.addWorker(new Worker 'iota.coffee/dist/lib/new_account_worker.js')

IotaWallet

IotaWallet keeps addresses for a seed cached for speedier balance discovery, selecting inputs and finding a remainder. It exposes mostly getBalance and send functions.

# `IotaWallet.create` scans address space for the supplied seed and returns `IotaWallet` instance.
# It also saves the addresses in localStorage under the key: 'iota' + first ten characters of the seed
seed = '99999999999999999999'
wallet = await IotaWallet.create(seed)

await wallet.getBalance()
#=> 7

wallet2 = await IotaWallet.create('AAAAAAAAAAAAAAA')
tx = await wallet.send(3, wallet2.lastAddress)
await tx.promote()

IotaTransaction

Most of the time this will be a product of IotaWallet send function but it can also be created directly. In that case at least hash must be provided.

tx = new IotaTransaction(hash: 'STINBALCZIHQGKTXTH9QAAQTCO9LVBOSCWXCJRZDRS9FGDDAXIQJQKFE9SETXLRISZFVGIHEPVV9A9999')

# when created with only hash `update` fills it with `value`, `bundle` and `tail`
await tx.update()
tx.value
#=> 500

await tx.isConfirmed()
#=> true

Reattach and Promote

tx = await wallet.send(3, wallet2.lastAddress)

await tx.promote()

txs = await tx.reattach()

License

MIT