-
Notifications
You must be signed in to change notification settings - Fork 133
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
My First NFT Guide Update #838
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
<Callout type="warning"> | ||
Remember to save your file after adding the configuration! | ||
</Callout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove
There was a problem hiding this comment.
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).
1. Create a new TypeScript configuration file: | ||
|
||
const committedTxn = await aptos.signAndSubmitTransaction({ | ||
signer: alice, | ||
transaction: mintTokenTransaction, | ||
}); | ||
```bash filename="Terminal" | ||
touch tsconfig.json | ||
``` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you
- **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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks Co-authored-by: Andrew Hariri <hariria@usc.edu>
Co-authored-by: Andrew Hariri <hariria@usc.edu>
Andrew, I've reviewed this once more and think I've resolved everything @hariria, can you take another look? |
|
||
--- | ||
**Congrats!** |
There was a problem hiding this comment.
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
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 | ||
``` |
There was a problem hiding this comment.
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:"
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: |
There was a problem hiding this comment.
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:"
There was a problem hiding this comment.
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.
<Callout type="warning"> | ||
Remember to save your file after adding the configuration! | ||
</Callout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems extraneous
<Callout type="warning"> | ||
Remember to save your `.env` file after adding the configuration! | ||
</Callout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Extraneous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they gone
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: rm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the prerequisites section 👍
Co-authored-by: Andrew Hariri <hariria@usc.edu>
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
pnpm fmt
?pnpm lint
?