v0.1.0-pre.062
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-lib/src/materializer/token/accounts.rs
|
||||
// version: 6
|
||||
// version: 7
|
||||
|
||||
//! Stable committed SPL Token mutation and ATA lifecycle projections.
|
||||
|
||||
@@ -174,9 +174,9 @@ impl crate::MtApiEventMaterializer for crate::MtTokenAccountsMaterializer {
|
||||
|
||||
fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool {
|
||||
let token_program = (event.program_id.0 == kb_program_ids::SPL_TOKEN_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_token")
|
||||
&& event.surface_code.0 == "spl.token")
|
||||
|| (event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_token_2022");
|
||||
&& event.surface_code.0 == "spl.token_2022");
|
||||
let token_mutation = token_program && MUTATION_ENTRIES.contains(&event.event_name.0.as_str());
|
||||
let ata = is_ata_event(event);
|
||||
return ACCEPTED_FAMILIES.contains(&event.event_family) && (token_mutation || ata);
|
||||
@@ -184,7 +184,7 @@ fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool {
|
||||
|
||||
fn is_ata_event(event: &crate::MdDecodedProtocolEvent) -> bool {
|
||||
return event.program_id.0 == kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_associated_token_account"
|
||||
&& event.surface_code.0 == "spl.associated_token_account"
|
||||
&& event.event_family == crate::MdEventFamily::Lifecycle
|
||||
&& ATA_LIFECYCLE_ENTRIES
|
||||
.iter()
|
||||
@@ -474,9 +474,9 @@ mod tests {
|
||||
slot: crate::MdSlot(42),
|
||||
instruction_path: crate::MdInstructionPath("1/0".to_string()),
|
||||
program_id: crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()),
|
||||
protocol_code: crate::MdProtocolCode("spl_token".to_string()),
|
||||
surface_code: crate::MdSurfaceCode("spl_token".to_string()),
|
||||
event_code: crate::MdEventCode(format!("spl_token.{entry}")),
|
||||
protocol_code: crate::MdProtocolCode("spl.token".to_string()),
|
||||
surface_code: crate::MdSurfaceCode("spl.token".to_string()),
|
||||
event_code: crate::MdEventCode(format!("spl.token.{entry}")),
|
||||
event_name: crate::MdEventName(entry.to_string()),
|
||||
event_family: family,
|
||||
source_kind: crate::MdEventSourceKind::InnerInstruction,
|
||||
@@ -510,9 +510,9 @@ mod tests {
|
||||
let mut observation = observation(entry, family, failed);
|
||||
observation.event.program_id =
|
||||
crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string());
|
||||
observation.event.protocol_code = crate::MdProtocolCode("spl_token_2022".to_string());
|
||||
observation.event.surface_code = crate::MdSurfaceCode("spl_token_2022".to_string());
|
||||
observation.event.event_code = crate::MdEventCode(format!("spl_token_2022.{entry}"));
|
||||
observation.event.protocol_code = crate::MdProtocolCode("spl.token_2022".to_string());
|
||||
observation.event.surface_code = crate::MdSurfaceCode("spl.token_2022".to_string());
|
||||
observation.event.event_code = crate::MdEventCode(format!("spl.token_2022.{entry}"));
|
||||
observation.event_key = format!("token_2022:{entry}:0");
|
||||
return observation;
|
||||
}
|
||||
@@ -554,9 +554,9 @@ mod tests {
|
||||
program_id: crate::MdProgramId(
|
||||
kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(),
|
||||
),
|
||||
protocol_code: crate::MdProtocolCode("spl_associated_token_account".to_string()),
|
||||
surface_code: crate::MdSurfaceCode("spl_associated_token_account".to_string()),
|
||||
event_code: crate::MdEventCode(format!("spl_associated_token_account.{entry}")),
|
||||
protocol_code: crate::MdProtocolCode("spl.associated_token_account".to_string()),
|
||||
surface_code: crate::MdSurfaceCode("spl.associated_token_account".to_string()),
|
||||
event_code: crate::MdEventCode(format!("spl.associated_token_account.{entry}")),
|
||||
event_name: crate::MdEventName(entry.to_string()),
|
||||
event_family: crate::MdEventFamily::Lifecycle,
|
||||
source_kind: crate::MdEventSourceKind::Instruction,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// file: kb-lib/src/materializer/token/constants.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Local constants for classic SPL Token account projections.
|
||||
|
||||
/// Stable processor name persisted by the replay ledger.
|
||||
pub(crate) const MT_TOKEN_ACCOUNTS_PROCESSOR_NAME: &str = "spl_token_accounts";
|
||||
pub(crate) const MT_TOKEN_ACCOUNTS_PROCESSOR_NAME: &str = "materializer.token.accounts";
|
||||
/// Stable projection payload contract version.
|
||||
pub(crate) const MT_TOKEN_ACCOUNTS_PROJECTION_VERSION: u32 = 3;
|
||||
/// Canonical tracing target for this component.
|
||||
|
||||
Reference in New Issue
Block a user