Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulation failed. Message: Transaction simulation failed: Error processing Instruction 0: Cross-program invocation with unauthorized signer or writable account. #3

Open
Kadamato opened this issue Sep 29, 2024 · 0 comments

Comments

@Kadamato
Copy link

Kadamato commented Sep 29, 2024

When I ran this code in test, it gave an error like this

const tx = await program.methods .createStudent(student.name, student.age) .accountsPartial({ student: studentPDA, tokenAccount: tokenAccount, mint: mintPDA, }) .rpc();

this is mint token code

`
let seeds = &["mint".as_bytes(), &[ctx.bumps.mint]];
let signer = [&seeds[..]];

    let cpi_ctx = CpiContext::new_with_signer(
        ctx.accounts.token_program.to_account_info(),
        token::MintTo {
            mint: ctx.accounts.mint.to_account_info(),
            to: ctx.accounts.token_account.to_account_info(),
            authority: ctx.accounts.mint.to_account_info(),
        },
        &signer,
    );

    token::mint_to(cpi_ctx, 1000)?;
    msg!("Minted Tokens");

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant