2.2.0 • Published 1 year ago

@massalabs/massa-sc-utils v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

massa-sc-utils

Massa utils for easy compilation and deployment of smart contract written in AssemblyScript

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:

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

const utils = new SmartContractUtils();

// compile smart contract from an assemblyscript file
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 from string
const compiledScFromString: CompiledSmartContract = await utils.compileSmartContractFromString(SMART_CONTRACT_EXAMPLE);

Smart contract prompt scripts

The package also provides scripts that allow deploying a smart contract and a webpage (.zip file):

npm run deploy-website

and

npm run deploy-smart-contract
2.2.0

1 year ago

2.1.10

1 year ago

2.1.8

2 years ago

2.1.9

2 years ago

2.1.7

2 years ago

2.1.2

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago