diff --git a/mover/linqining/code/task2/faucet_coin/Move.toml b/mover/linqining/code/task2/faucet_coin/Move.toml index 1b517a2be..ce62a246c 100644 --- a/mover/linqining/code/task2/faucet_coin/Move.toml +++ b/mover/linqining/code/task2/faucet_coin/Move.toml @@ -5,7 +5,7 @@ edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move # authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] [dependencies] -Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/mainnet" } # For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. # Revision can be a branch, a tag, and a commit hash. diff --git a/mover/linqining/code/task3/display_nft/Move.lock b/mover/linqining/code/task3/display_nft/Move.lock new file mode 100644 index 000000000..4a8817084 --- /dev/null +++ b/mover/linqining/code/task3/display_nft/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "6B7A8AED2C1EF029F8D2281D36C6E8AADD6050481843FF50F3E1DB6F5CE02FC4" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.37.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0x08e4c88ca1eb4233b4ea72e3b762d94ae48e3fd6e73939a7244fd31b2ade8db9" +latest-published-id = "0x08e4c88ca1eb4233b4ea72e3b762d94ae48e3fd6e73939a7244fd31b2ade8db9" +published-version = "1" diff --git a/mover/linqining/code/task3/display_nft/Move.toml b/mover/linqining/code/task3/display_nft/Move.toml new file mode 100644 index 000000000..7ab1e284d --- /dev/null +++ b/mover/linqining/code/task3/display_nft/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "display_nft" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +display_nft = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/linqining/code/task3/display_nft/sources/display_nft.move b/mover/linqining/code/task3/display_nft/sources/display_nft.move new file mode 100644 index 000000000..b029d9fda --- /dev/null +++ b/mover/linqining/code/task3/display_nft/sources/display_nft.move @@ -0,0 +1,70 @@ +module display_nft::display_nft; +use std::string::String; +use std::string; +use sui::package; +use sui::display; + +public struct MyNFT has key,store{ + id: UID, + name:String, + image_url:String, +} + +public struct DISPLAY_NFT has drop{ + +} + +fun init(otw:DISPLAY_NFT,ctx:&mut TxContext){ + + let keys = vector[ + b"name".to_string(), + b"link".to_string(), + b"image_url".to_string(), + b"description".to_string(), + b"project_url".to_string(), + b"creator".to_string(), + ]; + let values = vector[ + // For `name` one can use the `Hero.name` property + b"{name}".to_string(), + // For `link` one can build a URL using an `id` property + b"https://sui-heroes.io/hero/{id}".to_string(), + // For `image_url` use an IPFS template + `image_url` property. + b"{image_url}".to_string(), + // Description is static for all `Hero` objects. + b"A true Hero of the Sui ecosystem!".to_string(), + // Project URL is usually static + b"https://sui-heroes.io".to_string(), + // Creator field can be any + b"Unknown Sui Fan".to_string(), + ]; + + // Claim the `Publisher` for the package! + let publisher = package::claim(otw, ctx); + + // Get a new `Display` object for the `Hero` type. + let mut display = display::new_with_fields( + &publisher, keys, values, ctx + ); + + // Commit first version of `Display` to apply changes. + display.update_version(); + transfer::public_transfer(publisher,ctx.sender()); + transfer::public_transfer(display,ctx.sender()); + + let my_nft = MyNFT{ + id: object::new(ctx), + name:string::utf8(b"linqining"), + image_url: string::utf8(b"https://avatars.githubusercontent.com/u/18323181?s=400&u=1a7a274db375e0ffe9f303939d3283c5cedc1e25&v=4"), + }; + transfer::public_transfer(my_nft,ctx.sender()) +} + +public entry fun mint(url:String,ctx:&mut TxContext){ + let my_nft = MyNFT{ + id: object::new(ctx), + name:string::utf8(b"linqining"), + image_url: url, + }; + transfer::public_transfer(my_nft,ctx.sender()); +} \ No newline at end of file diff --git a/mover/linqining/code/task3/display_nft/tests/display_nft_tests.move b/mover/linqining/code/task3/display_nft/tests/display_nft_tests.move new file mode 100644 index 000000000..8bb8a300a --- /dev/null +++ b/mover/linqining/code/task3/display_nft/tests/display_nft_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module display_nft::display_nft_tests; +// uncomment this line to import the module +// use display_nft::display_nft; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_display_nft() { + // pass +} + +#[test, expected_failure(abort_code = ::display_nft::display_nft_tests::ENotImplemented)] +fun test_display_nft_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/linqining/code/task3/nft/Move.lock b/mover/linqining/code/task3/nft/Move.lock index 1af460642..dd986e72f 100644 --- a/mover/linqining/code/task3/nft/Move.lock +++ b/mover/linqining/code/task3/nft/Move.lock @@ -32,3 +32,9 @@ chain-id = "4c78adac" original-published-id = "0x34caeefe0d3b271ec280a386a37090cae86a35b5caadb9ed1b19c42698e2a92c" latest-published-id = "0x34caeefe0d3b271ec280a386a37090cae86a35b5caadb9ed1b19c42698e2a92c" published-version = "1" + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0xd274bf8a1ad63e7969ac9f653c2017c684e3a3762dff2bd48d7c5b7796a4263a" +latest-published-id = "0xd274bf8a1ad63e7969ac9f653c2017c684e3a3762dff2bd48d7c5b7796a4263a" +published-version = "1" diff --git a/mover/linqining/code/task3/nft/sources/nft.move b/mover/linqining/code/task3/nft/sources/nft.move index b485dcf30..e17dd30c0 100644 --- a/mover/linqining/code/task3/nft/sources/nft.move +++ b/mover/linqining/code/task3/nft/sources/nft.move @@ -9,11 +9,11 @@ public struct MyNFT has key{ image_url:String, } -// public fun mint() { -// -// } +public struct DisplayNft has drop{ -fun init(ctx:&mut TxContext){ +} + +fun init(otw:DisplayNft,ctx:&mut TxContext){ let my_nft = MyNFT{ id: object::new(ctx), name:string::utf8(b"linqining"), @@ -28,5 +28,40 @@ public entry fun mint(url:String,ctx:&mut TxContext){ name:string::utf8(b"linqining"), image_url: url, }; + let keys = vector[ + b"name".to_string(), + b"link".to_string(), + b"image_url".to_string(), + b"description".to_string(), + b"project_url".to_string(), + b"creator".to_string(), + ]; + + let values = vector[ + // For `name` one can use the `Hero.name` property + b"{name}".to_string(), + // For `link` one can build a URL using an `id` property + b"https://sui-heroes.io/hero/{id}".to_string(), + // For `image_url` use an IPFS template + `image_url` property. + b"ipfs://{image_url}".to_string(), + // Description is static for all `Hero` objects. + b"A true Hero of the Sui ecosystem!".to_string(), + // Project URL is usually static + b"https://sui-heroes.io".to_string(), + // Creator field can be any + b"Unknown Sui Fan".to_string(), + ]; + + // Claim the `Publisher` for the package! + let publisher = package::claim(otw, ctx); + + // Get a new `Display` object for the `Hero` type. + let mut display = display::new_with_fields( + &publisher, keys, values, ctx + ); + + // Commit first version of `Display` to apply changes. + display.update_version(&display); transfer(my_nft,ctx.sender()); + transfer(display,ctx.sender()); } \ No newline at end of file diff --git a/mover/linqining/images/nft_mint.png b/mover/linqining/images/nft_mint.png new file mode 100644 index 000000000..4c09dbed2 Binary files /dev/null and b/mover/linqining/images/nft_mint.png differ diff --git a/mover/linqining/readme.md b/mover/linqining/readme.md index eb9cbeb2e..0e3b4c62d 100644 --- a/mover/linqining/readme.md +++ b/mover/linqining/readme.md @@ -29,10 +29,11 @@ - [x] `Faucet Coin` address2(0xc1f4704452819f75c258fe3a01e54d6561899e3478f818625ee8be716fbdd007) mint hash: HYr5URs9WbfP4sEUxQJtbfPg16U33XCmNnGwv7MPyVVM ## 03 move NFT -- [x] nft package id : 0x34caeefe0d3b271ec280a386a37090cae86a35b5caadb9ed1b19c42698e2a92c -- [x] nft object id : 0x3511e9b3d9e88acb2da73ecca408e9e86ab55d28fc41b946ecdaabfe6ed1b4ba -- [] 转账 nft hash: -- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) +- [x] nft package id : 0x08e4c88ca1eb4233b4ea72e3b762d94ae48e3fd6e73939a7244fd31b2ade8db9 +- [x] nft object id : 0x2f7c23c9e1e90dde2164fd15bdded9e8d43e6f19e81822883a3beb93f4495899 +- [x] 转账 nft hash: PmWjBzc9RfS8UnQ14URBZKktEptWv4r1x3FN8dUCDqt +- [x] scan上的NFT截图:![Scan截图](./images/nft_mint.png) + ## 04 Move Game - [] game package id :