Skip to content

Commit

Permalink
Merge pull request #52 from metaplex-foundation/danenbm/leaf-schema-e…
Browse files Browse the repository at this point in the history
…vent

Adding `LeafSchemaEvent` struct to Rust client
  • Loading branch information
danenbm authored Oct 4, 2023
2 parents ebc25e6 + 3cfbe6b commit 77debad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions clients/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use borsh::{BorshDeserialize, BorshSerialize};
use types::{BubblegumEventType, LeafSchema, Version};

mod generated;
pub mod hash;
mod traits;
Expand Down Expand Up @@ -55,3 +58,22 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName {
_ => InstructionName::Unknown,
}
}

#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)]
pub struct LeafSchemaEvent {
pub event_type: BubblegumEventType,
pub version: Version,
pub schema: LeafSchema,
pub leaf_hash: [u8; 32],
}

impl LeafSchemaEvent {
pub fn new(version: Version, schema: LeafSchema, leaf_hash: [u8; 32]) -> Self {
Self {
event_type: BubblegumEventType::LeafSchemaEvent,
version,
schema,
leaf_hash,
}
}
}

0 comments on commit 77debad

Please sign in to comment.