DeBruijnedProgram

scalus.uplc.DeBruijnedProgram
See theDeBruijnedProgram companion class

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class PrefixDecodeResult(program: DeBruijnedProgram, afterCborByteString: Array[Byte])

A program read from the CBOR byte string at the start of some bytes.

A program read from the CBOR byte string at the start of some bytes.

Value parameters

afterCborByteString

the bytes after the CBOR byte string. These are not the bytes after the program inside the byte string, which ProgramFlatCodec.DecodeResult holds.

program

the program

Attributes

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def fromCbor(cbor: Array[Byte]): DeBruijnedProgram

Deserializes a program from a CBOR-encoded byte array.

Deserializes a program from a CBOR-encoded byte array.

cbor must be exactly one CBOR byte string, and the byte string must hold exactly one flat-encoded program, see fromFlatEncoded. A script taken from a transaction can have bytes after its byte string; read it with fromCborPrefix.

Value parameters

cbor

the CBOR-encoded byte array

Attributes

def fromCborHex(cborHex: String): DeBruijnedProgram

Deserializes a program from a CBOR-encoded hex string.

Deserializes a program from a CBOR-encoded hex string.

Value parameters

cborHex

the CBOR-encoded hex string

Attributes

Returns

the program

def fromCborPrefix(cbor: Array[Byte]): PrefixDecodeResult

Deserializes a program from the CBOR byte string at the start of cbor, returning the bytes after that byte string.

Deserializes a program from the CBOR byte string at the start of cbor, returning the bytes after that byte string.

This is how the ledger reads a Plutus script. It ignores the bytes after the byte string in Plutus V1 and V2 scripts and rejects them in later languages; scalus.cardano.ledger.PlutusScript.isWellFormed applies that rule. As in fromCbor, the byte string must hold exactly one flat-encoded program.

Value parameters

cbor

bytes that start with a definite-length CBOR byte string holding a flat-encoded program

Attributes

Returns

the program and the bytes after the CBOR byte string

def fromCborWithRemainingBytes(cbor: Array[Byte]): DecodeResult

Deserializes a program from a CBOR-encoded byte array, returning the bytes after the program inside the CBOR byte string.

Deserializes a program from a CBOR-encoded byte array, returning the bytes after the program inside the CBOR byte string.

cbor must be exactly one CBOR byte string. For the bytes after the byte string, use fromCborPrefix.

Value parameters

cbor

the CBOR-encoded byte array

Attributes

Returns

the program, with the bytes after its padding as the remainder

def fromDoubleCbor(cbor: Array[Byte]): DeBruijnedProgram

Deserializes a program from a double CBOR-encoded byte array.

Deserializes a program from a double CBOR-encoded byte array.

Value parameters

cbor

the CBOR-encoded hex string

Attributes

Returns

the program

def fromDoubleCborHex(doubleCborHex: String): DeBruijnedProgram

Deserializes a program from a double-CBOR-encoded hex string.

Deserializes a program from a double-CBOR-encoded hex string.

Value parameters

doubleCborHex

the double-CBOR-encoded hex string

Attributes

Returns

the program

def fromFlatEncoded(flatEncoded: Array[Byte]): DeBruijnedProgram

Deserializes a program from a flat-encoded byte array.

Deserializes a program from a flat-encoded byte array.

The bytes must hold the program and its filler and nothing else, see ProgramFlatCodec.decodeFlat. Use fromFlatEncodedWithRemainingBytes when other bytes follow the program.

Value parameters

flatEncoded

the flat-encoded byte array

Attributes

Returns

the program

def fromFlatEncodedWithRemainingBytes(flatEncoded: Array[Byte]): DecodeResult

Deserializes a program from a flat-encoded byte array, returning any remaining bytes.

Deserializes a program from a flat-encoded byte array, returning any remaining bytes.

Value parameters

flatEncoded

the flat-encoded byte array

Attributes

Returns

ProgramFlatCodec.DecodeResult