From 97a4c15b7f8e001f6b9f13565a4dbc32827a1ee3 Mon Sep 17 00:00:00 2001 From: Jeff Wood Date: Sat, 24 Aug 2024 03:12:35 +0000 Subject: [PATCH 1/3] Update the Token Extensions Program link --- content/courses/tokens-and-nfts/token-program.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/courses/tokens-and-nfts/token-program.md b/content/courses/tokens-and-nfts/token-program.md index 08794cf32..fdb4b999a 100644 --- a/content/courses/tokens-and-nfts/token-program.md +++ b/content/courses/tokens-and-nfts/token-program.md @@ -28,7 +28,7 @@ description: - Creating Token Mints and Token Accounts requires allocating **rent** in SOL. The rent for a Token Account can be refunded when the account is closed. Additionally, tokens created with the - [Token Extensions Program](/developers/courses/token-extensions-for-mints/close-mint) + [Token Extensions Program](/content/courses/token-extensions/close-mint) can also close Token Mints. ### Lesson From 2ba6531b7f3723321a0b5c1ae8b072add7f9ad54 Mon Sep 17 00:00:00 2001 From: wuuer Date: Fri, 27 Sep 2024 09:59:44 +0800 Subject: [PATCH 2/3] sync token-program.md from main --- content/courses/tokens-and-nfts/token-program.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/courses/tokens-and-nfts/token-program.md b/content/courses/tokens-and-nfts/token-program.md index fdb4b999a..08794cf32 100644 --- a/content/courses/tokens-and-nfts/token-program.md +++ b/content/courses/tokens-and-nfts/token-program.md @@ -28,7 +28,7 @@ description: - Creating Token Mints and Token Accounts requires allocating **rent** in SOL. The rent for a Token Account can be refunded when the account is closed. Additionally, tokens created with the - [Token Extensions Program](/content/courses/token-extensions/close-mint) + [Token Extensions Program](/developers/courses/token-extensions-for-mints/close-mint) can also close Token Mints. ### Lesson From a4843f48f847a5a07049321e0a0eba81b43c41d2 Mon Sep 17 00:00:00 2001 From: wuuer Date: Fri, 27 Sep 2024 10:52:17 +0800 Subject: [PATCH 3/3] change "mint" to "token mint account". add a typescript code example for using an account on devnet while calling "initializeKeypair" in the section [2. Run validator node] add a typescript code example for importing our new function in the section [3. Create a mint with close authority] change "const mintInfo" to "let mintInfo" because "mintInfo" is used again in the "CLOSE MINT" code part. --- .../courses/token-extensions/close-mint.md | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/content/courses/token-extensions/close-mint.md b/content/courses/token-extensions/close-mint.md index f2751b852..53ea110bb 100644 --- a/content/courses/token-extensions/close-mint.md +++ b/content/courses/token-extensions/close-mint.md @@ -198,10 +198,10 @@ await setAuthority( ## Lab -In this lab, we'll create a mint with the `close mint` extension. We will then -mint some of the tokens and see what happens when we try to close it with a -non-zero supply (hint, the close transaction will fail). Lastly, we will burn -the supply and close the account. +In this lab, we'll create a token mint account with the `close mint` extension. +We will then mint some of the tokens and see what happens when we try to close +it with a non-zero supply (hint, the close transaction will fail). Lastly, we +will burn the supply and close the account. ### 1. Getting Started @@ -304,6 +304,14 @@ running `solana config get` in your terminal. And then go to address. You can get your address from running `solana address` in your terminal. +For example, assuming `keypairPath` is `/home/.config/solana/id.json` + +```typescript +const payer = initializeKeypair(connection, { + keypairPath: "/home/.config/solana/id.json", +}); +``` + ### 3. Create a mint with close authority Let's create a closable mint by creating the function `createClosableMint` in a @@ -399,7 +407,13 @@ export async function createClosableMint( ``` Now let's call this function in `src/index.ts`. First you'll need to import our -new function. Then paste the following under the right comment section: +new function by uncommenting the 3rd line. + +```ts +import { createClosableMint } from "./create-mint"; +``` + +Then paste the following under the right comment section: ```ts // CREATE A MINT WITH CLOSE AUTHORITY @@ -470,7 +484,7 @@ Underneath the minting functions, add the following code block: /** * Get mint information to verify supply */ -const mintInfo = await getMint( +let mintInfo = await getMint( connection, mintKeypair.publicKey, "finalized", @@ -591,7 +605,7 @@ Putting this all together we get: ```ts // CLOSE MINT -const mintInfo = await getMint( +mintInfo = await getMint( connection, mintKeypair.publicKey, "finalized",