I've encountered a problem trying to reuse an old project. I'm trying to build the project but the cli throws this error at me: "this is an associated function, not a method" for using *ctx.bumps.get("treasury_account").unwrap();
I hope someone can help me. Thank you!
pub fn init_treasury(ctx: Context<InitAccounts>) -> Result<()> {
msg!("treasury account");
ctx.accounts.treasury_account.bump = *ctx.bumps.get("treasury_account").unwrap();
Ok(())
}
#[derive(Accounts)]
pub struct InitAccounts<'info> {
#[account(mut)]
pub payer: Signer<'info>,
#[account(init, payer = payer, space = 8+1, seeds=[b"treasury"], bump)]
pub treasury_account: Account<'info, TreasuryAccount>,
pub system_program: Program<'info, System>,
}
#[account]
pub struct TreasuryAccount {
pub bump: u8,
}