# eosup

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

Latest version **1.4.0** (published 2020-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install eosup
pnpm add eosup
yarn add eosup
bun add eosup
```

Provides the command `eosup`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-02-16 |
| First published | 2019-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 96.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Andres Berrios |
| Maintainers | andresberrios |
| Keywords | eosio, eos, testnet, compiler, smart-contract, seeds |

## Links

- npm: https://www.npmjs.com/package/eosup
- Repository: https://github.com/operanditech/eosup
- Homepage: https://github.com/operanditech/eosup#readme
- Issues: https://github.com/operanditech/eosup/issues
- npm.io page: https://npm.io/package/eosup

## Dependencies (8)

- [eosjs](https://npm.io/package/eosjs.md) ^20.0.0
- [execa](https://npm.io/package/execa.md) ^2.0.3
- [caporal](https://npm.io/package/caporal.md) ^1.3.0
- [morpheos](https://npm.io/package/morpheos.md) ^2.3.0
- [dockerode](https://npm.io/package/dockerode.md) ^2.5.8
- [dockerator](https://npm.io/package/dockerator.md) 0.3.6
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [event-stream](https://npm.io/package/event-stream.md) ^4.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2020-02-16
- 1.3.0 — 2019-10-02
- 1.2.6 — 2019-10-02
- 1.1.6 — 2019-09-11
- 1.1.5 — 2019-09-11
- 1.1.4 — 2019-08-07
- 1.1.3 — 2019-08-06
- 1.1.2 — 2019-08-06
- 1.1.1 — 2019-08-01
- 1.1.0 — 2019-08-01
- 1.0.0 — 2019-08-01

## 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:

```json
"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:

- [EOSIO/eos](https://github.com/EOSIO/eos) version 2.0.3
- [EOSIO/eosio.cdt](https://github.com/EOSIO/eosio.cdt) version 1.7.0

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.

```js
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.

```js
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.

```js
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.

---
_Source: https://npm.io/package/eosup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
