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

cardanocli-js-lambda

v4.1.5

Published

A library binding the cardano-cli to JavaScript

Downloads

21

Readme

cardanocli-js

Fork Notes:

This is a fork of the original project to make the use suitable for AWS Lambda. The main difference is the introduction of seperate readable (./) and a write-able directories (/tmp) as Lambda can only write in /tmp.

Overview

This is a library, which wraps the cardano-cli with JavaScript and makes it possible to interact with the cli-commands much faster and more efficient.

This library is brought to you by Berry Pool. You can support our work by delegating to our pool.
Donations (ADA): addr1q97x8rfnkw4pmdgnwjzavl8jvg77tuy6wn3wm90x9emwgj8nhh356yzp7k3qwmhe4fk0g5u6kx5ka4rz5qcq4j7mvh2sg67tj5

Prerequisites

  • cardano-node >= 1.29.0
  • node.js >= 12.19.0

Install

NPM

npm install cardanocli-js

From source

git clone https://github.com/Berry-Pool/cardanocli-js.git
cd cardanocli-js
npm install

Getting started

const CardanocliJs = require("cardanocli-js");
const shelleyGenesisPath = "/home/ada/mainnet-shelley-genesis.json";

const cardanocliJs = new CardanocliJs({ shelleyGenesisPath });

const createWallet = (account) => {
  const payment = cardanocliJs.addressKeyGen(account);
  const stake = cardanocliJs.stakeAddressKeyGen(account);
  cardanocliJs.stakeAddressBuild(account);
  cardanocliJs.addressBuild(account, {
    paymentVkey: payment.vkey,
    stakeVkey: stake.vkey,
  });
  return cardanocliJs.wallet(account);
};

const createPool = (name) => {
  cardanocliJs.nodeKeyGenKES(name);
  cardanocliJs.nodeKeyGen(name);
  cardanocliJs.nodeIssueOpCert(name);
  cardanocliJs.nodeKeyGenVRF(name);
  return cardanocliJs.pool(name);
};

const wallet = createWallet("Ada");
const pool = createPool("Berry");

console.log(wallet.paymentAddr);
console.log(pool.vrf.vkey);

Check /examples for more use cases.

API

  • API Documentation

Structure

All files will be stored and used in the directory you choose when instantiating CardanocliJs (dir). The directory is split in two subfolders tmp and priv. In the tmp folder are stored protocol paramters, raw transactions, signed transactions and witnesses with unique identifiers. The priv folder is again divided into two subolders holding on one site the pools pool and on the other side the wallets wallet (like CNTools structure).

Example structure:

dir
    tmp
        <tx_1.raw>
        ...
    priv
        pool
            Berry
                <Berry.node.vkey>
                <Berry.node.skey>
                <Berry.vrf.vkey>
                ...
        wallet
            Lovelace
                <Lovelace.payment.vkey>
                <Lovelace.stake.skey>
                ...

Tests

Install npm dev dependencies using npm install --also=dev.

Tests are using Jest framework and can be run by using npm -s run test command.

To configure the test suite, make a copy of .env.dist and rename it .env. Then change all parameters values to fit your environment.

Caution: The TEST_WORKSPACE_DIR will be deleted at the end of the test suite. NEVER USE AN EXISTING DIRECTORY !!! You may disable this behavior by commenting the cleanup function in test/index.test.js:

afterAll(() => {
    // cleanUpTestDirectory();
});