Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
- Added shared `ProcedurePolicy` for AuthMultisig ([#2670](https://github.com/0xMiden/protocol/pull/2670)).
- [BREAKING] Changed `NoteType` encoding from 2 bits to 1 and makes `NoteType::Private` the default ([#2691](https://github.com/0xMiden/miden-base/issues/2691)).
- Added `BlockNumber::saturating_sub()` ([#2660](https://github.com/0xMiden/protocol/issues/2660)).
- Added `TransactionScript::from_package()` method to create `TransactionScript` from `miden-mast-package::Package` ([#2779](https://github.com/0xMiden/protocol/pull/2779)).


## 0.14.3 (2026-04-07)

Expand Down
2 changes: 2 additions & 0 deletions crates/miden-protocol/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ impl PartialBlockchainError {
pub enum TransactionScriptError {
#[error("failed to assemble transaction script:\n{}", PrintDiagnostic::new(.0))]
AssemblyError(Report),
#[error("failed to convert package to transaction script:\n{}", PrintDiagnostic::new(.0))]
TransactionScriptNotProgram(Report),
Comment thread
igamigo marked this conversation as resolved.
Outdated
}

// TRANSACTION INPUT ERROR
Expand Down
17 changes: 17 additions & 0 deletions crates/miden-protocol/src/transaction/tx_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use alloc::vec::Vec;

use miden_core::mast::MastNodeExt;
use miden_crypto::merkle::InnerNodeInfo;
use miden_mast_package::Package;

use super::{Felt, Hasher, Word};
use crate::account::auth::{PublicKeyCommitment, Signature};
use crate::errors::TransactionScriptError;
use crate::note::{NoteId, NoteRecipient};
use crate::utils::serde::{
ByteReader,
Expand Down Expand Up @@ -308,6 +310,21 @@ impl TransactionScript {
Self { mast, entrypoint }
}

/// Creates a [TransactionScript] from a [`Package`].
///
/// The package must be an executable (i.e., its target type must be
/// [`TargetType::Executable`](miden_mast_package::TargetType::Executable)).
///
/// # Errors
/// Returns an error if the package cannot be converted to an executable program.
pub fn from_package(package: &Package) -> Result<Self, TransactionScriptError> {
Comment thread
bobbinth marked this conversation as resolved.
let program = package
.try_into_program()
.map_err(TransactionScriptError::TransactionScriptNotProgram)?;

Ok(TransactionScript::new(program))
}

// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

Expand Down
Loading