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

@decentralized-auth/iota

v1.0.7

Published

Wrapper for the IOTA client that provides convenience methods

Downloads

1

Readme

@decentralized-auth/iota

GitHub license

Wrapper class for the IOTA client that provides some convenience methods for use in the decentralized-auth project.

Usage

const IotaClient = require('@decentralized-auth/iota');

const iota = new IotaClient({
  provider: 'http://node01.testnet.iotatoken.nl:16265',
  securityLevel: 2,
  depth: 5,
  minWeightMagnitude: 10,
});

With logger:

// Instantiate a logger that has an info and error method
const consoleLogger = new (function () {
  this.info = console.log;
  this.error = console.log;
})();

const iota = new IotaClient({
  provider: 'http://node01.testnet.iotatoken.nl:16265',
  securityLevel: 2,
  depth: 5,
  minWeightMagnitude: 10,
}, consoleLogger);

Test

npm run test

Lint

npm run lint

Documentation

Documentation generated from docstrings with jsdoc2md.

iota

Wrapper for the IOTA client that provides some convenience methods.


iota~IotaClient

Kind: inner class of iota


new IotaClient(iotaOptions, logger)

Constructor for an IotaClient.

| Param | Type | Description | | --- | --- | --- | | iotaOptions | object | with: - {string} provider IOTA provider (host URL) - {number} minWeightMagnitude Minimum weight magnitude for PoW - {number} securityLevel IOTA security level - {number} depth IOTA depth | | logger | object | Should support the methods info and error |


iota~send(seed, receiver, message)Promise

Send a message via IOTA.

Kind: inner method of iota

| Param | Type | Description | | --- | --- | --- | | seed | string | Our IOTA seed | | receiver | string | IOTA address of receiver | | message | JSON | to send |


iota~getLastMessage(searchValues)JSON

Gets last received transfer message. NOTE: order is not necessarily chronological, but let's assume it is.

Kind: inner method of iota
Returns: JSON - Parsed message or null when no received transfers

| Param | Type | Description | | --- | --- | --- | | searchValues | Object | List of bundle hashes, addresses, tags or approvees (e.g., { hashes: ['ABCD'] }) |


iota~getAddress(seed, amount)Promise

Gets the first addresses with security level for seed starting at index 0.

Kind: inner method of iota
Returns: Promise - With result or reject with error

| Param | Type | Description | | --- | --- | --- | | seed | string | IOTA seed to generate an address for | | amount | string | Amount of addresses to return |


iota~toTrytes(text)string

Converts text to trytes.

Kind: inner method of iota
Returns: string - Trytes

| Param | Type | Description | | --- | --- | --- | | text | string | Text to convert |


iota~fromTrytes(trytes)string

Converts trytes to string. Also works with odd length trytes string.

Kind: inner method of iota
Returns: string - Converted string

| Param | Type | Description | | --- | --- | --- | | trytes | string | Trytes to convert |