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

@ujoteam/card

v0.0.1-alpha.13

Published

<!-- show-on-docup <br /> -->

Readme

ujoJS


Discord license code style: prettier lerna Contributions welcome

Ujo is a music platform that uses the ethereum blockchain as the substrate for innovation by empowering artists, digitizing their music rights and metadata, sharing this information in an open and decentralized environment, thus enabling new applications, products, and services to license their catalogs and pay artists directly with minimal friction. You can learn more about the protocol here.

This repo contains a JavaScript package for interacting with Connext's State Channels, a layer 2 technology meant for decreaing the load on the Ethereum network.

Table of Contents

Background

This package provides connection points to Connext's payment channel hub with funds denominated in Dai. Much of the functionality seen in the dai wallet is obfuscated into a simple package. To read more on Connext visit their docs.

⚠️ Warning ⚠️

This is beta software. Use at your own discretion.

Getting Started

To get started, npm or yarn install the package and its dependencies:

npm install --save @ujoteam/card
// or
yarn add @ujoteam/card

You will need to point to a hub in order to utilize the state channel functionality. Connext currently hosts hubs for both the Rinkeby and Ethereum Mainnet. If you would like to run your own node, check out their docs for indra.

First create a new Card by passing in an object with the properties seen in the javascript below. The onStateUpdate function is a callback which will be called every time the state of the address is updated. State is updated by sending, receiving, depositing, or withdrawing funds. The only argument currently passed to the callback is the amount denominated in wei. A helper function is provided to convert to USD: convertDaiToUSDString.

const card = new Card({
  hubUrl: 'https://...',
  rpcProvider: 'https://...',
  onStateUpdate: amnt => { console.log(`$${card.convertDaiToUSDString(amnt)}`)},
  domain: 'localhost [for connext debugging purposes]',
});

Initializing the card with require a hubUrl and json rpcProvider. If running indra locally, you can leave these values blank or remove them from the object as the default values will point to the local hub running on port 8080 and the rpc provider on 8545. Otherwise, options for rinkeby and mainnet are respectively:

// rinkeby
const CONNEXT_HUB_URL = "https://daicard.io/api/rinkeby/hub";
const CONNEXT_RPC_URL = "https://eth-rinkeby.alchemyapi.io/jsonrpc/SU-VoQIQnzxwTrccH4tfjrQRTCrNiX6w";

// mainnet
const CONNEXT_HUB_URL = "https://daicard.io/api/mainnet/hub";
const CONNEXT_RPC_URL = "https://eth-mainnet.alchemyapi.io/jsonrpc/rHT6GXtmGtMxV66Bvv8aXLOUc6lp0m_-";

Then

const address = await card.init(mnemonicCanGoHere);

If an mnemonic is not passed in to the init function, one will be generated for you. However, it will first check if any mnemonic had previously been stored in localStorage first.

Important Upon initialization, a mnemonic will be generated and stored in localStorage keyed at localStorage.get('mnemonic'). For this reason you should warn your users to avoid resetting localStorage as it will result in the disappearance of the mnemonic and therefore a generation of a new seed phrase and wallet next time the Card is initialized.

Using the Card

The card offers out of the box functionality for handling deposits. Utilizing another wallet holding either ether or dai, send a deposit to the wallet address returned from the card.initialize function as seen in the getting started section. It may take some time for the hub to receive the deposit request and collateralize your channel.

Once funds have appeared in your wallet, there are three main activites to perform:

  • Direct Payment (to another wallet, non-custodial)
    • card.generatePayment(valueAsNumberToSendInUSD, walletAddressAsString)
  • Pay via Link (custodial)
    • const linkToClaim = await card.generateRedeemableLink(valueAsNumberToSendInUSD)
  • Claim via Link
    • card.redeemPayment(linkToClaim)
  • Withdraw funds
    • card.withdrawalAllFunds(walletAddressAsString)

For a stripped down UI to begin, check out the Sandbox package found in this mono-repo ujo.js/packages/sandbox.

Contributing

Thanks for your interest in contributing to ujoJS. Please have a look at the guide to get started.

Please check out the issues page for areas that could use help! We hope to see your username on our list of contributors 🙏🎉🚀