use common::HashType; use lee::{AccountId, program::Program}; use crate::{AccountIdentity, ExecutionFailureKind, WalletCore}; pub struct Bridge<'wallet>(pub &'wallet WalletCore); impl Bridge<'_> { pub async fn send_withdraw( &self, sender_account_id: AccountId, amount: u64, bedrock_account_pk: [u8; 32], ) -> Result { let program = Program::bridge(); let bridge_account_id = lee::system_bridge_account_id(); let instruction = bridge_core::Instruction::Withdraw { amount, bedrock_account_pk, }; let instruction_data = Program::serialize_instruction(instruction).expect("Instruction should serialize"); self.0 .send_pub_tx( vec![ AccountIdentity::Public(sender_account_id), AccountIdentity::PublicNoSign(bridge_account_id), ], instruction_data, &program.into(), ) .await } }