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

18 lines
492 B
Rust
Raw Normal View History

use crate::{PublicTransaction, error::NssaError, public_transaction::Message};
2025-08-12 13:10:46 -03:00
impl Message {
pub(crate) fn to_bytes(&self) -> Vec<u8> {
2025-11-25 09:40:46 +02:00
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
2025-08-12 13:10:46 -03:00
}
}
impl PublicTransaction {
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-08-12 13:10:46 -03:00
}
2025-08-12 22:35:07 -03:00
pub fn from_bytes(bytes: &[u8]) -> Result<Self, NssaError> {
Ok(borsh::from_slice(bytes)?)
2025-08-12 13:10:46 -03:00
}
}