pub struct TxData<DL> {
pub rtx: Arc<ResolvedTransaction>,
pub info: Arc<TxInfo<DL>>,
}
Expand description
Immutable context data at transaction level
Fields§
§rtx: Arc<ResolvedTransaction>
ResolvedTransaction.
info: Arc<TxInfo<DL>>
Passed & derived information.
Implementations§
Source§impl<DL> TxData<DL>where
DL: CellDataProvider,
impl<DL> TxData<DL>where
DL: CellDataProvider,
Sourcepub fn new(
rtx: Arc<ResolvedTransaction>,
data_loader: DL,
consensus: Arc<Consensus>,
tx_env: Arc<TxVerifyEnv>,
) -> Self
pub fn new( rtx: Arc<ResolvedTransaction>, data_loader: DL, consensus: Arc<Consensus>, tx_env: Arc<TxVerifyEnv>, ) -> Self
Creates a new TxData structure
Sourcepub fn extract_script(&self, script: &Script) -> Result<Bytes, ScriptError>
pub fn extract_script(&self, script: &Script) -> Result<Bytes, ScriptError>
Extracts actual script binary either in dep cells.
Source§impl<DL> TxData<DL>
impl<DL> TxData<DL>
Sourcepub fn extract_referenced_dep_index(
&self,
script: &Script,
) -> Result<usize, ScriptError>
pub fn extract_referenced_dep_index( &self, script: &Script, ) -> Result<usize, ScriptError>
Extracts the index of the script binary in dep cells
Sourcepub fn find_script_group(
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32,
) -> Option<&ScriptGroup>
pub fn find_script_group( &self, script_group_type: ScriptGroupType, script_hash: &Byte32, ) -> Option<&ScriptGroup>
Finds the script group from cell deps.
Sourcepub fn select_version(
&self,
script: &Script,
) -> Result<ScriptVersion, ScriptError>
pub fn select_version( &self, script: &Script, ) -> Result<ScriptVersion, ScriptError>
Returns the version of the machine based on the script and the consensus rules.
Sourcepub fn groups(&self) -> impl Iterator<Item = (&Byte32, &ScriptGroup)>
pub fn groups(&self) -> impl Iterator<Item = (&Byte32, &ScriptGroup)>
Returns all script groups.
Sourcepub fn groups_with_type(
&self,
) -> impl Iterator<Item = (ScriptGroupType, &Byte32, &ScriptGroup)>
pub fn groups_with_type( &self, ) -> impl Iterator<Item = (ScriptGroupType, &Byte32, &ScriptGroup)>
Returns all script groups with type.
Trait Implementations§
Auto Trait Implementations§
impl<DL> Freeze for TxData<DL>
impl<DL> RefUnwindSafe for TxData<DL>where
DL: RefUnwindSafe,
impl<DL> Send for TxData<DL>
impl<DL> Sync for TxData<DL>
impl<DL> Unpin for TxData<DL>
impl<DL> UnwindSafe for TxData<DL>where
DL: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more