mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-04-17 16:43:10 +00:00
27 lines
681 B
Rust
27 lines
681 B
Rust
use crate::{
|
|
PrivacyPreservingTransaction, error::NssaError,
|
|
privacy_preserving_transaction::message::Message,
|
|
};
|
|
|
|
impl Message {
|
|
#[must_use]
|
|
pub fn to_bytes(&self) -> Vec<u8> {
|
|
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
|
|
}
|
|
|
|
pub fn from_bytes(bytes: &[u8]) -> Result<Self, NssaError> {
|
|
Ok(borsh::from_slice(bytes)?)
|
|
}
|
|
}
|
|
|
|
impl PrivacyPreservingTransaction {
|
|
#[must_use]
|
|
pub fn to_bytes(&self) -> Vec<u8> {
|
|
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
|
|
}
|
|
|
|
pub fn from_bytes(bytes: &[u8]) -> Result<Self, NssaError> {
|
|
Ok(borsh::from_slice(bytes)?)
|
|
}
|
|
}
|