Skip to Content

Interact with a Package

Call the published module’s functions.

Interacting with your module

The hello_blockchain::message module stores a string in a MessageHolder resource under the calling account, and returns it on request. To try it:

  1. Call set_message to store a string on-chain.
  2. Call get_message to read the stored string.

Store a message on-chain

Replace <hello_blockchain> with the address you gave hello_blockchain in Move.toml, which is your account’s address.


replace & execute me!
supra move tool run --function-id '<hello_blockchain>::message::set_message' --args string:"Hello world!"

The CLI asks you to confirm the gas unit price. Press Enter to accept it, or enter a different price in quants. --accept-defaults accepts it without asking.

Read the stored message


replace & execute me!
supra move tool view --function-id '<hello_blockchain>::message::get_message' --args address:<hello_blockchain>

Join the Supra Discord 

Commands used to interact with modules

Calling a view function: supra move tool view

view calls a view function, which reads state and changes nothing. A view function has #[view] above its declaration.

It takes two arguments:

  • --function-id: the function to call, as MODULE_ADDRESS::MODULE_NAME::FUNCTION_NAME.
  • --args: the function’s arguments, each as TYPE:VALUE, separated by spaces.

--help lists all of its arguments:

supra move tool view --help

Executing an entry function: supra move tool run

run sends a transaction that calls an entry function. A transaction can call only functions declared entry.

It takes two arguments:

  • --function-id: the function to call, as MODULE_ADDRESS::MODULE_NAME::FUNCTION_NAME.
  • --args: the function’s arguments, each as TYPE:VALUE, separated by spaces.

--help lists all of its arguments:

supra move tool run --help
Last updated on