v0.4.8-pre.005
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
// file: kb-lib/src/decoder/metadata/solana_program_metadata.rs
|
||||
// version: 3
|
||||
// version: 5
|
||||
|
||||
//! Public Solana Program Metadata models, account decoders and reserved instruction decoder.
|
||||
//! Public Solana Program Metadata models and exact account and instruction decoders.
|
||||
|
||||
mod account;
|
||||
mod constants;
|
||||
mod decoder;
|
||||
mod instruction;
|
||||
mod model;
|
||||
|
||||
/// Error returned while decoding a Solana Program Metadata account.
|
||||
@@ -31,6 +33,8 @@ pub use self::constants::DC_METADATA_SPM_MAX_ACCOUNT_BYTES;
|
||||
pub use self::constants::DC_METADATA_SPM_METADATA_HEADER_BYTES;
|
||||
/// Exact byte length of one Solana Program Metadata seed.
|
||||
pub use self::constants::DC_METADATA_SPM_SEED_BYTES;
|
||||
/// Exact decoder for Solana Program Metadata instructions and account snapshots.
|
||||
pub use self::decoder::DcMetadataSolanaProgramMetadataDecoder;
|
||||
/// Solana Program Metadata account discriminator.
|
||||
pub use self::model::DcMetadataSpmAccountDiscriminator;
|
||||
/// Compression declared for metadata content.
|
||||
@@ -52,37 +56,47 @@ pub use self::model::DcMetadataSpmProgramError;
|
||||
/// Exact fixed-size metadata seed.
|
||||
pub use self::model::DcMetadataSpmSeed;
|
||||
|
||||
/// Decoder reserved for Solana Program Metadata instructions; account decoding is exposed separately.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct DcMetadataSolanaProgramMetadataDecoder;
|
||||
|
||||
impl crate::DcApiProtocolDecoder for crate::DcMetadataSolanaProgramMetadataDecoder {
|
||||
fn decoder_name(&self) -> &'static str {
|
||||
return "kb-lib.decoder.metadata.solana_program_metadata";
|
||||
}
|
||||
|
||||
fn decoder_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_observation(
|
||||
&self,
|
||||
observation: &crate::MdProgramObservation,
|
||||
) -> crate::DcApiDecoderSupport {
|
||||
if crate::DcApiProtocolDecoder::handles_program_id(self, &observation.program_id) {
|
||||
return crate::DcApiDecoderSupport::Maybe;
|
||||
}
|
||||
return crate::DcApiDecoderSupport::No;
|
||||
}
|
||||
|
||||
fn decode_observation(
|
||||
&self,
|
||||
_observation: &crate::MdProgramObservation,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdDecodedProtocolEvent>> {
|
||||
return std::result::Result::Ok(std::vec::Vec::new());
|
||||
}
|
||||
}
|
||||
/// Account contract for `Allocate`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_ALLOCATE_ACCOUNT_CONTRACTS;
|
||||
/// Account contract for `Close`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_CLOSE_ACCOUNT_CONTRACTS;
|
||||
/// Surfaces handled by the Solana Program Metadata decoder.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_DECODER_SURFACES;
|
||||
/// Maximum instruction prefix retained in hexadecimal diagnostics.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_DIAGNOSTIC_PREFIX_BYTES;
|
||||
/// Stable event schema version for decoded Solana Program Metadata instructions.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_EVENT_VERSION;
|
||||
/// Account contract for `Extend`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_EXTEND_ACCOUNT_CONTRACTS;
|
||||
/// Account contract for `Initialize`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_INITIALIZE_ACCOUNT_CONTRACTS;
|
||||
/// Current stable instruction inventory for program releases 1.0.0 and 1.0.1.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_INSTRUCTION_ENTRIES;
|
||||
/// Maximum instruction-account count accepted by the contextual decoder.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_MAX_INSTRUCTION_ACCOUNTS;
|
||||
/// Maximum retained instruction payload accepted by the contextual decoder.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_MAX_INSTRUCTION_BYTES;
|
||||
/// Program ids handled by the Solana Program Metadata decoder.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_PROGRAM_IDS;
|
||||
/// Account contract for `SetAuthority`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_SET_AUTHORITY_ACCOUNT_CONTRACTS;
|
||||
/// Account contract for `SetData`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_SET_DATA_ACCOUNT_CONTRACTS;
|
||||
/// Account contract for `SetImmutable`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_SET_IMMUTABLE_ACCOUNT_CONTRACTS;
|
||||
/// Stable Solana Program Metadata decoder surface code.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_SURFACE_CODE;
|
||||
/// Account contract for `Trim`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_TRIM_ACCOUNT_CONTRACTS;
|
||||
/// Account contract for `Write`.
|
||||
pub(crate) use self::constants::DC_METADATA_SPM_WRITE_ACCOUNT_CONTRACTS;
|
||||
/// Expected account role and privileges for one instruction position.
|
||||
pub(crate) use self::constants::DcMetadataSpmInstructionAccountContract;
|
||||
/// Canonical tracing target for the Solana Program Metadata decoder.
|
||||
pub(crate) use self::constants::TRACING_TARGET_DECODER_METADATA_SOLANA_PROGRAM_METADATA;
|
||||
/// Decodes one bounded Solana Program Metadata instruction.
|
||||
pub(crate) use self::instruction::decoder_metadata_solana_program_metadata_decode;
|
||||
/// Returns the stable entry matching one Solana Program Metadata discriminator.
|
||||
pub(crate) use self::instruction::decoder_metadata_solana_program_metadata_entry_for_discriminator;
|
||||
/// Returns the first byte of one retained Solana Program Metadata payload.
|
||||
pub(crate) use self::instruction::decoder_metadata_solana_program_metadata_payload_discriminator;
|
||||
|
||||
Reference in New Issue
Block a user