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

eosup

v1.4.0

Published

A cross-platform local testnet manager and smart contract compiler for EOSIO

Downloads

9

Readme

eosup

This package installs an executable for managing your local EOSIO testnet from Docker, as well as for compiling EOSIO smart contracts. It can be installed globally for ease of access to the executable, or installed inside a project as a dependency to access utility functions for creating seed data, or running the executable from your package.json scripts section.

Installing

Globally

Install globally with npm install -g eosup. Then simply run eosup anywhere.

Inside a project

Install as a dependency of your project with npm install eosup. Then, run eosup from your package.json scripts, like this:

"scripts": {
  "build": "eosup compile contract.cpp contract.wasm -c contractname",
  "testnet": "eosup testnet"
},

Usage

Run eosup --help to get info on the specific commands and options.

In the current version, this tool uses:

Block.one doesn't provide the packages in a package registry that allows for simple version selection yet, so for using other versions, a new release of eosup will be necessary. Please open an issue in this repository if you require such update.

Testnet

Run eosup testnet to start a local single-node testnet and load the eosio.bios and eosio.token contracts, and create the EOS token with 1 billion supply. The process will start printing the nodeos output. When you terminate it, it will stop the Docker container and clean up the blockchain files.

Managing testnet programatically

You can also use the Testnet class from your code by importing this package, giving you more control over the management of your testnet.

const { Testnet } = require('eosup')

async function testnetExample() {
  const testnet = new Testnet({
    printOutput: false,
    extraParams: '--verbose-http-errors'
  })
  await testnet.setup() // This makes sure the Docker image is ready
  testnet.loadExitHandler() // Kill the testnet when killing the current process
  await testnet.start()
  // ...
  await testnet.stop()
}

Loading seeds

You can run eosup testnet -c "node loadSeeds.js" for example, which will run the specified command (node loadSeeds.js) right after the testnet becomes operational and ready to receive transactions. This allows you to, for example, use TypeScript for loading the seeds (ts-node loadSeeds.ts), or run anything else you want.

Additionally, the EosUp class provides various useful functions for creating accounts, loading contracts, giving eosio.code permissions, and more. You can use these for loading seed data into your testnet, or running automated tests against your contracts on the blockchain.

const { EosUp } = require('eosup')

async function seedingExample() {
  const up = new EosUp()
  
  await up.createAccount('superdapp') // Can provide a public key as second parameter
  await up.setContract('superdapp', './contract.wasm') // Will automatically load the ABI file with the same name
  
  await up.createAccount('user1')
  // Add { actor: 'superdapp', permission: 'eosio.code' } to user1's 'active' permission:
  const granted = await up.hasCodeActivePermission('user1', 'superdapp')
  if (!granted) {
    await up.giveCodeActivePermission('user1', 'superdapp')
  }
}

Compiling contracts

Run eosup compile <inputFile> <outputFile> to compile smart contracts using eosio.cdt (even in Windows). It also supports a --contract <name> option to specify the contract name to be used for generating the ABI.

Compiling contracts programatically

The EosUp class provides a static function for compiling contracts from your code.

const { EosUp } = require('eosup')

async function compileExample() {
  await EosUp.compile({
    input: './inputFile.cpp',
    output: './outputFile.wasm',
    contract: 'mycontract'
  })
}

Contributing

  • Please report any bugs you find.
  • Pull requests welcome. Maybe open an issue first to discuss it before you work on new features.