Skip to content

Commit b2cc9f5

Browse files
fixed issue #497 - Code Snippet doesn't assign this object (#519)
1 parent 01d4fc4 commit b2cc9f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

code/basic-transactions/sending-spl-token/sending-spl-token.en.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const web3 = require("@solana/web3.js");
2-
const { Token } = require("@solana/spl-token");
2+
const splToken = require("@solana/spl-token");
33

44
(async () => {
55
// Connect to cluster
@@ -9,8 +9,8 @@ const { Token } = require("@solana/spl-token");
99
);
1010

1111
// Generate a new wallet keypair and airdrop SOL
12-
var fromWallet = web3.Keypair.generate();
13-
var fromAirdropSignature = await connection.requestAirdrop(
12+
const fromWallet = web3.Keypair.generate();
13+
const fromAirdropSignature = await connection.requestAirdrop(
1414
fromWallet.publicKey,
1515
web3.LAMPORTS_PER_SOL
1616
);
@@ -21,7 +21,7 @@ const { Token } = require("@solana/spl-token");
2121
const toWallet = web3.Keypair.generate();
2222

2323
// Create new token mint
24-
const mint = await Token.createMint(
24+
const mint = await splToken.createMint(
2525
connection,
2626
fromWallet,
2727
fromWallet.publicKey,
@@ -45,12 +45,12 @@ const { Token } = require("@solana/spl-token");
4545
fromTokenAccount.address,
4646
fromWallet.publicKey,
4747
[],
48-
1000000000
48+
1000000000 // it's 1 token, but in lamports
4949
);
5050

5151
// Add token transfer instructions to transaction
5252
const transaction = new web3.Transaction().add(
53-
splToken.Token.createTransferInstruction(
53+
splToken.createTransferInstruction(
5454
splToken.TOKEN_PROGRAM_ID,
5555
fromTokenAccount.address,
5656
toTokenAccount.address,

0 commit comments

Comments
 (0)