LedgerToPlutusTranslation
Advanced interoperability layer for scalus.cardano.ledger domain model.
This object provides conversion functions and utilities for working with native Scalus types instead of external library dependencies. It handles:
- Data conversion between Plutus Data and Scalus Data
- Transaction information construction for all Plutus versions
- Script context building and script purpose resolution
- Cost model translation and machine parameter setup
- Address, credential, and certificate type conversions
- Multi-asset value handling and ordering
- Governance-related type conversions (Conway era)
All functions maintain compatibility with Cardano's CDDL specifications and preserve the deterministic ordering required for script validation.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Members list
Value members
Concrete methods
Convert scalus.cardano.address.Address to scalus.ledger.api.v1.Address.
Convert scalus.cardano.address.Address to scalus.ledger.api.v1.Address.
This function converts between the comprehensive address representation used in the domain model and the simplified address representation used in Plutus script contexts.
Attributes
Convert scalus.cardano.ledger.Credential to scalus.ledger.api.v1.Credential.
Convert scalus.cardano.ledger.Credential to scalus.ledger.api.v1.Credential.
This function bridges the gap between the domain model representation and the Plutus script context representation of credentials.
Attributes
Convert Certificate to DCert for Plutus V1/V2 script contexts.
Convert Certificate to DCert for Plutus V1/V2 script contexts.
V1/V2 script contexts use a simplified certificate representation that only includes pre-Conway era certificates. Conway-era governance certificates are not supported and will cause a translation error, which is correct behavior according to the Cardano Ledger specification.
This function follows the same logic as transTxCertV1V2 and transTxCertCommon in the Cardano Ledger Haskell implementation.
Attributes
Convert governance action ID for V3 script contexts.
Convert governance action ID for V3 script contexts.
Attributes
Convert governance action for V3 script contexts.
Convert governance action for V3 script contexts.
Attributes
Create validity interval for transaction from slot configuration.
Create validity interval for transaction from slot configuration.
This function converts slot-based validity ranges to POSIX time intervals as required by Plutus script contexts. The interval bounds depend on the protocol version for backward compatibility.
Attributes
Convert multi-asset values for minting context.
Convert multi-asset values for minting context.
Minting contexts require special handling to ensure ADA is always included in the value map, even when no ADA is being minted.
Attributes
Convert multi-asset values for minting context.
Convert multi-asset values for minting context.
In Plutus V3, minting value can not contain zero ADA entry, so we handle it differently.
Attributes
Convert proposal procedure for V3 script contexts.
Convert proposal procedure for V3 script contexts.
Attributes
Convert protocol version for V3 script contexts.
Convert protocol version for V3 script contexts.
Attributes
Create a complete V2 script context from transaction and redeemer.
Create a complete V2 script context from transaction and redeemer.
Attributes
Create a complete V3 script context from transaction, redeemer, and datum.
Create a complete V3 script context from transaction, redeemer, and datum.
Attributes
Get script info for Plutus V3 contexts.
Get script info for Plutus V3 contexts.
ScriptInfo provides context-specific information about the script being executed, including relevant data like datums for spending scripts.
Attributes
Get script purpose for Plutus V1/V2 contexts from redeemer.
Get script purpose for Plutus V1/V2 contexts from redeemer.
Attributes
Get script purpose for Plutus V3 contexts from redeemer.
Get script purpose for Plutus V3 contexts from redeemer.
V3 script purposes include governance-related purposes like proposing and voting that weren't available in earlier versions.
Attributes
Convert scalus.cardano.ledger.Credential to v1.StakingCredential.
Convert scalus.cardano.ledger.Credential to v1.StakingCredential.
Staking credentials are used for delegation and reward operations. This conversion wraps the credential in the appropriate staking context.
Attributes
Convert Certificate to TxCert for Plutus V3 script contexts.
Convert Certificate to TxCert for Plutus V3 script contexts.
V3 script contexts include full support for Conway era governance features and updated certificate types.
Attributes
Create TxInInfo for Plutus V1 from transaction input and UTxO set.
Create TxInInfo for Plutus V1 from transaction input and UTxO set.
TxInInfo combines the transaction input reference with the resolved output being spent, providing complete information for script validation.
Attributes
Create TxInInfo for Plutus V2 from transaction input and UTxO set.
Create TxInInfo for Plutus V2 from transaction input and UTxO set.
V2 TxInInfo includes additional information like inline datums and reference scripts that were introduced in the Babbage era.
Attributes
Build TxInInfo for Plutus V3 script contexts.
Build TxInInfo for Plutus V3 script contexts.
Attributes
Build TxInfo for Plutus V1 script contexts.
Build TxInfo for Plutus V1 script contexts.
This function constructs the complete transaction information structure required by V1 Plutus scripts, including all inputs, outputs, certificates, and other transaction data in the correct format and order.
Attributes
Build TxInfo for Plutus V2 script contexts.
Build TxInfo for Plutus V2 script contexts.
V2 TxInfo includes additional fields like reference inputs and an associative map structure for redeemers and data.
Attributes
Build TxInfo for Plutus V3 script contexts.
Build TxInfo for Plutus V3 script contexts.
V3 TxInfo includes full Conway governance support with votes, proposal procedures, and treasury operations.
Attributes
Create TxOutRef for Plutus V3 from transaction input.
Create TxOutRef for Plutus V3 from transaction input.
TxOutRef identifies a specific output in a transaction by its ID and index.
Attributes
Create TxOut for Plutus V1 script contexts.
Create TxOut for Plutus V1 script contexts.
Attributes
Create TxOut for Plutus V2 script contexts.
Create TxOut for Plutus V2 script contexts.
Attributes
Convert scalus.cardano.ledger.Value to scalus.ledger.api.v1.Value.
Convert scalus.cardano.ledger.Value to scalus.ledger.api.v1.Value.
This function converts the domain model value representation to the Plutus script context value format, which uses nested association maps for multi-asset representation.
Attributes
Convert vote for V3 script contexts.
Convert vote for V3 script contexts.
Attributes
Convert voter for V3 script contexts.
Convert voter for V3 script contexts.
Attributes
Convert voting procedures for V3 script contexts.
Convert voting procedures for V3 script contexts.
Attributes
Process withdrawals for script context construction.
Process withdrawals for script context construction.
Withdrawals are sorted by staking credential for deterministic ordering as required by Cardano's validation rules.
Attributes
Deprecated methods
Creates MachineParams from CostModels and PlutusLedgerLanguage.
Creates MachineParams from CostModels and PlutusLedgerLanguage.
This function configures the Plutus virtual machine with the appropriate cost models and semantic variants based on the protocol version and Plutus language version. This is crucial for accurate script execution cost calculation and validation.
Value parameters
- costModels
-
Cost models for different Plutus versions
- language
-
Plutus language version (V1, V2, or V3)
- protocolVersion
-
Major protocol version for semantic variant selection
Attributes
- Returns
-
Configured MachineParams for script execution
- Deprecated
-
[Since version scalus 0.12.1]Use MachineParams.fromCostModels instead