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

fix and improve token-program.md,token-program-advance.md and close-mint.md #342

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 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
28 changes: 21 additions & 7 deletions content/courses/token-extensions/close-mint.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -591,7 +605,7 @@ Putting this all together we get:

```ts
// CLOSE MINT
const mintInfo = await getMint(
mintInfo = await getMint(
connection,
mintKeypair.publicKey,
"finalized",
Expand Down
Loading
Loading