diff --git a/clients/rust/src/lib.rs b/clients/rust/src/lib.rs index 0d062b66..08cf8ece 100644 --- a/clients/rust/src/lib.rs +++ b/clients/rust/src/lib.rs @@ -27,6 +27,7 @@ pub enum InstructionName { SetAndVerifyCollection, MintToCollectionV1, SetDecompressibleState, + UpdateMetadata, } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -54,7 +55,7 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { [82, 104, 152, 6, 149, 111, 100, 13] => InstructionName::SetDecompressibleState, // `SetDecompressableState` instruction mapped to `SetDecompressibleState` instruction [18, 135, 238, 168, 246, 195, 61, 115] => InstructionName::SetDecompressibleState, - + [170, 182, 43, 239, 97, 78, 225, 186] => InstructionName::UpdateMetadata, _ => InstructionName::Unknown, } } diff --git a/clients/rust/src/traits.rs b/clients/rust/src/traits.rs index 886eda94..7ed2803e 100644 --- a/clients/rust/src/traits.rs +++ b/clients/rust/src/traits.rs @@ -1,5 +1,5 @@ #![allow(clippy::derivable_impls)] -use solana_program::keccak; +use solana_program::{keccak, pubkey::Pubkey}; use crate::types::{LeafSchema, UpdateArgs, Version}; @@ -33,6 +33,42 @@ impl LeafSchema { LeafSchema::V1 { .. } => Version::V1, } } + + pub fn id(&self) -> Pubkey { + match self { + LeafSchema::V1 { id, .. } => *id, + } + } + + pub fn owner(&self) -> Pubkey { + match self { + LeafSchema::V1 { owner, .. } => *owner, + } + } + + pub fn delegate(&self) -> Pubkey { + match self { + LeafSchema::V1 { delegate, .. } => *delegate, + } + } + + pub fn nonce(&self) -> u64 { + match self { + LeafSchema::V1 { nonce, .. } => *nonce, + } + } + + pub fn data_hash(&self) -> [u8; 32] { + match self { + LeafSchema::V1 { data_hash, .. } => *data_hash, + } + } + + pub fn creator_hash(&self) -> [u8; 32] { + match self { + LeafSchema::V1 { creator_hash, .. } => *creator_hash, + } + } } impl Default for LeafSchema { diff --git a/programs/bubblegum/program/src/state/leaf_schema.rs b/programs/bubblegum/program/src/state/leaf_schema.rs index 26a5563f..6709efd3 100644 --- a/programs/bubblegum/program/src/state/leaf_schema.rs +++ b/programs/bubblegum/program/src/state/leaf_schema.rs @@ -92,6 +92,18 @@ impl LeafSchema { } } + pub fn owner(&self) -> Pubkey { + match self { + LeafSchema::V1 { owner, .. } => *owner, + } + } + + pub fn delegate(&self) -> Pubkey { + match self { + LeafSchema::V1 { delegate, .. } => *delegate, + } + } + pub fn nonce(&self) -> u64 { match self { LeafSchema::V1 { nonce, .. } => *nonce,