Zum Inhalt springen

Quickstart

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

The API documentation for the lotus-script crate can be found here.

We recommend using Visual Studio Code with rust-analyzer.

To create a new project, you need to have Rust installed. If you don’t have it installed, you can install it from rustup.rs. After installing Rust, you need to install the wasm32 target. You can do this by running the following command:

Terminal window
rustup target add wasm32-unknown-unknown

lotus-sc is a CLI tool that helps you develop scripts for LOTUS. You can download the installer from here. For more information, please refer to the lotus-sc documentation.

Terminal window
lotus-sc create -n my-project -l rust

Follow the instructions in the terminal to complete the project creation.

Edit the scripts.toml file to set the correct user and sub ids for the object the script should be attached to.

Terminal window
lotus-sc deploy

This will compile the script and put it in the correct directory for LOTUS to pick it up. You need to restart the simulator if it is running while you deploy for an object for the first time. All following deploys will be hot-reloaded.

Terminal window
lotus-sc deploy --release

To debug your script in LOTUS, press F4 to open the debug menu. In the debug menu, activate script-debug. This will open a new window where you can see some information about the script and the script state.

To close this window, deactivate script-debug in the debug menu.

Proper WASM debugging is not yet implemented.