use crate::builders::{get_associated_token_address, TOKEN_PROGRAM_ID};
use solana_instruction::AccountMeta;
use solana_pubkey::Pubkey;
pub const MOCK_SWAP_PROGRAM_ID: Pubkey = Pubkey::from_str_const("FwagBBXsQVcn7iAT3bGV4cHBs8oU2wnazL9Ue9BTVRru");
pub const MOCK_POOL_AUTHORITY_SEED: &[u8] = b"pool";
const MOCK_SWAP_DISCRIMINATOR: [u8; 8] = [132, 118, 185, 134, 25, 56, 106, 10];
pub fn get_mock_pool_authority() -> Pubkey {
Pubkey::find_program_address(&[MOCK_POOL_AUTHORITY_SEED], &MOCK_SWAP_PROGRAM_ID).0
}
pub fn get_mock_swap_data(amount_in: u64, amount_out: u64) -> Vec<u8> {
let mut swap_data = MOCK_SWAP_DISCRIMINATOR.to_vec();
swap_data.extend_from_slice(&amount_in.to_le_bytes());
swap_data.extend_from_slice(&amount_out.to_le_bytes());
swap_data
}
pub fn get_mock_swap_route_accounts(source_authority: Pubkey, usd_mint: Pubkey, btc_mint: Pubkey) -> Vec<AccountMeta> {
let pool_authority = get_mock_pool_authority();
vec![
AccountMeta::new(get_associated_token_address(&source_authority, &usd_mint), false), AccountMeta::new_readonly(source_authority, false), AccountMeta::new(get_associated_token_address(&pool_authority, &usd_mint), false), AccountMeta::new(get_associated_token_address(&pool_authority, &btc_mint), false), AccountMeta::new(get_associated_token_address(&source_authority, &btc_mint), false), AccountMeta::new_readonly(pool_authority, false), AccountMeta::new_readonly(TOKEN_PROGRAM_ID, false), ]
}