Create a Move Package
Create a Move package, write a module in it, publish it and call its functions. Run the supra commands in the shell
of your network’s container.
Initialize your Move package
Create a new Move package
execute me!
Devnet
supra move tool init --package-dir /supra/move_workspace/exampleContract --name exampleContract \
--framework-network devnetThis creates the package directory with empty sources, scripts and tests directories and a Move.toml file.
Move.toml is the package’s manifest: it holds the package’s name, version, dependencies and named addresses.
The manifest depends on SupraFramework, the package of Supra’s on-chain modules. Its
source is the Move code in
sources. The branches of supra-framework are named after the networks, and rev selects the one the package builds
against. The Move.toml below has rev = "<NETWORK>", where <NETWORK> is devnet, testnet or mainnet.
[package]
name = "exampleContract"
version = "1.0.0"
authors = []
[addresses]
[dev-addresses]
[dependencies.SupraFramework]
git = "https://github.com/Entropy-Foundation/supra-framework.git"
rev = "<NETWORK>"
subdir = "supra-framework"
[dev-dependencies]
Update the named addresses
Open Move.toml in your code editor on your host machine. It is in the move_workspace/exampleContract directory of
your network’s directory, for example supra-testnet/move_workspace/exampleContract/Move.toml.
Add the hello_blockchain named address under [addresses], with your account’s address as its value. Publishing
puts the package’s modules under this address, so it must be the address of the profile that publishes them.
supra profile list prints the address of each of your profiles.[addresses]
hello_blockchain = "<ACCOUNT_ADDRESS>"A named address lets the package’s code write @hello_blockchain instead of the address itself. Compiling the package
replaces each occurrence with the value set in Move.toml.