-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from 0xPolygonMiden/frisitano-compiled-transac…
…tion Implement CompiledTransaction
- Loading branch information
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use super::{AccountId, Digest, Note, Vec}; | ||
use miden_core::Program; | ||
|
||
/// Resultant object of compiling a set of note scripts in the context of an account. | ||
/// The CompiledTransaction does not contain any account data, it is passed to a component | ||
/// that will do the required data lookups before processing the transaction further. | ||
/// Contains: | ||
/// - account_id: the account that the transaction was executed against. | ||
/// - consumed_notes: a list of consumed notes. | ||
/// - tx_script_root: optional MAST root for the transaction script. | ||
/// - tx_program: an executable program describing the transaction. | ||
pub struct CompiledTransaction { | ||
account_id: AccountId, | ||
consumed_notes: Vec<Note>, | ||
tx_script_root: Option<Digest>, | ||
tx_program: Program, | ||
} | ||
|
||
impl CompiledTransaction { | ||
/// Creates a new CompiledTransaction object. | ||
pub fn new( | ||
account_id: AccountId, | ||
consumed_notes: Vec<Note>, | ||
tx_script_root: Option<Digest>, | ||
tx_program: Program, | ||
) -> Self { | ||
Self { | ||
account_id, | ||
consumed_notes, | ||
tx_script_root, | ||
tx_program, | ||
} | ||
} | ||
|
||
// ACCESSORS | ||
// -------------------------------------------------------------------------------------------- | ||
|
||
/// Returns the account id. | ||
pub fn account_id(&self) -> AccountId { | ||
self.account_id | ||
} | ||
|
||
/// Returns the consumed notes. | ||
pub fn consumed_notes(&self) -> &[Note] { | ||
&self.consumed_notes | ||
} | ||
|
||
/// Returns the transaction script root. | ||
pub fn tx_script_root(&self) -> Option<Digest> { | ||
self.tx_script_root | ||
} | ||
|
||
/// Returns the transaction program. | ||
pub fn tx_program(&self) -> &Program { | ||
&self.tx_program | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
use super::{AccountId, Digest, Felt, Hasher, StarkField, Vec, Word}; | ||
use super::{notes::Note, AccountId, Digest, Felt, Hasher, StarkField, Vec, Word}; | ||
|
||
mod compiled_tx; | ||
mod consumed_note; | ||
mod created_note; | ||
mod proven_tx; | ||
|
||
pub use compiled_tx::CompiledTransaction; | ||
pub use consumed_note::ConsumedNoteInfo; | ||
pub use created_note::CreatedNoteInfo; | ||
pub use proven_tx::ProvenTransaction; |