Tools

Learn how to compile, publish, test, and manage Move packages and smart contracts using the Supra CLI.

What are Supra CLI Tools?

Tools in the Supra CLI are a set of commands designed to help developers interact with Move packages and smart contracts on the Supra network. They allow users to perform tasks such as compiling, publishing, testing, and running Move scripts, as well as documenting packages and managing on-chain resources. These tools serve as the foundation for building, deploying, and maintaining blockchain applications efficiently.


For the latest RPC URL, please refer to the Supra Network Information page.

CLI Commands for Tools

Here's how to use the Supra CLI commands to work with tools:

Not all CLI commands are listed here. Use the --help option to see the full list.

Clean Derived Artifacts

Removes derived artifacts of a Move package:

supra move tool clean [OPTIONS]

Additional Options:

  • --package-dir <PACKAGE_DIR>: Path to a move package (the folder with a Move.toml file)

Example:

supra move tool clean

Result:

Compile a Package

Compiles a Move package and returns associated ModuleIds:

Additional Options:

  • [OPTIONS]

    • --package-dir <PACKAGE_DIR>: Path to a move package (the folder with a Move.toml file)

Example:

Result:

Initialize a Package

Creates a new Move package at a specified location:

Additional Options:

  • [OPTIONS]

    • --name <NAME>: Name of the new Move package

Example:

Result:

Publish a Smart Contract

Publishes a compiled smart contract to the Supra blockchain:

Additional Options:

  • [OPTIONS]

    • --package-dir <PACKAGE_DIR>: Path to a move package (the folder with a Move.toml file)

    • --profile <PROFILE>: Profile to use from the CLI config

    • --url <URL>: URL to a full node on the network

Example:

Result:

Run a Function

Executes a specified Move function:

Note: The args will depend on your function.

Run Unit Tests

Executes Move unit tests for a package:

Additional Options:

  • [OPTIONS]

    • --package-dir <PACKAGE_DIR>: Path to a move package (the folder with a Move.toml file)

Example:

Result:

Run a View Function

Executes a read-only Move function:

Additional Options:

  • [OPTIONS]

    • --function-id <FUNCTION_ID> = Function name as <ADDRESS>::<MODULE_ID>::<FUNCTION_NAME>

    • --args [<ARGS> ...] = TypeTag arguments separated by spaces.

    Supported types [address, bool, hex, string, u8, u16, u32, u64, u128, u256, raw]

    • --url <URL>: URL to a full node on the network

Example:

Result:

Last updated