0
   const mint = await splToken.createMint(
            connection,
            mintAuthority
            mintAuthority.publicKey, 
            null, 
            9, 
            null,
            {},
            splToken.TOKEN_2022_PROGRAM_ID,
        );

It is same as the splToken lib

export async function createMint(
connection: Connection,
payer: Signer,
mintAuthority: PublicKey,
freezeAuthority: PublicKey | null,
decimals: number,
keypair = Keypair.generate(),
confirmOptions?: ConfirmOptions,
programId = TOKEN_PROGRAM_ID

): But I cannot run the script properly. It shows

1 Answer 1

0

You need to add splToken to your project in order to use it. For example, you might need to add the package to your project:

npm i @solana/spl-token`

And then import it as needed:

import * as splToken from '@solana/spl-token';
1
  • It worked when I use import {createMint} from '@solana/spl-token';
    – AndrewZzzz
    Commented May 22 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.