Module

Contract.Test.Blockfrost

Running Plutip test plans with Blockfrost

#BlockfrostKeySetup

type BlockfrostKeySetup = { privateKeySources :: { payment :: PrivatePaymentKeySource, stake :: Maybe PrivateStakeKeySource }, testKeysDirectory :: String }

All parameters that are needed to run Contract tests using Blockfrost API.

Includes:

  • Private payment and (optionally) stake keys
  • A directory to store temporary private keys that will be used in tests. In case of a sudden test interruption, funds will not be lost because the private keys will be saved to files.

#runContractTestsWithBlockfrost

runContractTestsWithBlockfrost :: ContractParams -> BlockfrostBackendParams -> Maybe CtlBackendParams -> BlockfrostKeySetup -> TestPlanM ContractTest Unit -> TestPlanM (Aff Unit) Unit

A function that interprets a Plutip test plan into an Aff, given a pre-funded address and a Blockfrost API endpoint.

Accepts:

  1. Runtime parameters for Contract
  2. Parameters for Blockfrost backend
  3. Optional parameters for CTL backend if it should be used
  4. Key setup parameters - keys are used to provide funds to the test suite. Create the keys using this guide and fund them using the test ADA faucet: https://docs.cardano.org/cardano-testnet/tools/faucet
  5. A test suite to run.

Note that this function does not start a Plutip cluster. Instead, it substitutes it with Blockfrost.

If you are using a paid Blockfrost plan, be careful with what you run with this function.

Avoid moving the funds around too much using withWallets in the tests to save on both time and costs.

#executeContractTestsWithBlockfrost

executeContractTestsWithBlockfrost :: Config -> ContractParams -> TestPlanM ContractTest Unit -> Aff Unit

Reads environment variables containing Blockfrost test suite configuration parameters and runs a given test suite using runContractTestsWithBlockfrost.

Modules