logos-execution-zone/nssa/src/encoding/public_transaction.rs
2025-11-25 09:40:46 +02:00

18 lines
492 B
Rust

use crate::{PublicTransaction, error::NssaError, public_transaction::Message};
impl Message {
pub(crate) fn to_bytes(&self) -> Vec<u8> {
borsh::to_vec(&self).expect("Autoderived borsh serialization failure")
}
}
impl PublicTransaction {
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)?)
}
}