TxEvaluator
- class cometa.transaction_builder.evaluation.tx_evaluator.TxEvaluatorProtocol(*args, **kwargs)[source]
Bases:
ProtocolProtocol defining the interface for transaction evaluators.
Transaction evaluators calculate the execution units required for Plutus scripts in a transaction. This is essential for determining accurate transaction fees when scripts are involved.
Implement this protocol to create custom transaction evaluators (e.g., using Blockfrost, Koios, or local evaluation).
Example
>>> class MyEvaluator: ... def get_name(self) -> str: ... return "MyEvaluator" ... ... def evaluate( ... self, ... transaction: Transaction, ... additional_utxos: List[Utxo], ... ) -> List[Redeemer]: ... # Custom evaluation logic ... # Call external service, run local UPLC, etc. ... return redeemers
- get_name()[source]
Get the human-readable name of this evaluator.
- Returns:
The evaluator name (e.g., “Blockfrost”, “Koios”, “Local”).
- Return type:
str
- evaluate(transaction, additional_utxos)[source]
Evaluate the execution units required for a transaction.
This method calculates the execution units needed for each Plutus script in the transaction.
- Parameters:
transaction (Transaction) – The transaction to evaluate.
additional_utxos (Union['UtxoList', List['Utxo'], None]) – Optional additional UTXOs needed for evaluation.
- Returns:
A list of Redeemer objects with computed execution units.
- Raises:
Exception – If evaluation fails.
- Return type:
List[‘Redeemer’]
- __init__(*args, **kwargs)
- cometa.transaction_builder.evaluation.tx_evaluator.TxEvaluator
alias of
TxEvaluatorProtocol