0

I am a new developer trying to learn and dive into the Solana ecosystem. I'm currently trying to complete this lab: https://www.soldev.app/course/token-program.

I'm on step 2 of the lab, where you create a token mint. Based on the logs, the Token Mint is completing successfully, but it's failing on const mintInfo = await token.getMint(connection, mint);

Here is the function I am trying to run:

async function main() {
    const connection = new web3.Connection(web3.clusterApiUrl("devnet"))
    const user = await initializeKeypair(connection)

    const mint = await createNewMint(
        connection,
        user,
        user.publicKey,
        user.publicKey,
        2
    )

    const mintInfo = await token.getMint(connection, mint);
}

Here is the error output I'm getting:

(base) ➜  token git:(main) ✗ npm run start

> [email protected] start
> ts-node src/index.ts

bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
PublicKey: 3qPfaEpTANysCPvSEUdDFmPk9wH5nCoR9L75Q7oiWpVt
Token Mint: https://explorer.solana.com/address/6jsanoaZKCmrKkaGqbtuZNrpnwqpX9GGJgqhjyYNpmvj?cluster=devnet
TokenAccountNotFoundError
    at unpackMint (/Users/kapforty/Documents/Projects/Solana Development Course/token/node_modules/@solana/spl-token/src/state/mint.ts:95:22)
    at Object.<anonymous> (/Users/kapforty/Documents/Projects/Solana Development Course/token/node_modules/@solana/spl-token/src/state/mint.ts:82:12)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/kapforty/Documents/Projects/Solana Development Course/token/node_modules/@solana/spl-token/lib/cjs/state/mint.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

1 Answer 1

1

Try adding a "confirmed" commitment on the connection. It may just be that getMint is trying to fetch the account data before the transaction to create the account has been confirmed.

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

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.