Skip to content

Commit

Permalink
Merge pull request #38 from v1xingyue/patch-3
Browse files Browse the repository at this point in the history
补充 createMint 参数
  • Loading branch information
DaviRain-Su authored Sep 12, 2023
2 parents 3ff4c7e + 4f4c47d commit f70cdb5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/Solana-Co-Learn/module2/spl-token/the-token-program/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
```

Expand All @@ -89,6 +97,11 @@ const tokenMint = await createMint(
- `freezeAuthority` - 被授权冻结代币的账户。如果你不想冻结代币,请将其设置为`null`
- `decimals` - 指定代币所需的小数精度

可选参数:
- newToken 生成token 的 account地址,为空,将默认生成一个
- null 为 confirmOptions ,按照默认即可
- TOKEN_PROGRAM_ID token 程序的ID

完成这个步骤后,你可以继续以下步骤:

- 创建关联的`Token`账户
Expand Down

0 comments on commit f70cdb5

Please sign in to comment.