I'm getting an error while executing an initialise code in my smart contract. I'm using Anchor Framework for my code. Below is the struct and the account:
#[derive(Accounts)]
pub struct InitializeAdminList<'info> {
// Admin list PDA Account
#[account(
init,
seeds = [b"adminlist".as_ref()],
bump,
payer = authority,
space = 16 + AdminListAccount::MAX_SIZE
)]
pub admin_list_pda: Account<'info, AdminListAccount>,
#[account(mut)]
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[account]
pub struct AdminListAccount {
// Admin address List
pub admin_list: Vec<Pubkey>,
}
impl AdminListAccount {
pub const MAX_SIZE: usize = 4 + (10 * 32);
}
Below is the code in React app:
async function initializeAdminList() {
const provider = await getProvider();
/* create the program interface combining the idl, program ID, and provider */
const program = new Program(idl, programID, provider);
try {
const [adminList, bumpAdmin] =
await web3.PublicKey.findProgramAddress(
[utf8.encode("adminlist")],
program.programId
);
console.log("adminListPDA", adminList.toString(), "bump", bumpAdmin);
const trans = await program.methods
.initializeAdminList()
.accounts({
adminListPda: adminList,
authority: provider.wallet.publicKey,
systemProgram: web3.SystemProgram.programId,
})
.rpc();
console.log("trans", trans);
} catch (err) {
console.log("Transaction error: ", err);
}
}
When I run this code, I get the below error:
"Program failed to complete: Instruction passed to inner instruction is too large (12884933924 > 1280)"
Can someone explain what am I doing wrong? Thanks in advance for your help.