logos-execution-zone/nssa/src/encoding/privacy_preserving_transaction.rs

25 lines
649 B
Rust
Raw Normal View History

use crate::{
PrivacyPreservingTransaction, error::NssaError,
privacy_preserving_transaction::message::Message,
};
2025-08-18 14:28:26 -03:00
impl Message {
2025-09-02 11:06:41 +03:00
pub fn to_bytes(&self) -> Vec<u8> {
2025-11-25 09:40:46 +02:00
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
2025-09-02 11:06:41 +03:00
}
pub fn from_bytes(bytes: &[u8]) -> Result<Self, NssaError> {
2025-11-19 09:00:32 +02:00
Ok(borsh::from_slice(bytes)?)
2025-09-02 11:06:41 +03:00
}
}
2025-09-12 15:06:49 +03:00
impl PrivacyPreservingTransaction {
2025-09-12 15:06:49 +03:00
pub fn to_bytes(&self) -> Vec<u8> {
2025-11-25 09:40:46 +02:00
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
2025-09-12 15:06:49 +03:00
}
pub fn from_bytes(bytes: &[u8]) -> Result<Self, NssaError> {
Ok(borsh::from_slice(bytes)?)
2025-09-12 15:06:49 +03:00
}
}