pub struct TxInfo<DL> {
pub data_loader: DL,
pub consensus: Arc<Consensus>,
pub tx_env: Arc<TxVerifyEnv>,
pub binaries_by_data_hash: HashMap<Byte32, (usize, LazyData)>,
pub binaries_by_type_hash: HashMap<Byte32, Binaries>,
pub lock_groups: BTreeMap<Byte32, ScriptGroup>,
pub type_groups: BTreeMap<Byte32, ScriptGroup>,
pub outputs: Vec<CellMeta>,
}
Expand description
Information that is either passed as the context of the transaction, or can be derived from the transaction.
Fields§
§data_loader: DL
Data loader.
consensus: Arc<Consensus>
Chain consensus parameters
tx_env: Arc<TxVerifyEnv>
Transaction verification environment
binaries_by_data_hash: HashMap<Byte32, (usize, LazyData)>
Potential binaries in current transaction indexed by data hash
binaries_by_type_hash: HashMap<Byte32, Binaries>
Potential binaries in current transaction indexed by type script hash
lock_groups: BTreeMap<Byte32, ScriptGroup>
Lock script groups, orders here are important
type_groups: BTreeMap<Byte32, ScriptGroup>
Type script groups, orders here are important
outputs: Vec<CellMeta>
Output cells in current transaction reorganized in CellMeta format
Implementations§
Source§impl<DL> TxInfo<DL>where
DL: CellDataProvider,
impl<DL> TxInfo<DL>where
DL: CellDataProvider,
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> TxInfo<DL>
impl<DL> TxInfo<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 TxInfo<DL>where
DL: Freeze,
impl<DL> RefUnwindSafe for TxInfo<DL>where
DL: RefUnwindSafe,
impl<DL> Send for TxInfo<DL>where
DL: Send,
impl<DL> Sync for TxInfo<DL>where
DL: Sync,
impl<DL> Unpin for TxInfo<DL>where
DL: Unpin,
impl<DL> UnwindSafe for TxInfo<DL>where
DL: UnwindSafe,
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
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>
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>
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