Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task3 finish #1845

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions mover/qwrdxer/code/task3/source.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
/// Module: task3_nft
module task3_nft::task3_nft;
*/
module task3_nft::mynft{
use std::string;
use std::string::String;
use sui::display::new_with_fields;
use sui::package::claim;
use sui::transfer::transfer;
use sui::tx_context::sender;

public struct QwrdxerNFT has key, store {
id: UID,
name: String,
image_url: String,
}

/// One-Time-Witness for the module.
public struct MYNFT has drop {}
fun init(otw:MYNFT,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 = claim(otw, ctx);
// Get a new `Display` object for the `Hero` type.
let mut display = new_with_fields<QwrdxerNFT>(
&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 nft=QwrdxerNFT{
id:object::new(ctx),
name:string::utf8(b"qwrdxer give you a nft"),
image_url:string::utf8(b"https://avatars.githubusercontent.com/u/46155167?s=400&u=a0f8c62e5478bbf48e50dfeac6dc99240a384f3e&v=4")
};
transfer::public_transfer(nft,sender(ctx));
}
public entry fun mint(name:String,image_url:String,target:address,ctx:&mut TxContext){
let id=object::new(ctx);
let nft=QwrdxerNFT{id,name,image_url};

transfer::public_transfer(nft,target);
}
}
Binary file added mover/qwrdxer/images/nft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions mover/qwrdxer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
- [✓] `Faucet Coin` address2 mint hash:GDg4keQ1fGQVjoSHwiEPeZ3D29UUWNVgAPPEB1ui2LV8

## 03 move NFT
- [] nft package id :
- [] nft object id :
- [] 转账 nft hash:
- [] scan上的NFT截图:![Scan截图](./images/你的图片地址)
- [] nft package id : 0xf30806a8738cfc1e1d34d8cb441cbbf4fa8ec34c840aa20aa250c1e6ff149b77
- [] nft object id : 0x14d13d9603ad0ffe955f2051f2163ea357478d5f2a0a74f1c77526f13f28fce6
- [] 转账 nft hash: Bez242vQST4sPW97UD881MG3NA1HdDfDPySVpYLcuRs9
- [] scan上的NFT截图:![Scan截图](./images/nft.png)

## 04 Move Game
- [] game package id :
Expand Down