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
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]import {
bcs,
LCDClient,
MnemonicKey,
MsgExecute,
Wallet,
} from '@initia/initia.js';
async function createCollection() {
const lcd = new LCDClient('[rest-url]', {
gasPrices: '0.15uinit',
gasAdjustment: '1.5',
});
const key = new MnemonicKey({
mnemonic: 'beauty sniff protect ...',
});
const wallet = new Wallet(lcd, key);
const msgs = [
new MsgExecute(
key.accAddress,
'0x1',
'simple_nft',
'create_collection',
[],
[
bcs.string().serialize('description').toBase64(), // collection description
bcs.option(bcs.u64()).serialize(100).toBase64(), // max supply
bcs.string().serialize('my_collection').toBase64(), // collection name
bcs.string().serialize('').toBase64(), // collection uri
bcs.bool().serialize(true).toBase64(), // mutable collection description
bcs.bool().serialize(true).toBase64(), // mutable collection royalty
bcs.bool().serialize(true).toBase64(), // mutable collection uri
bcs.bool().serialize(true).toBase64(), // mutable nft description
bcs.bool().serialize(true).toBase64(), // mutable nft properties
bcs.bool().serialize(true).toBase64(), // mutable nft uri
bcs.decimal128().serialize('0.05').toBase64(), // royalty
]
),
];
// sign tx
const signedTx = await wallet.createAndSignTx({ msgs });
// send(broadcast) tx
lcd.tx.broadcastSync(signedTx).then(res => console.log(res));
// {
// height: 0,
// txhash: '0F2B255EE75FBA407267BB57A6FF3E3349522DA6DBB31C0356DB588CC3933F37',
// raw_log: '[]'
// }
}
createCollection();
Step 2: Mint NFT
Check minted NFTs
Transfer NFT
Last updated