Sorry for a noob question but im writing a solana program without anchor. And I'm having a problem with transfering sol from pda to a wallet in a program.
pub fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8]
) -> ProgramResult {
let accounts_iter = &mut accounts.iter();
let account_user = next_account_info(accounts_iter)?;
let account_pda = next_account_info(accounts_iter)?;
let (pda, bump_seed) = Pubkey::find_program_address(&[b"stack"], program_id);
let cost = Rent::get()?.minimum_balance(300 as usize);
let create_pda_ix = system_instruction::create_account(
&account_user.key,
&account_pda,
cost,
300,
program_id,
);
invoke_signed(
&create_pda_ix,
&[account_user.clone(), account_pda.clone()],
&[&[b"stack", &[bump_seed]]],
)?;
// How do i transfer money from the pda to a user wallet
Ok(())
}
invoking a normal transaction didnt work. What do i do i cant find a native example of this problem.