v0.1.1-pre.003-fix.001

This commit is contained in:
2026-08-14 15:40:48 +02:00
parent 75e5ec047f
commit 4a86a76ca8
6 changed files with 151 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
# file: crates/ksp-core-lib/Cargo.toml
# version: 2
# version: 3
[package]
name = "ksp-core-lib"
@@ -8,7 +8,7 @@ edition.workspace = true
repository.workspace = true
[dependencies]
solana-pubkey = { version = "4.3.0", default-features = false }
solana-pubkey.workspace = true
[lints]
workspace = true

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-core-lib/src/program_ids.rs
// version: 1
// version: 2
const DOMAIN_SOLANA: &str = "solana";
const FAMILY_CONSENSUS: &str = "consensus";
@@ -446,7 +446,9 @@ pub const fn entries() -> &'static [crate::ProgramIdEntry] {
/// Returns a lazy view of Program IDs matching all configured filter axes.
pub fn program_ids<'a>(filter: crate::ProgramIdFilter<'a>) -> impl std::iter::Iterator<Item = &'static crate::ProgramIdEntry> + 'a {
return PROGRAM_ID_ENTRIES.iter().filter(move |entry| filter.matches(entry));
return PROGRAM_ID_ENTRIES.iter().filter(move |entry| {
return filter.matches(entry);
});
}
/// Returns all Solana core/native Program IDs, including loaders, precompiles and enshrined programs.
@@ -472,13 +474,17 @@ pub fn program_ids_by_protocol<'a>(protocol: &'a str) -> impl std::iter::Iterato
/// Finds one registered Program ID by its canonical Base58 representation.
#[must_use]
pub fn find_program_id(program_id: &str) -> std::option::Option<&'static crate::ProgramIdEntry> {
return PROGRAM_ID_ENTRIES.iter().find(|entry| entry.program_id() == program_id);
return PROGRAM_ID_ENTRIES.iter().find(|entry| {
return entry.program_id() == program_id;
});
}
/// Finds one registered Program ID by its typed Solana representation.
#[must_use]
pub fn find_program_pubkey(program_id: &crate::Pubkey) -> std::option::Option<&'static crate::ProgramIdEntry> {
return PROGRAM_ID_ENTRIES.iter().find(|entry| entry.pubkey() == *program_id);
return PROGRAM_ID_ENTRIES.iter().find(|entry| {
return entry.pubkey() == *program_id;
});
}
#[cfg(test)]