🖐🏻 免责声明
本教程仅供学习交流使用,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关,请各读者自觉遵守相关法律法规。
创建项目后需要进到项目文件夹下, aptos init 生成config.yaml文件,这一步主要指定网络及账号信息
# 新建项目
--name 指定项目名称 --package-dir 指定项目文件夹
aptos move init --name myproject --package-dir myproject
# 编译文件
编译这一步会下载依赖,这样代码一些类库才不会报错
aptos move compile
# 测试文件
测试类上用#[test_only]标记,测试方法上用
#[test]标记
aptos move test
# 发布文件
hello_blockchain是配置在.toml文件,address配置下的别名,default是指用配置文件下默认的地址
aptos move publish --named-addresses hello_blockchain=default
# 调用方法
比如我有一段代码
module 0x1::message{ //message等于是类名 fun hello(msg:string::String){ } #[view] fun get_hello(addr::address){ } }
//run方法
aptos move run --function-id 'ox1::message::hello' --args 'string:hello,world'
//view方法
aptos move view --function-id 'ox1::message::get_hello' --args 'address:0x123sdda'
敬请期待更新

