Credential

scalus.cardano.onchain.plutus.v1.Credential
See theCredential companion enum
object Credential

Attributes

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

Members list

Type members

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 fields

lazy val sirDeps: List[SIRModuleWithDeps]
lazy val sirModule: Module

Givens

Givens

Ordering follows the ledger's Ord (Credential kr), which is derived on ScriptHashObj | KeyHashObj (libs/cardano-ledger-core/.../Credential.hs:98-101), so script credentials sort before key credentials.

Ordering follows the ledger's Ord (Credential kr), which is derived on ScriptHashObj | KeyHashObj (libs/cardano-ledger-core/.../Credential.hs:98-101), so script credentials sort before key credentials.

That is the opposite of the Plutus constructor tags (PubKeyCredential is 0, ScriptCredential is 1), and it is deliberate: V3 delivers txInfoWdrl keyed by the ledger's Credential, converted only after Map.toList has fixed the order (Conway/TxInfo.hs:697-699, :549-551). Ordering by the Plutus tags instead made withdrawals.get return None for a key that is present.

Note this does NOT apply to StakingCredential, which V1/V2 deliver in Plutus order. See the Ord[StakingCredential] instance below.

Attributes

Extensions

Extensions

extension (self: Credential)
inline def pubKeyHashOrFail(inline message: String): PubKeyHash

The key hash of a PubKeyCredential, or fails with message for a script credential.

The key hash of a PubKeyCredential, or fails with message for a script credential.

A direct match with no intermediate Option, unlike pubKeyOption.getOrFail(message).

Attributes

Example
 Credential.PubKeyCredential(pkh).pubKeyHashOrFail("expected a key") === pkh
 Credential.ScriptCredential(hash).pubKeyHashOrFail("expected a key") // fails
inline def scriptHashOrFail(inline message: String): ValidatorHash

The script hash of a ScriptCredential, or fails with message for a key credential.

The script hash of a ScriptCredential, or fails with message for a key credential.

A direct match with no intermediate Option, unlike scriptOption.getOrFail(message), which allocates one that nothing folds away.

Attributes

Example
 Credential.ScriptCredential(hash).scriptHashOrFail("expected a script") === hash
 Credential.PubKeyCredential(pkh).scriptHashOrFail("expected a script") // fails