Skip to content

Commit

Permalink
Merge pull request #1845 from qwrdxer/main
Browse files Browse the repository at this point in the history
task3 finish
  • Loading branch information
Sifotd authored Nov 15, 2024
2 parents ddf4994 + 20ca353 commit 1a4a963
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
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

0 comments on commit 1a4a963

Please sign in to comment.