0.5.2
This commit is contained in:
@@ -18,17 +18,32 @@ pub enum KhbbKnownProgram {
|
||||
}
|
||||
|
||||
/// Returns the known program classification for a given program id.
|
||||
pub(crate) fn classify_known_program_id(program_id: &str) -> std::option::Option<KhbbKnownProgram> {
|
||||
match program_id {
|
||||
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" => Some(KhbbKnownProgram::SplToken),
|
||||
"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" => Some(KhbbKnownProgram::SplToken2022),
|
||||
"11111111111111111111111111111111" => Some(KhbbKnownProgram::System),
|
||||
"ComputeBudget111111111111111111111111111111" => Some(KhbbKnownProgram::ComputeBudget),
|
||||
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" => {
|
||||
Some(KhbbKnownProgram::AssociatedTokenAccount)
|
||||
},
|
||||
_ => None,
|
||||
pub(crate) fn classify_known_program_id(
|
||||
program_id: &str,
|
||||
) -> std::option::Option<KhbbKnownProgram> {
|
||||
let parse_result = program_id.parse::<solana_sdk::pubkey::Pubkey>();
|
||||
let pubkey = match parse_result {
|
||||
Ok(value) => value,
|
||||
Err(_) => {
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if pubkey == crate::SPL_TOKEN_PROGRAM_ID {
|
||||
return Some(KhbbKnownProgram::SplToken);
|
||||
}
|
||||
if pubkey == crate::SPL_TOKEN_2022_PROGRAM_ID {
|
||||
return Some(KhbbKnownProgram::SplToken2022);
|
||||
}
|
||||
if pubkey == crate::SYSTEM_PROGRAM_ID {
|
||||
return Some(KhbbKnownProgram::System);
|
||||
}
|
||||
if pubkey == crate::COMPUTE_BUDGET_PROGRAM_ID {
|
||||
return Some(KhbbKnownProgram::ComputeBudget);
|
||||
}
|
||||
if pubkey == crate::ASSOCIATED_TOKEN_PROGRAM_ID {
|
||||
return Some(KhbbKnownProgram::AssociatedTokenAccount);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Detects known program mentions in a transaction log line.
|
||||
|
||||
Reference in New Issue
Block a user