Skip to main content

Crate pallas_addresses

Crate pallas_addresses 

Source
Expand description

Encode and decode Cardano addresses of every kind.

Byron, Shelley payment, and stake addresses are all parsed through the same Address entry point: feed it a bech32 / base58 / hex string (or raw bytes), match on the variant, and inspect the network, payment credential, delegation, or pointer parts. Address shape follows CIP-19.

§Usage

use pallas_addresses::Address;

let addr = Address::from_bech32(
    "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3\
     n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x",
)?;

match addr {
    Address::Byron(b)   => println!("byron:   {}", b.to_base58()),
    Address::Shelley(s) => println!("shelley: {} on {:?}", s.to_bech32()?, s.network()),
    Address::Stake(s)   => println!("stake:   {}", s.to_bech32()?),
}

§Overview

§Usage as part of pallas

When depending on the umbrella pallas crate, this crate is re-exported as pallas::ledger::addresses.

Re-exports§

pub use byron::ByronAddress;

Modules§

byron
Byron-era addresses (base58, CBOR-encoded).
varuint
Variable-length unsigned integer codec used inside Shelley pointer addresses. Decode / encode variable-length uints

Structs§

Pointer
An on-chain pointer to a stake key
ShelleyAddress
A decoded Shelley address.
StakeAddress
A decoded stake address.

Enums§

Address
A decoded Cardano address of any type.
Error
Errors produced while decoding or encoding a Cardano address.
Network
The network tag of an address.
ShelleyDelegationPart
The delegation part of a Shelley address.
ShelleyPaymentPart
The payment part of a Shelley address.
StakePayload
The payload of a stake address.

Type Aliases§

CertIdx
Index of a certificate within a transaction.
PaymentKeyHash
Hash of a payment verification key (Blake2b-224).
ScriptHash
Hash of a script (Blake2b-224).
Slot
Absolute slot number on the Cardano chain.
StakeKeyHash
Hash of a stake verification key (Blake2b-224).
TxIdx
Index of a transaction within a block.