Skip to content

Commit

Permalink
removed top level async and added filename info
Browse files Browse the repository at this point in the history
  • Loading branch information
ubadineke committed Sep 17, 2024
1 parent 45df831 commit 3ebd112
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions content/courses/tokens-and-nfts/token-program-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ if you like, or find a friend who has a devnet account!

Create a new file `delegate-tokens.ts`

```typescript
```typescript filename="delegate-tokens.ts"
import "dotenv/config";
import {
getExplorerLink,
Expand All @@ -210,7 +210,6 @@ const delegate = new PublicKey("YOUR_DELEGATE_HERE");
// Substitute in your token mint account
const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");

(async () => {
// Get or create the source and destination token accounts to store this token
const sourceTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
Expand Down Expand Up @@ -238,7 +237,6 @@ const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");
"devnet",
)}`,
);
})();
```

Run the script using `npx esrun delegate-tokens.ts`. You should see:
Expand All @@ -256,7 +254,7 @@ delegated amount to 0.

Create a new file `revoke-token.ts`

```typescript
```typescript filename="revoke-token.ts"
import "dotenv/config";
import {
getExplorerLink,
Expand All @@ -283,7 +281,6 @@ const delegate = new PublicKey("YOUR_DELEGATE_HERE");
// Substitute in your token mint account
const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");

(async () => {
// Get or create the source and destination token accounts to store this token
const sourceTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
Expand All @@ -306,7 +303,6 @@ const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");
"devnet",
)}`,
);
})();
```

Run the script using `npx esrun revoke-tokens.ts`. You should see:
Expand All @@ -324,7 +320,7 @@ circulation.

Create a new file `burn-tokens.ts`

```typescript
```typescript filename="burn-tokens.ts"
import "dotenv/config";
import {
getExplorerLink,
Expand All @@ -345,7 +341,6 @@ console.log(
const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");

// Get the account where the user stores these tokens
(async () => {
const sourceTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
user,
Expand All @@ -372,7 +367,6 @@ const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");
"devnet",
)}`,
);
})();
```

Run the script using `npx esrun burn-tokens.ts`. You should see:
Expand Down

0 comments on commit 3ebd112

Please sign in to comment.