ProtocolParams

scalus.cardano.ledger.ProtocolParams
See theProtocolParams 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 ParamDiff(field: String, expected: String, actual: String)

A single field difference between two ProtocolParams

A single field difference between two ProtocolParams

Attributes

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

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 diff(expected: ProtocolParams, actual: ProtocolParams): Seq[ParamDiff]

Compare two ProtocolParams and return all field-level differences. Returns empty Seq if they are equal. Uses productElementNames/productIterator for automatic field enumeration.

Compare two ProtocolParams and return all field-level differences. Returns empty Seq if they are equal. Uses productElementNames/productIterator for automatic field enumeration.

Attributes

def fromBlockfrostJson(json: String): ProtocolParams

Reads ProtocolParams from JSON string in Blockfrost format.

Reads ProtocolParams from JSON string in Blockfrost format.

Attributes

Throws
IllegalArgumentException

if the JSON is not a complete Blockfrost parameter set. The message names the field that was missing or ill-typed, and the shape that was expected.

def fromBlockfrostJson(json: InputStream): ProtocolParams

Reads ProtocolParams from JSON string in Blockfrost format.

Reads ProtocolParams from JSON string in Blockfrost format.

Attributes

Throws
IllegalArgumentException

if the JSON is not a complete Blockfrost parameter set.

def fromCardanoCliJson(json: String): ProtocolParams

Reads ProtocolParams from JSON string in Cardano CLI format.

Reads ProtocolParams from JSON string in Cardano CLI format.

Attributes

Throws
IllegalArgumentException

if the JSON is not a complete cardano-cli query protocol-parameters output.

def fromCardanoCliJson(json: InputStream): ProtocolParams

Reads ProtocolParams from JSON string in Cardano CLI format.

Reads ProtocolParams from JSON string in Cardano CLI format.

Attributes

Throws
IllegalArgumentException

if the JSON is not a complete cardano-cli query protocol-parameters output.

def toBlockfrostJson(params: ProtocolParams): String

Render as Blockfrost's /epochs/{n}/parameters JSON.

Render as Blockfrost's /epochs/{n}/parameters JSON.

The inverse of fromBlockfrostJson, and tested as such. This shape exists because it is what the JavaScript SDKs already know how to consume: both MeshJS and the Evolution SDK ship a Blockfrost parameter mapping, so handing them this costs them no new code.

Delegates to blockfrostParamsReadWriter rather than re-listing the fields here, so the field mapping (including which values Blockfrost renders as decimal strings) has one source of truth shared with fromBlockfrostJson.

Attributes

Concrete fields

Reads and writes the Blockfrost JSON shape.

Reads and writes the Blockfrost JSON shape.

lazy on purpose, and the same goes for cardanoCliParamsReadWriter. A plain val here runs in this object's constructor, so merely touching ProtocolParams builds both codecs, and building them reaches upickle's whole derivation machinery. That made CardanoInfo.mainnet alone pull about 740 KB of upickle, ujson and upack into the Scala.js bundle. Deferring construction lets the linker drop them when nothing parses JSON, which is the case for everything scalus.js exports. See docs/internal/JS_BUNDLE_SIZE.md.

Attributes

Reads and writes the Cardano CLI JSON shape.

Reads and writes the Cardano CLI JSON shape.

lazy for the reason given on blockfrostParamsReadWriter. This one matters most: it ends in macroRW, whose 30-field derivation is what drags CostModels, ExUnits, ProtocolVersion, UnitInterval, ExUnitPrices and the voting thresholds along with it.

Attributes