use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::instruction::{AccountMeta, Instruction};
use solana_program::pubkey::Pubkey;
use crate::program::FARMING_MINT_WRAPPER_PROGRAM_ID;
use crate::utils::sighash;
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct PreformMint {
pub amount: u64,
}
pub fn new_preform_mint(
wrapper: Pubkey,
amount: u64,
token_mint: Pubkey,
destination: Pubkey,
minter: Pubkey,
payer: Pubkey,
) -> Instruction {
let data = &PreformMint {
amount
};
let mut dsa = data.try_to_vec().unwrap();
let mut distor = sighash::sighash("global", "perform_mint").to_vec();
distor.append(&mut dsa);
Instruction {
program_id: FARMING_MINT_WRAPPER_PROGRAM_ID,
accounts: vec![
AccountMeta::new(wrapper, false),
AccountMeta::new_readonly(payer, true),
AccountMeta::new(token_mint, false),
AccountMeta::new(destination, false),
AccountMeta::new(minter, false),
AccountMeta::new_readonly(spl_token::id(), false),
],
data: distor,
}
}