2025-11-19 14:28:18 +02:00
|
|
|
use borsh::{BorshDeserialize, BorshSerialize};
|
2026-02-05 16:21:08 +02:00
|
|
|
use nssa_core::account::AccountId;
|
2026-01-28 03:21:43 +03:00
|
|
|
use sha2::{Digest as _, digest::FixedOutput as _};
|
2025-11-19 14:28:18 +02:00
|
|
|
|
2026-04-02 02:39:37 -03:00
|
|
|
use crate::program_deployment_transaction::message::Message;
|
2025-10-14 17:15:04 -03:00
|
|
|
|
2025-11-19 14:28:18 +02:00
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
|
2025-10-14 17:15:04 -03:00
|
|
|
pub struct ProgramDeploymentTransaction {
|
2026-01-28 03:21:43 +03:00
|
|
|
pub message: Message,
|
2025-10-14 17:15:04 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ProgramDeploymentTransaction {
|
2026-03-03 23:21:08 +03:00
|
|
|
#[must_use]
|
2026-03-09 18:27:56 +03:00
|
|
|
pub const fn new(message: Message) -> Self {
|
2025-10-14 17:15:04 -03:00
|
|
|
Self { message }
|
|
|
|
|
}
|
2025-10-15 17:25:26 -03:00
|
|
|
|
2026-03-03 23:21:08 +03:00
|
|
|
#[must_use]
|
2026-01-24 04:05:59 +03:00
|
|
|
pub fn into_message(self) -> Message {
|
|
|
|
|
self.message
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-03 23:21:08 +03:00
|
|
|
#[must_use]
|
2026-01-28 03:21:43 +03:00
|
|
|
pub fn hash(&self) -> [u8; 32] {
|
|
|
|
|
let bytes = self.to_bytes();
|
|
|
|
|
let mut hasher = sha2::Sha256::new();
|
|
|
|
|
hasher.update(&bytes);
|
|
|
|
|
hasher.finalize_fixed().into()
|
|
|
|
|
}
|
2026-02-05 16:21:08 +02:00
|
|
|
|
2026-03-03 23:21:08 +03:00
|
|
|
#[must_use]
|
2026-03-09 18:27:56 +03:00
|
|
|
pub const fn affected_public_account_ids(&self) -> Vec<AccountId> {
|
2026-02-05 16:21:08 +02:00
|
|
|
vec![]
|
|
|
|
|
}
|
2025-10-14 17:15:04 -03:00
|
|
|
}
|