huchenjie339 / Move-Colearn-Camp-Seeshore

Move-Colearn-Camp-Seeshore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

适用人群

  1. seeshore 线下 co-learn 与童鞋
  2. 706 Move 课程童靴

Move playground 适合在 Web 端做一些快速的学习和验证 , 可配合 Mirror 笔记一起阅读操练 .

Contents

Title Code Mirror
0x00 Why Move? / Mirror
0x01 Basic Value Type 基础类型 code Mirror
0x02 Loop 循环 code Mirror
0x03 Struct 结构体 code Mirror
0x04 tuple & Reference 元组、引用 code Mirror
0x05 Abort & Assert 中止和断言 code Mirror
[Practice] football star 球星卡(AptosEden) code /
0x06 ownership 所有权问题 / Mirror
0x07 signer 签署者 / Mirror
0x08 Resource 资源类型 code Mirror
0x09 Vector 容器 code Mirror
0x10 Generics 泛型 code Mirror
0x11 Move Patterns 设计模式 [预计 1.14 上线]
0x12 Move 高级数据结构 [预计 1.17 上线]

新版本 Move Playground 操作方法:

地址: https://playground.pontem.network/

  1. 首先我们可以安装一个 Aptos 的 Petra 钱包, 搞一个自己的 Aptos 链地址 ( Sui 钱包同理 )

image-20230105163451720

  1. 然后来到 Playground, 在 Move.toml 定义一个地址: 即 my_address

image-20230105163415425

  1. 之后便可以在 Module 里面使用 my_address 这个地址:
module my_address::student {  // 使用了 my_address
   ....
  1. 编译通过后, 点击左上角运行测试函数 :

点击 Playground 左上角的 Test 即可运行测试文件/函数 :

image-20230105163655139

Test 测试函数举例 :

#[test_only]
module my_address::test_module{

    use my_address::student::{Student, newStudent, getId};
    use std::debug;

    #[test(sender=@my_address)]
    fun test_newStudent() {  //
        let stu1: Student = newStudent(10001, 24, true);
        let _id = getId(&stu1);
        debug::print(&_id);
    }
}
  1. 观察控制台输出 :

image-20230105163712840

社区对 Move playground 评头论足 :

看出来了, Move Playground 他想做 Move 版本的 Remix, 让用户在浏览器端直接部署合约

但是填私钥有点怕怕的 .... 不过没关系, 后续可以搞个测试账号

About

Move-Colearn-Camp-Seeshore


Languages

Language:Move 100.0%