lssa/lee/state_machine/src/encoding/public_transaction.rs

19 lines
506 B
Rust
Raw Normal View History

use crate::{PublicTransaction, error::LeeError, 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 {
2026-03-03 23:21:08 +03:00
#[must_use]
2025-08-12 13:10:46 -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-08-12 13:10:46 -03:00
}
pub fn from_bytes(bytes: &[u8]) -> Result<Self, LeeError> {
Ok(borsh::from_slice(bytes)?)
2025-08-12 13:10:46 -03:00
}
}