TestUtil

scalus.testing.kit.TestUtil
object TestUtil

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
TestUtil.type

Members list

Value members

Concrete methods

def createTestAddress(keyHash: String): ShelleyAddress
def genAdaOnlyPubKeyUtxo(party: Party, params: ProtocolParams = ..., min: Coin = ...)(using CardanoInfo): Gen[Utxo]

Ada-only pub key utxo from the given party, at least min lovelace, random tx id, random index, no datum, no script ref

Ada-only pub key utxo from the given party, at least min lovelace, random tx id, random index, no datum, no script ref

Attributes

def mockPubKeyHash(variation: BigInt): PubKeyHash
def mockScriptHash(variation: BigInt): ValidatorHash
def mockTxInput(variation: BigInt, idx: BigInt): TransactionInput
def mockTxOutRef(variation: BigInt, idx: BigInt): TxOutRef

Deprecated methods

def createTestWallet(address: Address, ada: BigInt): Wallet

Attributes

Deprecated
[Since version 0.13.0] will be removed

Attributes

Deprecated
[Since version 0.14.2] Use TransactionOutput.resolveDatum(tx) instead
def findUtxoByAddressAndDatum(tx: Transaction, address: Address, datum: Option[DatumOption] = ...): Option[(TransactionInput, TransactionOutput)]

Attributes

Deprecated
[Since version 0.14.2] will be removed

Attributes

Deprecated
[Since version 0.14.2] will be removed
def runValidator(validatorProgram: Program, tx: Transaction, utxo: Utxos, wallet: Wallet, scriptInput: TransactionInput, redeemerTag: RedeemerTag = ..., environment: CardanoInfo = ...): Result

Attributes

Deprecated
[Since version 0.13.0] will be removed

Concrete fields

A deterministic genesis transaction hash (all zeros) for creating initial UTxOs in tests.

A deterministic genesis transaction hash (all zeros) for creating initial UTxOs in tests.

Use this when setting up test fixtures with Emulator or creating mock transaction inputs.

Attributes

Extensions

Extensions

extension (tx: Transaction)

Get a single V1 script context for a specific redeemer purpose.

Get a single V1 script context for a specific redeemer purpose.

Value parameters

purpose

The redeemer purpose (ForSpend, ForMint, ForCert, ForReward, ForVote, ForPropose)

utxos

The UTxO set for resolving spent outputs

Attributes

Returns

The V1 script context

Throws
RuntimeException

if no V1 script context is found for the given purpose

Get a single V2 script context for a specific redeemer purpose.

Get a single V2 script context for a specific redeemer purpose.

Value parameters

purpose

The redeemer purpose (ForSpend, ForMint, ForCert, ForReward, ForVote, ForPropose)

utxos

The UTxO set for resolving spent outputs

Attributes

Returns

The V2 script context

Throws
RuntimeException

if no V2 script context is found for the given purpose

Get a single V3 script context for a specific redeemer purpose.

Get a single V3 script context for a specific redeemer purpose.

Value parameters

purpose

The redeemer purpose (ForSpend, ForMint, ForCert, ForReward, ForVote, ForPropose)

utxos

The UTxO set for resolving spent outputs

Attributes

Returns

The V3 script context

Throws
RuntimeException

if no V3 script context is found for the given purpose

def scriptContexts(utxos: Utxos)(using env: CardanoInfo): Map[Redeemer, ScriptContext]

Get all script contexts for all Plutus scripts in the transaction.

Get all script contexts for all Plutus scripts in the transaction.

Value parameters

env

The CardanoInfo containing protocol parameters and slot configuration

utxos

The UTxO set for resolving spent outputs

Attributes

Returns

Map from Redeemer to ScriptContext (union type: v1 | v2 | v3)

Get only V1 script contexts

Get only V1 script contexts

Attributes

Get only V2 script contexts

Get only V2 script contexts

Attributes

Get only V3 script contexts

Get only V3 script contexts

Attributes