Module

Contract.Test.Plutip

This module contains everything needed for Contract testing in Plutip environment.

#PlutipTest

type PlutipTest = ContractTest

Type synonym for backwards compatibility.

#PlutipTestPlan

#defaultPlutipConfig

defaultPlutipConfig :: PlutipConfig

A default value for PlutipConfig type.

Re-exports from Contract.Monad

#runContractInEnv

runContractInEnv :: forall (a :: Type). ContractEnv -> Contract a -> Aff a

Runs a contract in existing environment. Does not destroy the environment when contract execution ends.

Re-exports from Contract.Wallet

#withKeyWallet

withKeyWallet :: forall (a :: Type). KeyWallet -> Contract a -> Contract a

Re-exports from Ctl.Internal.Plutip.Server

#withPlutipContractEnv

withPlutipContractEnv :: forall (distr :: Type) (wallets :: Type) (a :: Type). UtxoDistribution distr wallets => PlutipConfig -> distr -> (ContractEnv -> wallets -> Aff a) -> Aff a

Provide a ContractEnv connected to Plutip. can be used to run multiple Contracts using runContractInEnv.

#testPlutipContracts

testPlutipContracts :: PlutipConfig -> TestPlanM ContractTest Unit -> TestPlanM (Aff Unit) Unit

Run several Contracts in tests in a (single) Plutip environment (plutip-server and cluster, kupo, etc.). NOTE: This uses MoteTs bracketing, and thus has the same caveats. Namely, brackets are run for each of the top-level groups and tests inside the bracket. If you wish to only set up Plutip once, ensure all tests that are passed to testPlutipContracts are wrapped in a single group. https://github.com/Plutonomicon/cardano-transaction-lib/blob/develop/doc/plutip-testing.md#testing-with-mote

#runPlutipTestPlan

runPlutipTestPlan :: PlutipConfig -> ContractTestPlan -> TestPlanM (Aff Unit) Unit

Run a ContractTestPlan in a (single) Plutip environment. Supports wallet reuse - see docs on sharing wallet state between wallets in doc/plutip-testing.md.

#runPlutipContract

runPlutipContract :: forall (distr :: Type) (wallets :: Type) (a :: Type). UtxoDistribution distr wallets => PlutipConfig -> distr -> (wallets -> Contract a) -> Aff a

Run a single Contract in Plutip environment.

Re-exports from Ctl.Internal.Plutip.Types

#PlutipConfig

type PlutipConfig = { clusterConfig :: { epochSize :: Maybe UInt, maxTxSize :: Maybe UInt, raiseExUnitsToMax :: Boolean, slotLength :: Seconds }, customLogger :: Maybe (LogLevel -> Message -> Aff Unit), hooks :: Hooks, host :: String, kupoConfig :: ServerConfig, logLevel :: LogLevel, ogmiosConfig :: ServerConfig, port :: UInt, suppressLogs :: Boolean }

A config that is used to run tests on Plutip clusters. Note that the test suite starts the services on the specified ports. It does not expect them to be running.

Re-exports from Ctl.Internal.Test.ContractTest

#withWallets

withWallets :: forall (distr :: Type) (wallets :: Type). UtxoDistribution distr wallets => distr -> (wallets -> Contract Unit) -> ContractTest

Store a wallet UtxoDistribution and a Contract that depends on those wallets

#sameWallets

sameWallets :: forall (distr :: Type) (wallets :: Type). UtxoDistribution distr wallets => distr -> TestPlanM (wallets -> Contract Unit) Unit -> ContractTestPlan

Store a wallet UtxoDistribution and a TestPlanM that depend on those wallets

#noWallet

noWallet :: Contract Unit -> ContractTest

Lift a Contract into ContractTest

Re-exports from Ctl.Internal.Test.UtxoDistribution

#UtxoAmount

type UtxoAmount = BigNum

UTxO amount in Lovelaces

#InitialUTxOsWithStakeKey

data InitialUTxOsWithStakeKey

A wrapper that allows to specify a stake key to attach to a generated pre-funded Address.

Constructors

Instances

#InitialUTxOs

#InitialUTxODistribution

type InitialUTxODistribution = Array InitialUTxOs

A spec for distribution of UTxOs between wallets.

#UtxoDistribution

class UtxoDistribution distr wallets | distr -> wallets

A type class that implements a type-safe interface for specifying UTXO distribution for wallets. Number of wallets in distribution specification matches the number of wallets provided to the user.

Instances

Modules