0.1.0
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# file: kb_decoder_anchor/Cargo.toml
|
||||
# version: 2
|
||||
|
||||
[package]
|
||||
name = "kb_decoder_anchor"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
kb_core = { path = "../kb_core" }
|
||||
kb_decoder_api = { path = "../kb_decoder_api" }
|
||||
kb_model = { path = "../kb_model" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- file: kb_decoder_anchor/README.md -->
|
||||
<!-- version: 1 -->
|
||||
|
||||
# kb_decoder_anchor
|
||||
|
||||
Ce crate fournit les outils génériques Anchor : IDL, discriminators, Borsh et événements.
|
||||
|
||||
## Rôle dans l'écosystème
|
||||
|
||||
Ce module fait partie du découpage strict de Khadhroony Bot2. Il doit conserver des dépendances limitées et ne pas contourner les interfaces communes du workspace.
|
||||
|
||||
## Règles locales
|
||||
|
||||
- Les commentaires de code restent en anglais.
|
||||
- La documentation Markdown reste en français.
|
||||
- Les exports publics sont contrôlés depuis `lib.rs` lorsque le crate expose une bibliothèque.
|
||||
- Les binaires utilisent `main.rs` avec les attributs Rust obligatoires.
|
||||
@@ -0,0 +1,5 @@
|
||||
// file: kb_decoder_anchor/src/constants.rs
|
||||
// version: 1
|
||||
|
||||
/// Canonical tracing target for this crate.
|
||||
pub(crate) const TRACING_TARGET: &str = "kb_decoder_anchor";
|
||||
@@ -0,0 +1,42 @@
|
||||
// file: kb_decoder_anchor/src/decoder.rs
|
||||
// version: 5
|
||||
|
||||
//! Decoder scaffold for the `kb_decoder_anchor` crate.
|
||||
|
||||
/// Initial decoder implementation placeholder.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AnchorDecoder;
|
||||
|
||||
impl kb_decoder_api::ProtocolDecoder for crate::AnchorDecoder {
|
||||
fn decoder_name(&self) -> &'static str {
|
||||
return "kb_decoder_anchor";
|
||||
}
|
||||
|
||||
fn decoder_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[];
|
||||
}
|
||||
|
||||
fn supports_observation(
|
||||
&self,
|
||||
observation: &kb_model::ProgramObservation,
|
||||
) -> kb_decoder_api::DecoderSupport {
|
||||
return if kb_decoder_api::ProtocolDecoder::handles_program_id(self, &observation.program_id)
|
||||
{
|
||||
kb_decoder_api::DecoderSupport::Maybe
|
||||
} else {
|
||||
kb_decoder_api::DecoderSupport::No
|
||||
};
|
||||
}
|
||||
|
||||
fn decode_observation(
|
||||
&self,
|
||||
_observation: &kb_model::ProgramObservation,
|
||||
) -> kb_core::Result<std::vec::Vec<kb_model::DecodedProtocolEvent>> {
|
||||
let _target = crate::TRACING_TARGET;
|
||||
return std::result::Result::Ok(std::vec::Vec::new());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// file: kb_decoder_anchor/src/lib.rs
|
||||
// version: 2
|
||||
|
||||
//! Decoder crate for `anchor`.
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
mod constants;
|
||||
|
||||
mod decoder;
|
||||
|
||||
/// Canonical tracing target for this crate.
|
||||
pub(crate) use crate::constants::TRACING_TARGET;
|
||||
|
||||
/// Initial decoder implementation placeholder.
|
||||
pub use crate::decoder::AnchorDecoder;
|
||||
Reference in New Issue
Block a user