scalus.cardano.blueprint

Members list

Type members

Classlikes

object Blueprint

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Blueprint.type
case class Blueprint(preamble: Preamble, validators: Seq[Validator] = ..., scalus: Option[ScalusInfo] = ...)

A CIP-57 compliant description of a set of validators.

A CIP-57 compliant description of a set of validators.

Each validator description contains schemas PlutusDataSchema of the datum and redeemer formats expected by the contracts.

Attributes

See also
Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BlueprintTool

JSON-level blueprint operations used by the Scalus sbt plugin.

JSON-level blueprint operations used by the Scalus sbt plugin.

The plugin (Scala 2.12/3, running inside sbt) calls these reflectively across a URLClassLoader boundary, so the signatures use only java.* and String types. Do not rename or change signatures without updating ScalusSbtPlugin.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object CompilerInfo

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class CompilerInfo(name: String, version: Option[String] = ...)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Contract

A single-contract blueprint provider.

A single-contract blueprint provider.

Extend this in an object that defines one compiled contract with its blueprint. The compiler plugin discovers implementations and the blueprint sbt task prints the JSON.

object MyContract extends Contract {
   private given Options = Options.release
   lazy val compiled = PlutusV3.compile(MyValidator.validate)
   lazy val blueprint = Blueprint.plutusV3[Datum, Redeemer](
       title = "My Contract",
       description = "...",
       version = "1.0.0",
       license = None,
       compiled = compiled
   )
}

Attributes

Supertypes
class Object
trait Matchable
class Any
enum DataType(val value: String)

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DataType

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
DataType.type

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class HasTypeDescription[A](typeDescription: TypeDescription)

Type class for types that can provide a TypeDescription for CIP-57 blueprints.

Type class for types that can provide a TypeDescription for CIP-57 blueprints.

Instances of this type class are used to generate datum, redeemer, and parameter schemas in Blueprint validators.

Type parameters

A

the type that can be described

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PlutusDataSchema(dataType: Option[DataType] = ..., title: Option[String] = ..., description: Option[String] = ..., anyOf: Option[List[PlutusDataSchema]] = ..., index: Option[Int] = ..., fields: Option[List[PlutusDataSchema]] = ..., items: Option[List[PlutusDataSchema]] = ...)

The description of the data shape of a validator parameter, datum or redemeer.

The description of the data shape of a validator parameter, datum or redemeer.

For user types, the schema should generally be PlutusDataSchema.derived as opposed to manually assembled.

If assembled directly, it should be compliant with https://cips.cardano.org/cip/CIP-57.

Namely, composite types should be represented as DataType.Constructors, with properly indexed fields, tuples of arity >3 should be DataType.Lists with respective items, and pairs should be DataType.PairBuiltin. See BlueprintTest for derivation examples and expectations.

Attributes

See also

DataType for type description

scalus.uplc.builtin.Data for more info about onchain data types

Note

the types described by these schemas are used as datums, redeemers and parameters. As such, only onchain data should be described by PlutusDataSchema. Therefore, attempting to derive schemas for types that cannot be on chain will lead to compile time errors. Generally, if one can derive scalus.uplc.builtin.FromData for a type, one can also do so for the schema. If one cannot derive scalus.uplc.builtin.FromData, it means that the type cannot exist on chain, and therefore should not be described with PlutusDataSchema

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Preamble

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Preamble.type
case class Preamble(title: String, description: Option[String] = ..., version: Option[String] = ..., compiler: Option[CompilerInfo] = ..., plutusVersion: Option[Language] = ..., license: Option[String] = ...)

An object that holds blueprint metadata. Does not include information about contracts and instead contains apps title and description, compiler information, plutus version used, etc.

An object that holds blueprint metadata. Does not include information about contracts and instead contains apps title and description, compiler information, plutus version used, etc.

For applications that only have 1 validator, the preamble data may repeat that of the validator.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Purpose

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class OneOf
object Purpose

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Purpose.type
object ScalusInfo

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ScalusInfo.type
case class ScalusInfo(scalaVersion: Option[String] = ...)

Scalus-specific toolchain provenance, stored as a top-level extension key of the blueprint document. CIP-57 sets additionalProperties: false on preamble and compiler, but not on the document root, so an extra root key keeps the blueprint valid against the official schema.

Scalus-specific toolchain provenance, stored as a top-level extension key of the blueprint document. CIP-57 sets additionalProperties: false on preamble and compiler, but not on the document root, so an extra root key keeps the blueprint valid against the official schema.

The Scalus version already lives in preamble.compiler.version; this records what the JSON has no other slot for – the Scala toolchain that compiled the contracts, which determines the generated UPLC (different Scala versions can produce different scripts and hashes).

Value parameters

scalaVersion

the full Scala version the contracts were compiled with (e.g. "3.3.7")

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class TypeDescription(title: Option[String] = ..., description: Option[String] = ..., purpose: Option[Purpose] = ..., schema: PlutusDataSchema)

Describes a type for CIP-57 blueprint schemas.

Describes a type for CIP-57 blueprint schemas.

Contains metadata about a type (title, description, purpose) along with its PlutusDataSchema that describes the Plutus Data encoding.

Value parameters

description

optional description of the type

purpose

optional purpose (spend, mint, withdraw, publish)

schema

the Plutus Data schema for the type

title

optional title for the type

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class Validator(title: String, description: Option[String] = ..., redeemer: Option[TypeDescription] = ..., datum: Option[TypeDescription] = ..., parameters: Option[List[TypeDescription]] = ..., compiledCode: Option[String] = ..., hash: Option[String] = ...)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Validator

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Validator.type