codespaces-jupyter icon indicating copy to clipboard operation
codespaces-jupyter copied to clipboard

練習

Open gesso310 opened this issue 5 months ago • 1 comments

module mygame::nft_character {

use sui::object::{Self, UID};
use sui::transfer;

/// キャラNFTの定義
struct CharacterNFT has key, store {
    id: UID,
    name: string::String,
    power: u64,
}

/// NFTを作る関数
public entry fun mint(name: string::String, power: u64, ctx: &mut TxContext) {
    let nft = CharacterNFT {
        id: object::new(ctx),
        name,
        power,
    };
    transfer::transfer(nft, tx_context::sender(ctx));
}

}

gesso310 avatar Aug 21 '25 06:08 gesso310