fix: update anchor to 0.30.1 and fix breaking changes

- anchor-lang: 0.29.0 -> 0.30.1
- anchor-spl: 0.29.0 -> 0.30.1
- solana-program: 1.16.20 -> 2.x (inferred from anchor-spl)
- Fix token_prog -> token_program naming
- Fix ctx.bumps access for Anchor 0.30.x API
- Update declare_id! with new vanity address

Build now passes successfully.
This commit is contained in:
2026-04-14 15:29:55 -04:00
parent 2e8260bc8c
commit 20d1f216a0
3 changed files with 250 additions and 1101 deletions
+241 -1091
View File
File diff suppressed because it is too large Load Diff
@@ -16,6 +16,5 @@ cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = { version = "0.29.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.29.0", features = ["metadata"] }
solana-program = "=1.16.20"
anchor-lang = { version = "0.30.1", features = ["init-if-needed"] }
anchor-spl = { version = "0.30.1", features = ["metadata"] }
@@ -1,7 +1,7 @@
use anchor_lang::prelude::*;
use anchor_spl::token::{self, Burn, Mint, MintTo, Token, TokenAccount};
declare_id!("CoopCredits111111111111111111111111111111111");
declare_id!("CoopYdmSCUXqtcPPknkEHn4nSFXAiYQFMsH6orLz1XBM");
pub const DECIMALS: u8 = 6;
@@ -34,7 +34,7 @@ pub mod coop_credits {
ErrorCode::Unauthorized
);
let seeds = &[b"mint_auth", &[ctx.bumps.mint_auth]];
let seeds = &[b"mint_auth", std::slice::from_ref(&ctx.bumps.mint_auth)];
let signer = &[&seeds[..]];
let cpi = MintTo {
@@ -44,7 +44,7 @@ pub mod coop_credits {
};
token::mint_to(
CpiContext::new_with_signer(ctx.accounts.token_prog.to_account_info(), cpi, signer),
CpiContext::new_with_signer(ctx.accounts.token_program.to_account_info(), cpi, signer),
amount,
)?;
@@ -79,7 +79,7 @@ pub mod coop_credits {
};
token::burn(
CpiContext::new(ctx.accounts.token_prog.to_account_info(), cpi),
CpiContext::new(ctx.accounts.token_program.to_account_info(), cpi),
amount,
)?;
@@ -143,7 +143,7 @@ pub struct Initialize<'info> {
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
pub token_prog: Program<'info, Token>,
pub token_program: Program<'info, Token>,
pub rent: Sysvar<'info, Rent>,
}
@@ -170,7 +170,7 @@ pub struct MintToUser<'info> {
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
pub token_prog: Program<'info, Token>,
pub token_program: Program<'info, Token>,
}
#[derive(Accounts)]
@@ -196,7 +196,7 @@ pub struct BurnFromUser<'info> {
pub user: Signer<'info>,
pub system_program: Program<'info, System>,
pub token_prog: Program<'info, Token>,
pub token_program: Program<'info, Token>,
}
#[derive(Accounts)]