Address

scalus.cardano.address.Address
See theAddress companion trait
object Address

Attributes

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

Members list

Type members

Classlikes

object given_Decoder_Address extends Decoder[Address]

CBOR decoder for Address, as at protocol version 9 and later

CBOR decoder for Address, as at protocol version 9 and later

Attributes

Supertypes
trait Decoder[Address]
class Object
trait Matchable
class Any
Self type
object given_Encoder_Address extends Encoder[Address]

CBOR encoder for Address

CBOR encoder for Address

Attributes

Supertypes
trait Encoder[Address]
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 apply(network: Network, payment: Credential, delegation: Credential): Address

Create a Shelley address from payment and stake credentials

Create a Shelley address from payment and stake credentials

Attributes

def apply(network: Network, payment: Credential): Address

Create a Shelley-era address from a payment credential with no delegation

Create a Shelley-era address from a payment credential with no delegation

This is an enterprise address.

Attributes

def fromBech32(bech32: String): Address

Parse address from bech32 string

Parse address from bech32 string

Attributes

def fromBech32Lenient(bech32: String): Address

Parse a bech32 address a node already holds, see fromBytesLenient.

Parse a bech32 address a node already holds, see fromBytesLenient.

Attributes

Parse address from scalus.uplc.builtin.ByteString

Parse address from scalus.uplc.builtin.ByteString

Value parameters

bs

Raw address bytes

Attributes

Returns

Parsed address

Throws
java.lang.IllegalArgumentException

If the byte string is empty or does not match any known address format

def fromBytes(bytes: Array[Byte]): Address

Parse address from raw bytes, as a node reads one in a new transaction (protocol version 9 and later). This is the ledger's decodeAddr.

Parse address from raw bytes, as a node reads one in a new transaction (protocol version 9 and later). This is the ledger's decodeAddr.

A pointer number may be written with zero groups in front, up to the bytes its width needs; toBytes writes it back without them, as the node holds it.

Value parameters

bytes

Raw address bytes including header

Attributes

Returns

Parsed address or failure with descriptive error

def fromBytes(bytes: Array[Byte], protocolVersion: ProtocolVersion): Address

Parse address from raw bytes, as a node reads one at protocolVersion.

Parse address from raw bytes, as a node reads one at protocolVersion.

The version only changes how a pointer address reads (see Pointer.fromBytes): before version 9 a pointer that does not fit the ledger's widths reads as Pointer(Slot(0), 0, 0), and before version 7 bytes after the pointer are dropped. From version 9 both fail.

Value parameters

bytes

Raw address bytes including header

protocolVersion

The protocol version of the transaction or block the address is in

Attributes

Returns

Parsed address or failure with descriptive error

def fromBytesLenient(bytes: Array[Byte]): Address

Parse an address a node already holds, such as the address of an output in its UTxO set, as the ledger's decompactAddr reads one.

Parse an address a node already holds, such as the address of an output in its UTxO set, as the ledger's decompactAddr reads one.

A pointer reads as before protocol version 7: one that does not fit the ledger's widths reads as Pointer(Slot(0), 0, 0), and bytes after it are dropped. An output written before version 9 can have such a pointer, so use this for an address that chain data gives, as a provider's UTxO does. An address a user gives is checked with fromBytes instead, as a node checks it in a new transaction.

Attributes

def fromString(str: String): Address

Parse address from any string format (bech32 or base58).

Parse address from any string format (bech32 or base58).

Tries Bech32 first (for Shelley-era addresses), then Base58 (for Byron addresses).

Value parameters

str

The address string to parse

Attributes

Returns

The parsed Address

Throws
IllegalArgumentException

if the string is not a valid address in any supported format

Givens

Givens

CBOR decoder for Address, as at protocol version 9 and later

CBOR decoder for Address, as at protocol version 9 and later

Attributes

CBOR encoder for Address

CBOR encoder for Address

Attributes

Pretty prints any Address - delegates to specific type instances

Pretty prints any Address - delegates to specific type instances

Attributes

Extensions

Extensions

extension (sc: StringContext)
def addr(args: Any*): Address

String interpolator for parsing bech32 Cardano addresses.

String interpolator for parsing bech32 Cardano addresses.

Attributes

Example
import scalus.cardano.address.Address.addr
val mainnetAddr = addr"addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer..."
val testnetAddr = addr"addr_test1qz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer..."
val stakeAddr = addr"stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw"
extension (sc: StringContext)
def stake(args: Any*): StakeAddress

String interpolator for parsing bech32 Cardano stake addresses.

String interpolator for parsing bech32 Cardano stake addresses.

Attributes

Example
import scalus.cardano.address.Address.stake
val mainnetStake = stake"stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw"
val testnetStake = stake"stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27"