Interact with a Package
Create and deploy your first move module.
Last updated
Create and deploy your first move module.
Last updated
Command: supra move tool view
The view
command is used to call view
functions, which do not change the state of the VM in any way. View functions are denoted with #[view]
above the function declaration.
Execute the following command to better understand the arguments of the command.
Command: supra move tool run
The run
command is used to call entry
functions, which result in some transaction. Entry
functions are your gateway to interacting with modules. We are unable to call functions without the entry
declaration.
Execute the following command to better understand the arguments of the command.
Both commands expect the argument --function-id
which designates the function to be called. The format is as follows: MODULE_ADR::MODULE_NAME::FUNCTION_NAME
Function parameters are passed with the argument --args
. If multiple parameters must be passed, they are separated by spaces. The format is as follows: TYPE:VALUE
The example module will transfer tokens from the calling account to the two destination accounts. To gain experience with interacting with a package, we will:
Check the balance of your account with the view_balance
function
Transfer tokens to the destination addresses with the two_by_two
function
Check the balance of your account with the view_balance
function
We should observe that the balance returned in step 3 is less than the balance returned in step 1 due to the tokens being transferred in step 2.