ProgramFlatCodec

scalus.uplc.ProgramFlatCodec

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class DecodeResult(program: DeBruijnedProgram, remainder: Array[Byte])

Attributes

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

Value members

Concrete methods

def decodeFlat(encoded: Array[Byte]): DeBruijnedProgram

Decodes Flat-encoded DeBruijnedProgram from bytes.

Decodes Flat-encoded DeBruijnedProgram from bytes.

Attributes

Throws
IllegalArgumentException

see requireVersionCanCarry

def decodeFlatWithRemainingBytes(encoded: Array[Byte]): DecodeResult

Decodes Flat-encoded DeBruijnedProgram from bytes, returning any remaining bytes that were not part of the program.

Decodes Flat-encoded DeBruijnedProgram from bytes, returning any remaining bytes that were not part of the program.

Attributes

Throws
IllegalArgumentException

see requireVersionCanCarry

def encodeFlat(deBruijned: DeBruijnedProgram): Array[Byte]

Encodes DeBruijnedProgram as Flat encoded bytes.

Encodes DeBruijnedProgram as Flat encoded bytes.

Attributes

Throws
IllegalArgumentException

see requireVersionCanCarry

Rejects a program that declares a version below 1.1.0 but contains constr/case.

Rejects a program that declares a version below 1.1.0 but contains constr/case.

This is the check the Plutus decoder makes ("'constr' is not allowed before version 1.1.0"), applied on both sides of this codec: on encode, so Scalus cannot produce bytes the ledger will reject; on decode, so Scalus does not accept bytes the ledger would not.

Attributes

Throws
IllegalArgumentException

if the program version is below 1.1.0 and the term uses constr or case

def unsafeEncodeFlat(program: Program): Array[Byte]

Encodes Program as Flat encoded bytes. It assumes the program is correctly de-bruijned. Use it if you know what you're doing.

Encodes Program as Flat encoded bytes. It assumes the program is correctly de-bruijned. Use it if you know what you're doing.

Attributes

Concrete fields

val minVersionForConstrCase: (Int, Int, Int)

The first UPLC version that can carry constr/case terms.

The first UPLC version that can carry constr/case terms.

Attributes