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

Begin porting Move Workshop #1 to Aptos.dev #5817

Merged
merged 4 commits into from
Dec 13, 2022
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
9 changes: 9 additions & 0 deletions developer-docs-site/docs/guides/move-guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ slug: "aptos-move-guides"

# Write Smart Contracts with Move

To efficiently write smart contracts in Aptos, we recommend you first:

1. Learn Move concepts
1. Understand Aptos security
1. Create a collection
1. Create an NFT
1. Create resource account

## Aptos Move guides

Start here to learn how the Move language works on the Aptos blockchain.
Expand All @@ -14,6 +22,7 @@ Start here to learn how the Move language works on the Aptos blockchain.
- ### [How Base Gas Works](../../concepts/base-gas.md)
- ### [Interact with the Move VM](../interacting-with-the-blockchain.md)
- ### [Your First Move module](../../tutorials/first-move-module.md)
- ### [Mint NFT with Aptos CLI](./mint-nft-cli.md)
- ### [Upgrading Move Code](upgrading-move-code.md)
- ### [Aptos Move Examples](https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examples)

Expand Down
108 changes: 108 additions & 0 deletions developer-docs-site/docs/guides/move-guides/mint-nft-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: "Mint an NFT with Aptos CLI"
slug: "mint-nft-cli"
---

# Mint an NFT

## Prerequisites

This tutorial assumes you have:

* a GitHub account
* the GitHub CLI
* the Aptos CLI (installed below)

## Mint with the Aptos CLI

Now that you are starting to write smart contracts with Move, let's create our first NFT with the Aptos CLI.

1. [Install the Aptos CLI](../../cli-tools/aptos-cli-tool/install-aptos-cli.md) and note its [many uses](../../cli-tools/aptos-cli-tool/use-aptos-cli.md) for later if you haven't experienced its goodness already.

1. Create an account on Aptos testnet by running the following command and selecting `testnet`:
```shell
aptos init --profile nft-receiver
```

1. When prompted, select `testnet` by entering it:

```shell
Configuring for profile nft-receiver
Choose network from [devnet, testnet, mainnet, local, custom | defaults to devnet]
testnet
```

1. When prompted for your private key, hit enter to generate a new key:
```shell
Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]
```

1. Receive output resembling:
```shell
No key given, generating key...
Account blah does not exist, you will need to create and fun the account through a community faucet e.g. https://aptoslabs.com/testnet-faucet, or by transferring funds from another account

---
Aptos CLI is now set up for account blah as profile nft-receiver! Run `aptos --help` for more information about commands
{
"Result": "Success"
}
➜ devel
```

1. Note *blah* above is a placeholder for your private key. Record it someplace safe.

1. Mint the NFT:

```shell
aptos move run --function-id 8cdf69c8c93fee36ed83f8882908060c1335ed39a827c08dbb506b46237e88fb::minting::mint_nft --profile nft-receiver
```

1. When asked, `Do you want to submit a transaction for a range of...?`, enter: `yes`

1. Receive results resembling:

```shell
{
"Result": {
"transaction_hash": "0x9dc5c20f45a06d0cc621bf12610caa5b3c0797ac181c3339248b48ab0f0fcba2",
"gas_used": 3917,
"gas_unit_price": 100,
"sender": "7d69283af198b1265d17a305ff0cca6da1bcee64d499ce5b35b659098b3a82dc",
"sequence_number": 13,
"success": true,
"timestamp_us": 1668045908262170,
"version": 341215563,
"vm_status": "Executed successfully"
}
}
*/
```

## Find the NFT in your Petra wallet

1. Run `more ~/.aptos/config.yaml` to see the `nft-receiver` private key and then copy it.

1. Install the [Petra Wallet](../../guides/install-petra-wallet.md) Chrome extension.

1. Select the [Testnet network](https://petra.app/docs/use) in the wallet via *Petra settings > Network > Testnet*.

1. Use your testnet coins to send a transaction and mint an NFT. Obtain more and connect your wallet to the faucet at: https://aptoslabs.com/testnet-faucet

1. Go to *Petra > Settings > Switch account > Add Account > Import private key*.

1. Paste the `nft-receiver` private key there.

1. Go to *Petra > Settings > Network > Testnet*.

1. Click **Library** at bottom.

1. See the NFT in your wallet.

## Deploy the NFT contract

Now you can add this smart contract to the Aptos network:

1. Check out and review the [NFT Tutorial](https://github.com/aptos-labs/nft-tutorial) source code.

1. Explore the `mint_nft` function in [`minting.move`](https://github.com/aptos-labs/nft-tutorial/blob/main/sources/minting.move).
1 change: 1 addition & 0 deletions developer-docs-site/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const sidebars = {
"concepts/base-gas",
"guides/interacting-with-the-blockchain",
"tutorials/first-move-module",
"guides/move-guides/mint-nft-cli",
"guides/move-guides/upgrading-move-code",
],
},
Expand Down