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

My First NFT Guide Update #838

Merged
merged 13 commits into from
Mar 15, 2025

Conversation

tippi-fifestarr
Copy link
Collaborator

Description

This PR reorganizes Your First NFT into a more streamlined, tutorial-style page. Key changes include:

Step-by-step flow: Converted to a single, cohesive “Steps” tutorial with clear headings and callouts.

Single TypeScript example: Consolidated the instructions into one TS project for easier setup and execution, removing Python snippets from the main guide.

Overall walkthrough: We explain the code before presenting the step by step how to do it and example code.

Readability and structure: Added environment variable configuration, tsconfig.json setup, code explanations, and direct links to the Aptos Explorer to simplify the user onboarding experience.

Should help our developers go faster 🚀

Checklist

  • If any existing pages were renamed or removed:
    • Were redirects added to next.config.mjs?
    • Did you update any relative links that pointed to the renamed / removed pages?
  • Do all Lints pass?
    • Have you ran pnpm fmt?
    • Have you ran pnpm lint?

Copy link

vercel bot commented Feb 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
developer-docs-nextra ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 10:59pm

Comment on lines 235 to 243
1. Create a new file called `index.ts` in your project folder:

To read a token's metadata:

```python filename="example.py"
async def get_token_data(
token_client: AptosTokenClient, token_addr: AccountAddress
) -> dict[str, str]:
token = (await token_client.read_object(token_addr)).resources[Token]
return {
"collection": str(token.collection),
"description": str(token.description),
"name": str(token.name),
"uri": str(token.uri),
"index": str(token.index),
}
```bash filename="Terminal"
touch index.ts
```

</Tabs.Tab>
</Tabs>
<Callout type="info">
**Windows users:** Use `type nul > index.ts` in Command Prompt.
</Callout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Tabs here? one for mac / linux and another for windows?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, I've just updated and replaced three sections with the Tabs component:

  • In the "Create tsconfig.json" section
  • In the "Configure Environment Variables" section
  • In the "Adding index.ts" section

Comment on lines 200 to 202
<Callout type="warning">
Remember to save your file after adding the configuration!
</Callout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Remove

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did a couple user interviews and found that several folks we interviewed forgot to save and ended up confused, so that's what inspired that callout. I think it's worth keeping in the "Your First NFT" especially since NFT creators aren't necessarily technical, but may be using AI to help them get by (meaning when they miss small steps like this it's hard for them to notice why if they've already refocused on another file).

Comment on lines 173 to 177
1. Create a new TypeScript configuration file:

const committedTxn = await aptos.signAndSubmitTransaction({
signer: alice,
transaction: mintTokenTransaction,
});
```bash filename="Terminal"
touch tsconfig.json
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Tabs here, one tab for mac os / linux and another for windows?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you

Comment on lines 26 to 28
- **Collection Creation**: A "collection" is a grouping of digital assets. We'll create a new collection under Alice's account.
- **Minting a Digital Asset**: Once the collection is in place, we'll mint a new digital asset (NFT) under that collection.
- **Transferring a Digital Asset**: Finally, we'll transfer the newly minted asset from Alice to Bob.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove these steps are mentioned above already, repetitive to have both

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tippi-fifestarr and others added 4 commits March 4, 2025 15:49
Thanks

Co-authored-by: Andrew Hariri <hariria@usc.edu>
Co-authored-by: Andrew Hariri <hariria@usc.edu>
@tippi-fifestarr
Copy link
Collaborator Author

Andrew, I've reviewed this once more and think I've resolved everything @hariria, can you take another look?


---
**Congrats!**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol maybe let's remove, looks strange

Comment on lines 208 to 219
1. Create a `.env` file by running:

<Tabs items={["TypeScript", "Python"]}>
<Tabs items={["Mac/Linux", "Windows"]}>
<Tabs.Tab>

```ts filename="example.ts"
await aptos.fundAccount({
accountAddress: alice.accountAddress,
amount: 100_000_000,
});
await aptos.faucet.fundAccount({
accountAddress: bob.accountAddress,
amount: 100_000_000,
});
```

```bash filename="Terminal"
touch .env
```
</Tabs.Tab>
<Tabs.Tab>

```python filename="example.py"
bob_fund = faucet_client.fund_account(alice.address(), 100_000_000)
alice_fund = faucet_client.fund_account(bob.address(), 100_000_000)
```

```bash filename="Terminal"
type nul > .env
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip this? I think we should assume that the user knows how to make a new file on their machine. Ideally it just looks like "Create a .env file with the following:"

Comment on lines 168 to 183
1. Create a new TypeScript configuration file:

<Tabs items={["TypeScript", "Python"]}>
<Tabs items={["Mac/Linux", "Windows"]}>
<Tabs.Tab>

```ts filename="example.ts"
const alice = Account.generate();
const bob = Account.generate();
```

```bash filename="Terminal"
touch tsconfig.json
```
</Tabs.Tab>
<Tabs.Tab>

```python filename="example.py"
alice = Account.generate()
bob = Account.generate()
```

```bash filename="Terminal"
type nul > tsconfig.json
```
</Tabs.Tab>
</Tabs>

<Callout type="info">
Note that this only generates the local keypair. After generating the keypair and public address, the account still does not exist on-chain.
2. Open the `tsconfig.json` file and add the following configuration:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip this? I think we should assume that the user knows how to make a new file on their machine. Ideally it just looks like "Create a tsconfig file with the following:"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed the Tabs from "create index.ts file" as well.

Comment on lines 200 to 202
<Callout type="warning">
Remember to save your file after adding the configuration!
</Callout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems extraneous

Comment on lines 230 to 232
<Callout type="warning">
Remember to save your `.env` file after adding the configuration!
</Callout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Extraneous

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they gone

Copy link
Collaborator

@hariria hariria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, a couple nits


Each object created from the `aptos_token.move` contract is a distinct asset. The assets owned by a user are stored separately from the user's account. To check if a user owns an object, check the object's owner:
- **Node.js**: Make sure you have Node.js (version 16 or later) and npm installed.
- **Aptos CLI (Optional)**: Having the [Aptos CLI](https://aptos.dev/cli-tools/aptos-cli-tool/install-aptos-cli) can be helpful if you want to inspect on-chain data directly, but it's not required for this tutorial.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: rm

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the prerequisites section 👍

@tippi-fifestarr tippi-fifestarr merged commit 3a17d18 into aptos-labs:main Mar 15, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants