pub struct UpdateContext {
pub slot: Option<u64>,
pub signature: Option<String>,
pub timestamp: Option<i64>,
pub metadata: HashMap<String, Value>,
}Expand description
Context metadata for blockchain updates (accounts and instructions) This structure is designed to be extended over time with additional metadata
Fields§
§slot: Option<u64>Blockchain slot number
signature: Option<String>Transaction signature
timestamp: Option<i64>Unix timestamp (seconds since epoch) If not provided, will default to current system time when accessed
metadata: HashMap<String, Value>Additional custom metadata that can be added without breaking changes
Implementations§
Source§impl UpdateContext
impl UpdateContext
Sourcepub fn new(slot: u64, signature: String) -> Self
pub fn new(slot: u64, signature: String) -> Self
Create a new UpdateContext with slot and signature
Sourcepub fn with_timestamp(slot: u64, signature: String, timestamp: i64) -> Self
pub fn with_timestamp(slot: u64, signature: String, timestamp: i64) -> Self
Create a new UpdateContext with slot, signature, and timestamp
Sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
Get the timestamp, falling back to current system time if not set
Sourcepub fn with_metadata(self, key: String, value: Value) -> Self
pub fn with_metadata(self, key: String, value: Value) -> Self
Add custom metadata
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get metadata value
Trait Implementations§
Source§impl Clone for UpdateContext
impl Clone for UpdateContext
Source§fn clone(&self) -> UpdateContext
fn clone(&self) -> UpdateContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UpdateContext
impl Debug for UpdateContext
Source§impl Default for UpdateContext
impl Default for UpdateContext
Source§fn default() -> UpdateContext
fn default() -> UpdateContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UpdateContext
impl RefUnwindSafe for UpdateContext
impl Send for UpdateContext
impl Sync for UpdateContext
impl Unpin for UpdateContext
impl UnwindSafe for UpdateContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more