Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1367 from shungo0222/patch-9
Browse files Browse the repository at this point in the history
Update Lesson_6_Give_Your_Token_Identity.md
  • Loading branch information
AlmostEfficient authored Nov 17, 2022
2 parents 5a768c7 + da949f2 commit 5b8fb04
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Solana_Core/en/Core_2/Lesson_6_Give_Your_Token_Identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ npm install @metaplex-foundation/js fs
npm install @metaplex-foundation/mpl-token-metadata
```

We'll be using the Metaplex SDK to add the metadata and the `fs` library is so we can read the token logo image. Create a new folder called `assets` and add in your logo. This will be on the testnet so have fun with it! I'm going with a pizza emoji so I named my file pizza.png lol
We'll be using the Metaplex SDK to add the metadata and the `fs` library so we can read the token logo image. Create a new folder called `assets` and add your logo. This will be on the testnet so have fun with it! I'm going with a pizza emoji so I named my file pizza.png lol

Metaplex will be doing all the heavy lifting for us so add these imports at the top in `index.ts`:
```ts
Expand All @@ -15,7 +15,6 @@ import {
keypairIdentity,
bundlrStorage,
toMetaplexFile,
findMetadataPda,
} from "@metaplex-foundation/js"
import {
DataV2,
Expand Down Expand Up @@ -71,7 +70,7 @@ async function createTokenMetadata(
console.log("metadata uri:", uri)

// get metadata account address
const metadataPDA = await findMetadataPda(mint)
const metadataPDA = metaplex.nfts().pdas().metadata({mint})

// onchain metadata format
const tokenMetadata = {
Expand Down Expand Up @@ -136,9 +135,9 @@ Generally what I try to do is:
- search/ask in discord (metaplex, anchor, etc)
- search/ask on stackexchange
- look through the project/program repo, if you're trying to figure out how to set up instructions for a program try to reference the tests
- alternatively, if there's no tests to reference copy/paste github and hope to find a reference somewhere
- alternatively, if there are no tests to reference copy/paste GitHub and hope to find a reference somewhere

Hopefully that gives you an idea of how the pioneers do it :)
Hopefully, that gives you an idea of how the pioneers do it :)

Back to our regularly scheduled building!

Expand Down Expand Up @@ -195,7 +194,7 @@ Create Metadata Account: https://explorer.solana.com/tx/4w8XEGCJY82MnBnErW9F5r1i
Finished successfully
```

Everything necessary has been done all at once! Feel free to hit the Arweave links - it's like decentralised & permanent AWS S3/Google Cloud storage and will show you what the uploaded assets look like.
Everything necessary has been done all at once! Feel free to hit the Arweave links - it's like decentralized & permanent AWS S3/Google Cloud storage and will show you what the uploaded assets look like.

If you head back to your token mint account on the explorer, you'll see the fancy new icon and name. Here's mine:

Expand All @@ -204,7 +203,7 @@ If you head back to your token mint account on the explorer, you'll see the fanc
As a wise philosopher once said,
![](https://media.tenor.com/Da1ZhyJ_Ew8AAAAC/spider-man-pizza-time.gif)

One of the coolenst parts of the token metadata program is how easy it is to update. All you need to do is change the transaction from `createCreateMetadataAccountV2Instruction` to `createUpdateMetadataAccountV2Instruction`:
One of the coolest parts of the token metadata program is how easy it is to update. All you need to do is change the transaction from `createCreateMetadataAccountV2Instruction` to `createUpdateMetadataAccountV2Instruction`:
```ts
async function updateTokenMetadata(
connection: web3.Connection,
Expand Down

0 comments on commit 5b8fb04

Please sign in to comment.