new events

This commit is contained in:
Hardhat Chad
2025-06-24 16:38:06 -05:00
parent 68f83e8a2c
commit ab57634f7f
6 changed files with 33 additions and 0 deletions

View File

@@ -260,3 +260,23 @@ event!(WithdrawEvent);
event!(UncommitEvent);
event!(MineEvent);
event!(CloseEvent);
#[cfg(test)]
mod tests {
use super::*;
use base64::{prelude::BASE64_STANDARD, Engine};
#[test]
fn test_parse_commit_event() {
// Create sample return data
let data = "BQAAAAAAAAB9607Qp9I2VxNo2rSPHAz/tR2pJzGu9om7qHP71TpKqciMAwAAAAAAAAAAAAAAAAA2CwUAAAAAAADodkgXAAAAAAAAAAAAAAAAAAAAAAAAADYLBQAAAAAAAB7cDBcAAAAAypo7AAAAAMMQW2gAAAAA";
let bytes = BASE64_STANDARD.decode(data).unwrap();
// Parse into CommitEvent
let event: &SwapEvent = bytemuck::try_from_bytes(&bytes).unwrap();
// Verify fields
println!("{:?}", event);
assert!(false);
}
}

View File

@@ -93,6 +93,8 @@ pub fn mine(signer: Pubkey, id: u64, amount: u64) -> Instruction {
}
}
// let [signer_info, block_info, commitment_info, market_info, miner_info, mint_info, permit_info, sender_info, system_program, token_program] =
pub fn commit(
signer: Pubkey,
amount: u64,