Skip to main content

Suibase Scripts


Introduction

All scripts are listed below and briefly described.

Best way to learn about each is probably just to try them... and "--help".

Script NameWhat are they for?

lsui
dsui
tsui
msui

Front-ends to Mysten Lab "sui" binaries, each targeting a specific network (no need to "switch" env):

lsui→localnet, dsui→devnet, tsui→testnet, msui→mainnet

Each script always run within the proper workdir (client+keystore container) for the intended network.
The scripts are mostly transparent; all arguments are pass unchanged to a single Mysten Labs sui client call.

Example: $ lsui client gas ← same as sui client gas but always for localnet

localnet
devnet
testnet
mainnet

These are the "workdir scripts" providing suibase specific features.

Example: $ localnet faucet all ← sends Sui coins to every address on your localnet

asui

You can designate one workdir as "active". More Info
This script will call the "active sui" client.

Faster Rust and Move Build

Suibase download the Mysten Lab's repo locally to build a sui client for each network, so your apps might as well re-use these.

Advantages are:

  • Faster local file access on rebuild.
  • Less build/publish errors (sometimes GitHub do have trouble serving, causing dependencies loading errors)
  • Control having your app, client and localnet being built from the same source (avoid version mismatch issues).

Location of these repos are:

  • ~/suibase/workdirs/localnet/sui-repo
  • ~/suibase/workdirs/devnet/sui-repo
  • ~/suibase/workdirs/testnet/sui-repo
  • ~/suibase/workdirs/mainnet/sui-repo

Update to latest with the "update" command (e.g. "localnet update").

Cargo.toml dependencies to local repos

This is optional, but highly recommended. Instead of git, use "path" to the local repos.

Example, replace:

[dependencies]
sui-sdk = { git = "https://github.com/MystenLabs/sui", branch = "devnet" }

with

[dependencies]
sui-sdk = { path = "../../suibase/workdirs/active/sui-repo/crates/sui-sdk/" }

The number of ".." may need to be adjusted depending on where your Cargo.toml is located relative to ~/suibase.

If you always target the same network you can replace the "active" word with a specific workdir (e.g. localnet/devnet/testnet/mainnet).

Demo Example: Cargo.tomlopen in new window

What does "active" mean?

A single workdir is designated as active and allows multiple tools/scripts to run in the same context and target the same network.

You choose the active with a workdir "set-active" command. Examples:

$ devnet set-active
devnet is now active

The "asui" will conveniently call the correct "sui client" for the active workdir. You will typically want to use "asui" in your own script for operations that are expected to work for all network type.

Move.toml dependencies to local repos

This is optional, but highly recommended. Instead of git, use "local" to the local repos.

Example, replace:

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir="crates/sui-framework/packages/sui-framework/", rev = "devnet" }

with

[dependencies]
Sui = { local = "../../suibase/workdirs/active/sui-repo/crates/sui-framework/packages/sui-framework" }

You may need to adjust the number of ".." depending on where your Move.toml is located relative to ~/suibase.

If you prefer to always target the same network you can replace the "active" word with a specific workdir (e.g. localnet/devnet/testnet).

Demo example: Move.tomlopen in new window

How to publish?

Suibase has a workdir command to make it easier to publish.

Example to publish on localnet:

$ cd <location of Move.toml>
$ localnet publish

Alternatively you can do:
$ localnet publish --path <location of Move.toml>

If you have coded your dependencies' path in Move.toml with "active", then you can easily switch and publish on any network:

$ testnet set-active
testnet is now active
$ testnet publish

This should work assuming you have enough fund in the active-address (and the network is up and running!).

Do $ localnet publish --help for more info.

Last update: