0.1.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# file: kb_decoder_spl_token_2022/Cargo.toml
|
||||
# version: 7
|
||||
|
||||
[package]
|
||||
name = "kb_decoder_spl_token_2022"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
base64.workspace = true
|
||||
bs58.workspace = true
|
||||
kb_core = { path = "../kb_core" }
|
||||
kb_decoder_api = { path = "../kb_decoder_api" }
|
||||
kb_model = { path = "../kb_model" }
|
||||
kb_program_ids = { path = "../kb_program_ids" }
|
||||
kb_store_core = { path = "../kb_store_core" }
|
||||
serde_json.workspace = true
|
||||
sha2.workspace = true
|
||||
spl-elgamal-registry-interface.workspace = true
|
||||
spl-token-2022-interface.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,30 @@
|
||||
<!-- file: kb_decoder_spl_token_2022/README.md -->
|
||||
<!-- version: 4 -->
|
||||
|
||||
# kb_decoder_spl_token_2022
|
||||
|
||||
Ce crate décode la surface `spl_token_2022` afin de normaliser les événements token fondamentaux.
|
||||
|
||||
La première tranche d'audit publie `docs/SPL_TOKEN_2022_MATRIX.json`. Elle inventorie les 48 tags
|
||||
de premier niveau et les 29 types TLV de production. La résolution opérateur confirme
|
||||
`spl-token-2022-interface 3.1.1` avec `default + serde` et
|
||||
`spl-elgamal-registry-interface 0.2.1` avec `default`. Le scaffold reste volontairement inchangé
|
||||
tant que les sous-discriminants, comptes exacts et processors ne sont pas confirmés.
|
||||
|
||||
La crate opérationnelle utilise la cible de tracing canonique `kb_decoder_spl_token_2022`. Pendant
|
||||
la phase d'audit, l'appel du scaffold émet seulement un diagnostic `debug` structuré indiquant
|
||||
qu'aucun événement métier n'a encore été produit ; il ne revendique aucun décodage effectif.
|
||||
|
||||
## 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.
|
||||
- Le seul Program ID accepté sera `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`.
|
||||
- Le registre ElGamal, le programme ZK ElGamal natif et les implémentations externes de Transfer
|
||||
Hook, Token Group ou Token Metadata conservent des dispatchs et matrices séparés.
|
||||
@@ -0,0 +1,72 @@
|
||||
// file: kb_decoder_spl_token_2022/src/constants.rs
|
||||
// version: 5
|
||||
|
||||
//! Local constants for the exact Token-2022 decoder. Program identifiers live in `kb_program_ids`.
|
||||
|
||||
/// Stable Token-2022 surface code.
|
||||
pub(crate) const SURFACE_CODE: &str = "spl_token_2022";
|
||||
/// Current decoded event contract version.
|
||||
pub(crate) const TOKEN_EVENT_VERSION: u32 = 1;
|
||||
/// Maximum retained instruction payload size.
|
||||
pub(crate) const MAX_INSTRUCTION_BYTES: usize = 16_384;
|
||||
/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
|
||||
pub(crate) const MAX_METADATA_STRING_BYTES: usize = 4_096;
|
||||
/// Maximum prefix retained in diagnostics.
|
||||
pub(crate) const DIAGNOSTIC_PREFIX_BYTES: usize = 32;
|
||||
/// Maximum decoded sub-instructions in one batch.
|
||||
pub(crate) const MAX_BATCH_INSTRUCTIONS: usize = 64;
|
||||
/// Maximum total account metas consumed by one batch.
|
||||
pub(crate) const MAX_BATCH_ACCOUNTS: usize = 512;
|
||||
/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
|
||||
pub(crate) const INSTRUCTION_ENTRIES: &[(u8, &str, bool)] = &[
|
||||
(0, "initialize_mint", false),
|
||||
(1, "initialize_account", false),
|
||||
(2, "initialize_multisig", false),
|
||||
(3, "transfer", false),
|
||||
(4, "approve", false),
|
||||
(5, "revoke", false),
|
||||
(6, "set_authority", false),
|
||||
(7, "mint_to", false),
|
||||
(8, "burn", false),
|
||||
(9, "close_account", false),
|
||||
(10, "freeze_account", false),
|
||||
(11, "thaw_account", false),
|
||||
(12, "transfer_checked", false),
|
||||
(13, "approve_checked", false),
|
||||
(14, "mint_to_checked", false),
|
||||
(15, "burn_checked", false),
|
||||
(16, "initialize_account2", false),
|
||||
(17, "sync_native", false),
|
||||
(18, "initialize_account3", false),
|
||||
(19, "initialize_multisig2", false),
|
||||
(20, "initialize_mint2", false),
|
||||
(21, "get_account_data_size", false),
|
||||
(22, "initialize_immutable_owner", false),
|
||||
(23, "amount_to_ui_amount", false),
|
||||
(24, "ui_amount_to_amount", false),
|
||||
(25, "initialize_mint_close_authority", false),
|
||||
(26, "transfer_fee_extension", false),
|
||||
(27, "confidential_transfer_extension", false),
|
||||
(28, "default_account_state_extension", false),
|
||||
(29, "reallocate", false),
|
||||
(30, "memo_transfer_extension", false),
|
||||
(31, "create_native_mint", false),
|
||||
(32, "initialize_non_transferable_mint", false),
|
||||
(33, "interest_bearing_mint_extension", false),
|
||||
(34, "cpi_guard_extension", false),
|
||||
(35, "initialize_permanent_delegate", false),
|
||||
(36, "transfer_hook_extension", false),
|
||||
(37, "confidential_transfer_fee_extension", false),
|
||||
(38, "withdraw_excess_lamports", false),
|
||||
(39, "metadata_pointer_extension", false),
|
||||
(40, "group_pointer_extension", false),
|
||||
(41, "group_member_pointer_extension", false),
|
||||
(42, "confidential_mint_burn_extension", false),
|
||||
(43, "scaled_ui_amount_extension", false),
|
||||
(44, "pausable_extension", false),
|
||||
(45, "unwrap_lamports", false),
|
||||
(46, "permissioned_burn_extension", false),
|
||||
(255, "batch", false),
|
||||
];
|
||||
/// Canonical tracing target for this crate.
|
||||
pub(crate) const TRACING_TARGET: &str = "kb_decoder_spl_token_2022";
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
// file: kb_decoder_spl_token_2022/src/lib.rs
|
||||
// version: 6
|
||||
|
||||
//! Decoder crate for `spl_token_2022`.
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
mod constants;
|
||||
mod decoder;
|
||||
pub mod state;
|
||||
mod token;
|
||||
|
||||
/// Maximum prefix retained in diagnostics.
|
||||
pub(crate) use crate::constants::DIAGNOSTIC_PREFIX_BYTES;
|
||||
/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
|
||||
pub(crate) use crate::constants::INSTRUCTION_ENTRIES;
|
||||
/// Maximum total account metas consumed by one batch.
|
||||
pub(crate) use crate::constants::MAX_BATCH_ACCOUNTS;
|
||||
/// Maximum decoded sub-instructions in one batch.
|
||||
pub(crate) use crate::constants::MAX_BATCH_INSTRUCTIONS;
|
||||
/// Maximum retained instruction payload size.
|
||||
pub(crate) use crate::constants::MAX_INSTRUCTION_BYTES;
|
||||
/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
|
||||
pub(crate) use crate::constants::MAX_METADATA_STRING_BYTES;
|
||||
/// Stable Token-2022 surface code.
|
||||
pub(crate) use crate::constants::SURFACE_CODE;
|
||||
/// Current decoded event contract version.
|
||||
pub(crate) use crate::constants::TOKEN_EVENT_VERSION;
|
||||
/// Canonical tracing target for this crate.
|
||||
pub(crate) use crate::constants::TRACING_TARGET;
|
||||
/// Crate-root access to `decode` from `token`.
|
||||
pub(crate) use crate::token::decode;
|
||||
/// Crate-root access to `entry_for_tag` from `token`.
|
||||
pub(crate) use crate::token::entry_for_tag;
|
||||
/// Crate-root access to `payload_tag` from `token`.
|
||||
pub(crate) use crate::token::payload_tag;
|
||||
|
||||
/// Initial decoder implementation placeholder.
|
||||
pub use crate::decoder::SplToken2022Decoder;
|
||||
/// Crate-root access to `Token2022State` from `state`.
|
||||
pub use crate::state::Token2022State;
|
||||
/// Crate-root access to `Token2022StateKind` from `state`.
|
||||
pub use crate::state::Token2022StateKind;
|
||||
/// Crate-root access to `Token2022TlvEntry` from `state`.
|
||||
pub use crate::state::Token2022TlvEntry;
|
||||
/// Parse one Token-2022 Mint, Account, or Multisig state without interpreting extension payloads.
|
||||
pub use crate::state::parse_token_2022_state;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user