Skip to content

fix: use buyer_ata instead of buyer_token_account in mint instruction - #25

Open
0xRektified wants to merge 1 commit into
RareSkills:prodfrom
0xRektified:fix-token-sale-use-correct-buyer-ata
Open

fix: use buyer_ata instead of buyer_token_account in mint instruction#25
0xRektified wants to merge 1 commit into
RareSkills:prodfrom
0xRektified:fix-token-sale-use-correct-buyer-ata

Conversation

@0xRektified

@0xRektified 0xRektified commented Nov 11, 2025

Copy link
Copy Markdown

Issue: Incorrect account name in MintTo instruction

Description

In the mint() function code example, the MintTo instruction references buyer_token_account, but this account name doesn't match the actual account defined in the MintTokens struct.

Location

File: content/spl-token-sale-tutorial/spl-token-sale-tutorial.md

Current Code

let mint_to_instruction = MintTo {
    mint: ctx.accounts.mint.to_account_info(),
    to: ctx.accounts.buyer_token_account.to_account_info(),  // ❌ Incorrect
    authority: ctx.accounts.mint.to_account_info(),
};
Expected Code
let mint_to_instruction = MintTo {
    mint: ctx.accounts.mint.to_account_info(),
    to: ctx.accounts.buyer_ata.to_account_info(),  // ✅ Correct
    authority: ctx.accounts.mint.to_account_info(),
};

Reason

The MintTokens struct (defined later in the tutorial) uses buyer_ata as the account name:

#[derive(Accounts)]
pub struct MintTokens<'info> {
    // ...
    pub buyer_ata: Account<'info, TokenAccount>,
    // ...
}

@0xRektified

Copy link
Copy Markdown
Author

Hi @RareSkills @jeffreyscholz , gentle follow-up in case this PR slipped through. Thank you!

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

Successfully merging this pull request may close these issues.

1 participant