Hooks Toolkit CLI

hooks-toolkit-cli is a powerful command-line tool that allows developers to compile JS code into WebAssembly (Wasm) modules. In this guide, we will walk you through the steps required to set up hooks-toolkit-cli in your project.

Installing dependencies

To install hooks-toolkit-cli, you'll need to have Node.js and Yarn installed on your system. Once you have these dependencies installed, you can install hooks-toolkit-cli globally using the following command:

npm install -g hooks-toolkit-cli

Setting up the Contracts Folder

To compile your JS code into Wasm modules, you'll need to set up a folder named contracts that holds the JS code files. This folder will contain the necessary code for your contracts.

Building the Contracts

To build the contracts and generate the Wasm modules, you can use the following command:

hooks-toolkit-cli compile contracts build

This command will compile the JS code files in the contracts folder and save the resulting Wasm modules to the build directory. If you have nested contracts, they will also be built.

Building a Single Contract

To build a specific contract, you can use the following command:

hooks-toolkit-cli compile contracts/base.ts build

This command will compile the base.ts JS code file and save the resulting Wasm module to the build directory.

Now you have hooks-toolkit-cli set up in your project and can start compiling your JS code into Wasm modules.

Was this page helpful?