Timelock

scalus.cardano.ledger.Timelock
See theTimelock companion enum
object Timelock

Attributes

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

Members list

Type members

Classlikes

Pretty prints Timelock scripts in a readable format

Pretty prints Timelock scripts in a readable format

Attributes

Supertypes
trait Pretty[Timelock]
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 fromBlockfrostJson(json: String): Timelock

Parses a Timelock script from Blockfrost JSON string.

Parses a Timelock script from Blockfrost JSON string.

Value parameters

json

the JSON string representing the script

Attributes

Returns

the Timelock script

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

Reads a Timelock script from a CBOR encoded byte array

Reads a Timelock script from a CBOR encoded byte array

Value parameters

cbor

The CBOR encoded byte array

Attributes

Returns

The Timelock script

def inInterval(slot: SlotNo, interval: ValidityInterval): Boolean
def lteNegInfty(i: SlotNo, j: Option[SlotNo]): Boolean

Checks if less-than-equal comparison holds where Nothing is negative infinity

Checks if less-than-equal comparison holds where Nothing is negative infinity

Attributes

Returns

true if i j or j is SNothing

def ltePosInfty(i: Option[SlotNo], j: SlotNo): Boolean

Checks if less-than-equal comparison holds where Nothing is positive infinity

Checks if less-than-equal comparison holds where Nothing is positive infinity

Attributes

Returns

true if i j or i is SNothing

Givens

Givens

given blockfrostReadWriter: ReadWriter[Timelock]

ReadWriter for Timelock in Blockfrost JSON format.

ReadWriter for Timelock in Blockfrost JSON format.

Blockfrost uses the following JSON format for native scripts:

  • sig: {"type": "sig", "keyHash": "..."}
  • all: {"type": "all", "scripts": [...]}
  • any: {"type": "any", "scripts": [...]}
  • atLeast: {"type": "atLeast", "required": n, "scripts": [...]}
  • after: {"type": "after", "slot": n}
  • before: {"type": "before", "slot": n}

Attributes

Reads a definite- or indefinite-length array, as decodeRecordSum in cardano-ledger. The nested lists accept both too, as decodeStrictSeq. A definite-length array must hold exactly the fields of its constructor, tag included: 3 for MOf, 2 for the others, as matchSize checks.

Reads a definite- or indefinite-length array, as decodeRecordSum in cardano-ledger. The nested lists accept both too, as decodeStrictSeq. A definite-length array must hold exactly the fields of its constructor, tag included: 3 for MOf, 2 for the others, as matchSize checks.

The decoder does not recurse over the scripts of AllOf, AnyOf and MOf: it keeps those it has opened on the heap (NestedCbor), so how deep it reads does not depend on the stack of the thread that reads. It reads at most scalus.serialization.cbor.Cbor.maxMetadataAndScriptNestingLevels levels of arrays: a deeper script fails to decode.

Attributes

Timelock encoder, based on the Haskell code, which uses sum types with tags.

Timelock encoder, based on the Haskell code, which uses sum types with tags.

It does not recurse over the scripts of AllOf, AnyOf and MOf: it keeps the lists of scripts it has opened on the heap (NestedCbor.writeNested), so how deep it writes does not depend on the stack of the thread that writes. A list of scripts is written as borer writes an IndexedSeq.

Attributes

Pretty prints Timelock scripts in a readable format

Pretty prints Timelock scripts in a readable format

Attributes