Writing Move Scripts
How can I write Move Scripts?
Move scripts can be written in tandem with Move contracts, but it's highly suggested to use a separate Move package for it. This will make it easier for you to determine which bytecode file comes from the script.
Package layout
The package needs a Move.toml and a sources directory, similar to code modules.
For example, we may have a directory layout like:
Script syntax
Scripts can be written exactly the same as modules on Endless. Imports can be used for any dependencies in the Move.toml file, and all public functions, including entry functions, can be called from the contract. There are a few limitations:
There must be only one function in the contract, it will compile to that name.
Input arguments can only be one of [
u8
,u16
,u32
,u64
,u256
,address
,bool
,signer
,&signer
,vector<u8>
]. There is no support for vectors of other types, or structs.
An example below:
For more specific details see: Move Book on Scripts
Last updated