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

@nymproject/sdk-commonjs

v1.2.4-rc.1

Published

#### ⚠ WARNING: ES5 & CommonJS that requires bundling ⚠ #### Please note: this is a CommonJS package targeting ES5. Use this for older projects that can't process `import` syntax. You will need to handle bundling of the web-workers and WASM.

Downloads

8

Readme

Nym SDK (Typescript) CommonJS and ES5

⚠ WARNING: ES5 & CommonJS that requires bundling ⚠

Please note: this is a CommonJS package targeting ES5. Use this for older projects that can't process import syntax. You will need to handle bundling of the web-workers and WASM.

Find the right package for you

Browsers:

NodeJS:

Why have all these variations? Each project is different, so hopefully we have something for you!

Choose a package depending on how your project is transpiled and packaged:

  • ESM: use import syntax and have your bundler copy the WASM bundles into your output distribution
  • CJS: you have an older project that needs ES5 Javascript
  • nodejs: you want to write your project server-side or locally without the browser on NodeJS

And then, to use *-full-fat or not, how do I choose? We have *-full-fat packages that are pre-bundled by including all web-workers and WASM as inline Base64.

Use the *-full-fat packages when you have trouble changing your bundler settings, or you can use an open CSP.


The Nym SDK for Typescript will get you creating apps that can use the Nym Mixnet and Coconut credentials quickly.

TL;DR

Include the SDK in your project:

npm install @nymproject/sdk-commonjs

Open a connection to a Gateway on the Nym Mixnet:

const { createNymMixnetClient } = require('@nymproject/sdk-commonjs');

const main = async () => {
  const nym = await createNymMixnetClient();

  const nymApiUrl = 'https://validator.nymtech.net/api';

  // show message payload content when received 
  nym.events.subscribeToTextMessageReceivedEvent((e) => {
    console.log('Got a message: ', e.args.payload);
  });

  // start the client and connect to a gateway
  await nym.client.start({
    clientId: 'My awesome client',
    nymApiUrl,
  });

  // send a message to yourself
  const payload = 'Hello mixnet';
  const recipient = nym.client.selfAddress();
  nym.client.send({ payload, recipient });
  
};

This will start the WASM client on a worker thread, so that your code can stay nice and snappy.

Send a message to another user (you will need to know their address at a Gateway):

  const payload = 'Hello mixnet';
  const recipient = '<< RECIPIENT ADDRESS GOES HERE >>';
  await nym.client.send({ payload, recipient });