Skip to main content

Address

Represents a Cardano address.

Associated functions

from_bytes

Decodes raw address bytes (see CIP 19). IS_TESTNET must be set to false for this to work for mainnet addresses.

Address::from_bytes(bytes: ByteArray) -> Address

from_data

Address::from_data(data: Data) -> Address

from_hex

Decodes the hexadecimal encoded bytes of a raw address (see CIP 19). IS_TESTNET must be set to false for this to work for mainnet addresses.

Address::from_hex(hex: String) -> Address

from_validator

Constructs a validator Address with a Credential derived from a ValidatorHash.

Address::from_validator(vh: ValidatorHash) -> Address

The resulting Address doesn't have a StakingCredential.

new

Constructs a new Address from a Credential and an optional StakingCredential:

Address::new(
credential: Credential,
staking_credential: Option[StakingCredential]
) -> Address

new_empty

Constructs a dummy Address with a dummy Credential whose bytes are all set to 0, and without a StakingCredential.

Address::new_empty() -> Address

Getters

credential

Get the payment Credential of an Address:

address.credential -> Credential

staking_credential

Get the StakingCredential of an Address:

address.staking_credential -> Option[StakingCredential]

Operators

==

Address == Address -> Bool

!=

Address != Address -> Bool

Methods

is_staked

address.is_staked() -> Bool

serialize

address.serialize() -> ByteArray

show

Alias for to_hex.

address.show() -> String

to_bytes

Returns the raw address bytes (see CIP 19). IS_TESTNET must be set to false for this to return a raw mainnet addresses.

address.to_bytes() -> ByteArray

to_hex

Encodes the raw address bytes as a hexadecimal String (see CIP 19). IS_TESTNET must be set to false for this to return a raw mainnet addresses.

address.to_hex() -> String