Join our
Discord!
LogoLogo
SupraScan ExplorerStarKey WalletDiscord
MoveVM
  • Network
  • Oracles
  • Automation
  • SupraNova
  • AI Agents
MoveVM
  • Overview
  • Getting Started
    • Introduction to Docker
    • Setup Supra CLI
    • Create a Supra Account
    • Create a Move Package
      • Write a Module
      • Compile and Publish
      • Interact with a Package
    • Create a dApp with StarKey
  • Network Information
  • Token Standards
  • Learn Move 101
    • Getting Started with Move
    • Unsigned Integers in Move
    • Math Operations in Move
    • Using Vectors in Move
    • Reading Resource Data with borrow_global
    • Passing Data in Move: Value vs. Reference
    • Adding Elements with vector::push_back
    • Emitting Events with event::emit
  • Move Book
    • Getting Started
      • Modules and Scripts
      • Move Tutorial
    • Primitive Types
      • Integers
      • Bool
      • Address
      • Vector
      • Signer
      • References
      • Tuples and Unit
    • Basic Concepts
      • Local Variables and Scope
      • Equality
      • Abort and Assert
      • Conditionals
      • While, For, and Loop
      • Functions
      • Structs and Resources
      • Constants
      • Generics
      • Type Abilities
      • Uses and Aliases
      • Friends
      • Packages
      • Package Upgrades
      • Unit Tests
    • Global Storage
      • Structure
      • Operators
    • Reference
      • Standard Library
      • Coding Conventions
  • Aptos to Supra Cheatsheet
  • Ethereum to Supra Move Cheatsheet
  • TypeScript SDK
    • Guides
      • Create Supra Accounts
      • Publish a Package
    • Documentation
    • Repository
  • Rest API
    • Mainnet
      • Accounts
      • Faucet
      • Transactions
      • Block
      • View
      • Consensus
      • Events
      • Tables
    • Testnet
      • Accounts
      • Faucet
      • Transactions
      • Block
      • View
      • Events
      • Tables
  • Supra Multisig Guide
  • Binary Canonical Serialization (BCS) Standard Guide
  • Developer Resources
    • Supra Dapp Templates
    • Supra Move VS Code Extension
  • Native Oracles
    • Data Feeds (Push)
    • dVRF (Randomness)
    • Automation
    • SupraNova Bridge
Powered by GitBook

Links

  • Whitepapers
  • Bug Bounty
  • Security Audits

‎

  • Supra Dev Hub
  • Supra Labs Github
  • Entropy Foundation Github
On this page
  • Interacting with your module
  • Store a string/message on-chain
  • View the string/message stored on-chain
  • Final step: Join our Discord!
  • Commands used to interact with modules
Edit on GitHub
  1. Getting Started
  2. Create a Move Package

Interact with a Package

Create and deploy your first move module.

PreviousCompile and PublishNextCreate a dApp with StarKey

Last updated 20 days ago

Interacting with your module

The hello_blockchain module stores a string at an account within the MessageHolder resource of the calling account that can later be retrieved. To try interacting with the contract we will:

  1. Call set_message to store a string on-chain

  2. Call get_message to view the stored message on-chain

1

Store a string/message on-chain

Replace the place holder values denoted by <> with your account address before executing the commands.

replace & execute me!
supra move tool run --function-id '<hello_blockchain>::message::set_message' --args string:"Hello world!" --rpc-url https://rpc-testnet.supra.com
2

View the string/message stored on-chain

replace & execute me!
supra move tool view --function-id '<hello_blockchain>::message::get_message' --args address:<hello_blockchain> --rpc-url https://rpc-testnet.supra.com
3

Final step: !

Commands used to interact with modules

Calling a view function: 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.

Expects the two following arguments: --function-id which designates the function to be called. The format is as follows: MODULE_ADR::MODULE_NAME::FUNCTION_NAME

--args which designates the arguments to be passed to the function. If multiple parameters must be passed, they are separated by spaces. The format is as follows: TYPE:VALUE

Execute the following command to better understand the arguments of the command.

supra move tool view --help
Executing an entry function: 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.

Expects the two following arguments: --function-id which designates the function to be called. The format is as follows: MODULE_ADR::MODULE_NAME::FUNCTION_NAME

--args which designates the arguments to be passed to the function. If multiple parameters must be passed, they are separated by spaces. The format is as follows: TYPE:VALUE

Execute the following command to better understand the arguments of the command.

supra move tool run --help
Join our Discord