5. Create your own Move NFT
This tutorial covers a guide to mint my own NFT and collection using 0x1::simple_nft module. Also, let's understand the concept of Object by transfering NFTs.
Step 1: Create Collection
To create NFTs, a collection must be created first. Let's use 0x1::simple_nft::create_collection
to create a new collection.
public entry fun create_collection(
creator: &signer,
description: String,
max_supply: Option<u64>,
name: String,
uri: String,
mutable_description: bool,
mutable_royalty: bool,
mutable_uri: bool,
mutable_nft_description: bool,
mutable_nft_properties: bool,
mutable_nft_uri: bool,
royalty: Decimal128,
)
> initiad tx move execute 0x1 simple_nft create_collection \
--args "string:description option<u64>:100 string:my_collection string: bool:true bool:true bool:true bool:true bool:true bool:true decimal128:0.05" \
--from [key-name] \
--gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
--node [rpc-url]:[rpc-port] --chain-id [chain-id]
Step 2: Mint NFT
Call 0x1::simple_nft::mint
function to mint NFTs to myself.
public entry fun mint(
creator: &signer,
collection: String,
description: String,
token_id: String,
uri: String,
property_keys: vector<String>,
property_types: vector<String>,
property_values: vector<vector<u8>>,
to: Option<address>,
)
> initiad tx move execute 0x1 simple_nft mint \
--args "string:my_collection string:nft_description string:nft_1 string: vector<string>: vector<string>: vector<vector<u8>>: option<address>:[receiver-addr]" \
--from [key-name] \
--gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
--node [rpc-url]:[rpc-port] --chain-id [chain-id]
Check minted NFTs
There are multiple ways to check NFTs, but the below API can be used to check the NFTs minted to myself.
Get collection list owned by me: https://stone-api.initia.tech/v1/nfts/collections?account=[addr]
Get NFT list owned by me: https://stone-api.initia.tech/v1/nfts/tokens?account={my_address}&collection={collection_address}
Transfer NFT
A single NFT is a single object, and transfer can be done by 0x1::object::transfer_call
.
public entry fun transfer_call(
owner: &signer,
object: address,
to: address,
)
> initiad tx move execute 0x1 object transfer_call \
--args "address:[object-addr] address:[receiver-addr]" \
--from [key-name] \
--gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
--node [rpc-url]:[rpc-port] --chain-id [chain-id]
Last updated