From 4f4c47d15eb3a8ee1367e174bd4f7e0dca061d24 Mon Sep 17 00:00:00 2001 From: xingyue Date: Tue, 12 Sep 2023 19:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=20createMint=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module2/spl-token/the-token-program/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/Solana-Co-Learn/module2/spl-token/the-token-program/README.md b/docs/Solana-Co-Learn/module2/spl-token/the-token-program/README.md index 8ca9ea559..ae48f8724 100644 --- a/docs/Solana-Co-Learn/module2/spl-token/the-token-program/README.md +++ b/docs/Solana-Co-Learn/module2/spl-token/the-token-program/README.md @@ -73,12 +73,20 @@ Token账户必须与用户或钱包关联。一种简便的方式是创建一个 下面是一个`createMint`的示例: ```ts + +import { createMint, TOKEN_PROGRAM_ID } from "@solana/spl-token"; + +// 生成token 的 account地址,此项为可选项 +const newToken = web3.Keypair.generate(); const tokenMint = await createMint( connection, payer, mintAuthority, freezeAuthority, decimals, + newToken, + null, + TOKEN_PROGRAM_ID ) ``` @@ -89,6 +97,11 @@ const tokenMint = await createMint( - `freezeAuthority` - 被授权冻结代币的账户。如果你不想冻结代币,请将其设置为`null`! - `decimals` - 指定代币所需的小数精度 +可选参数: +- newToken 生成token 的 account地址,为空,将默认生成一个 +- null 为 confirmOptions ,按照默认即可 +- TOKEN_PROGRAM_ID token 程序的ID + 完成这个步骤后,你可以继续以下步骤: - 创建关联的`Token`账户