ScriptPurpose
Each redemption in a transaction has a ScriptPurpose with the following 4 variants:
MintingSpendingRewardingCertifying
ScriptPurpose::Rewarding and ScriptPurpose::Certifying are identical to StakingPurpose::Rewarding and StakingPurpose::Certifying respectively, but the use cases are different. StakingPurpose is used for switching between rewarding and certifying within a given staking script. ScriptPurpose is used to see what other scripts are being used in the same transaction (see tx.redeemers).
Associated functions
from_data
ScriptPurpose::from_data(data: Data) -> ScriptPurpose
new_minting
ScriptPurpose::new_minting(mph: MintingPolicyHash) -> ScriptPurpose::Minting
new_spending
ScriptPurpose::new_spending(output_id: TxOutputId) -> ScriptPurpose::Spending
new_rewarding
ScriptPurpose::new_rewarding(staking_credential: StakingCredential) -> ScriptPurpose::Rewarding
new_certifying
ScriptPurpose::new_certifying(dcert: DCert) -> ScriptPurpose::Certifying
Getters
ScriptPurpose::Minting
policy_hash
Returnt the MintingPolicyHash of the UTxO whose minting or burning is being validated.
minting_script_purpose.policy_hash -> MintingPolicyHash
ScriptPurpose::Spending
output_id
Returns the TxOutputId of the UTxO whose spending is being validated.
spending_script_purpose.output_id -> TxOutputId
ScriptPurpose::Rewarding
credential
Returns the StakingCredential for which rewards are being withdrawn.
rewarding_script_purpose.credential -> StakingCredential
ScriptPurpose::Certifying
dcert
Returns the current stake certifying action as a DCert.
certifying_script_purpose.dcert -> DCert
Operators
==
ScriptPurpose == ScriptPurpose -> Bool
!=
ScriptPurpose != ScriptPurpose -> Bool
Methods
serialize
script_purpose.serialize() -> ByteArray