# massa-sc-utils

> Massa smart contract utils

Latest version **2.1.0** (published 2022-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install massa-sc-utils
pnpm add massa-sc-utils
yarn add massa-sc-utils
bun add massa-sc-utils
```

## 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 | 2.1.0 |
| Published | 2022-04-09 |
| First published | 2022-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 28.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Massa Labs |
| Maintainers | evgenip |
| Keywords | js, ts, utils, massa |

## Links

- npm: https://www.npmjs.com/package/massa-sc-utils
- Repository: https://github.com/massalabs/massa-sc-utils
- Homepage: https://github.com/massalabs/massa-sc-utils#readme
- Issues: https://github.com/massalabs/massa-sc-utils/issues
- npm.io page: https://npm.io/package/massa-sc-utils

## Dependencies (2)

- [node-ts](https://npm.io/package/node-ts.md) ^5.1.2
- [assemblyscript](https://npm.io/package/assemblyscript.md) ^0.19.23

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.1.0 (latest) — 2022-04-09
- 1.1.0 — 2022-04-09

## README

# massa-sc-utils
Various utils for easily building smart contract

### Requirements

* NodeJS 14+
* npm / yarn (see package.json)

### Package commands

1. Run `yarn install` to install all deps
2. Run `yarn run build` to build distribution content
3. Run `yarn run test` to run integration and unit tests

### Smart contract utilities

The library provides methods for compiling smart contracts written in AssemblyScript with TypeScript, either via CLI or on the fly. With both methods, the returned values are a text, a binary and a base64 representation of the WASM.

Examples are shown below:

```ts
const SMART_CONTRACT_EXAMPLE = `export function add(x: number, y: number): number { return x+y };`;

const utils = new SmartContractUtils();

// compile smart contract from a typescript file with assemblycode
const compiledScFromSource: CompiledSmartContract = await utils.compileSmartContractFromSourceFile({
    smartContractFilePath: "helloworld.ts",
} as WasmConfig);

// compile smart contract from a .wasm file
const compiledScFromFile: CompiledSmartContract = await utils.compileSmartContractFromWasmFile("helloworld.wasm");

// compile smart contract on the fly
const compiledScFromString: CompiledSmartContract = await utils.compileSmartContractFromString(SMART_CONTRACT_EXAMPLE);
```

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