| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Bcc.Api.Address
Description
Bcc addresses: payment and stake addresses.
Synopsis
- data Address addrtype where
- ColeAddress ∷ Address → Address ColeAddr
 - SophieAddress ∷ Network → PaymentCredential StandardCrypto → StakeReference StandardCrypto → Address SophieAddr
 
 - data ColeAddr
 - makeColeAddress ∷ NetworkId → VerificationKey ColeKey → Address ColeAddr
 - data SophieAddr
 - makeSophieAddress ∷ NetworkId → PaymentCredential → StakeAddressReference → Address SophieAddr
 - data PaymentCredential
 - data StakeAddressReference
 - newtype StakeAddressPointer = StakeAddressPointer {
- unStakeAddressPointer ∷ Ptr
 
 - data AddressAny
- = AddressCole !(Address ColeAddr)
 - | AddressSophie !(Address SophieAddr)
 
 - data AddressInEra era where
- AddressInEra ∷ AddressTypeInEra addrtype era → Address addrtype → AddressInEra era
 
 - data AddressTypeInEra addrtype era where
 - coleAddressInEra ∷ Address ColeAddr → AddressInEra era
 - sophieAddressInEra ∷ IsSophieBasedEra era ⇒ Address SophieAddr → AddressInEra era
 - anyAddressInSophieBasedEra ∷ IsSophieBasedEra era ⇒ AddressAny → AddressInEra era
 - anyAddressInEra ∷ BccEra era → AddressAny → Maybe (AddressInEra era)
 - toAddressAny ∷ Address addr → AddressAny
 - makeColeAddressInEra ∷ NetworkId → VerificationKey ColeKey → AddressInEra era
 - makeSophieAddressInEra ∷ IsSophieBasedEra era ⇒ NetworkId → PaymentCredential → StakeAddressReference → AddressInEra era
 - data StakeAddress where
- StakeAddress ∷ Network → StakeCredential StandardCrypto → StakeAddress
 
 - data StakeCredential
 - makeStakeAddress ∷ NetworkId → StakeCredential → StakeAddress
 - data StakeKey
 - data StakeExtendedKey
 - toSophieAddr ∷ AddressInEra era → Addr StandardCrypto
 - toSophieStakeAddr ∷ StakeAddress → RewardAcnt StandardCrypto
 - toSophieStakeCredential ∷ StakeCredential → StakeCredential StandardCrypto
 - fromSophieAddr ∷ IsSophieBasedEra era ⇒ Addr StandardCrypto → AddressInEra era
 - fromSophiePaymentCredential ∷ PaymentCredential StandardCrypto → PaymentCredential
 - fromSophieStakeAddr ∷ RewardAcnt StandardCrypto → StakeAddress
 - fromSophieStakeCredential ∷ StakeCredential StandardCrypto → StakeCredential
 - fromSophieStakeReference ∷ StakeReference StandardCrypto → StakeAddressReference
 - class HasTypeProxy addr ⇒ SerialiseAddress addr where
- serialiseAddress ∷ addr → Text
 - deserialiseAddress ∷ AsType addr → Text → Maybe addr
 
 - data family AsType t
 - isKeyAddress ∷ AddressInEra era → Bool
 
Payment addresses
Constructing and inspecting normal payment addresses
data Address addrtype where Source #
Addresses are used as locations where assets live. The address determines the rights needed to spend assets at the address: in particular holding some signing key or being able to satisfy the conditions of a script.
There are currently two types of address:
- Cole addresses, which use the type tag 
ColeAddr; and - Sophie addresses, which use the type tag 
SophieAddr. Notably, Sophie addresses support scripts and stake delegation. 
The address type is subtly from the ledger era in which each
 address type is valid: while Cole addresses are the only choice in the
 Cole era, the Sophie era and all subsequent eras support both Cole and
 Sophie addresses. The Address type param only says the type of the address
 (either Cole or Sophie). The AddressInEra type connects the address type
 with the era in which it is supported.
Constructors
| ColeAddress ∷ Address → Address ColeAddr | Cole addresses were the only supported address type in the original Cole era.  | 
| SophieAddress ∷ Network → PaymentCredential StandardCrypto → StakeReference StandardCrypto → Address SophieAddr | Sophie addresses allow delegation. Sophie addresses were introduced in Sophie era and are thus supported from the Sophie era onwards  | 
Instances
Cole addresses
A type used as a tag to distinguish Cole addresses.
Instances
| HasTypeProxy ColeAddr Source # | |
| SerialiseAsRawBytes (Address ColeAddr) Source # | |
Defined in Bcc.Api.Address Methods serialiseToRawBytes ∷ Address ColeAddr → ByteString Source # deserialiseFromRawBytes ∷ AsType (Address ColeAddr) → ByteString → Maybe (Address ColeAddr) Source #  | |
| SerialiseAddress (Address ColeAddr) Source # | |
| data AsType ColeAddr Source # | |
Defined in Bcc.Api.Address  | |
Sophie addresses
data SophieAddr Source #
A type used as a tag to distinguish Sophie addresses.
Instances
| HasTypeProxy SophieAddr Source # | |
Defined in Bcc.Api.Address Associated Types data AsType SophieAddr Source # Methods proxyToAsType ∷ Proxy SophieAddr → AsType SophieAddr Source #  | |
| SerialiseAsRawBytes (Address SophieAddr) Source # | |
Defined in Bcc.Api.Address Methods serialiseToRawBytes ∷ Address SophieAddr → ByteString Source # deserialiseFromRawBytes ∷ AsType (Address SophieAddr) → ByteString → Maybe (Address SophieAddr) Source #  | |
| SerialiseAsBech32 (Address SophieAddr) Source # | |
Defined in Bcc.Api.Address Methods bech32PrefixFor ∷ Address SophieAddr → Text Source # bech32PrefixesPermitted ∷ AsType (Address SophieAddr) → [Text] Source #  | |
| SerialiseAddress (Address SophieAddr) Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ Address SophieAddr → Text Source # deserialiseAddress ∷ AsType (Address SophieAddr) → Text → Maybe (Address SophieAddr) Source #  | |
| data AsType SophieAddr Source # | |
Defined in Bcc.Api.Address  | |
makeSophieAddress ∷ NetworkId → PaymentCredential → StakeAddressReference → Address SophieAddr Source #
data PaymentCredential Source #
Constructors
| PaymentCredentialByKey (Hash PaymentKey) | |
| PaymentCredentialByScript ScriptHash | 
Instances
| Eq PaymentCredential Source # | |
Defined in Bcc.Api.Address Methods (==) ∷ PaymentCredential → PaymentCredential → Bool Source # (/=) ∷ PaymentCredential → PaymentCredential → Bool Source #  | |
| Ord PaymentCredential Source # | |
Defined in Bcc.Api.Address Methods compare ∷ PaymentCredential → PaymentCredential → Ordering Source # (<) ∷ PaymentCredential → PaymentCredential → Bool Source # (<=) ∷ PaymentCredential → PaymentCredential → Bool Source # (>) ∷ PaymentCredential → PaymentCredential → Bool Source # (>=) ∷ PaymentCredential → PaymentCredential → Bool Source # max ∷ PaymentCredential → PaymentCredential → PaymentCredential Source # min ∷ PaymentCredential → PaymentCredential → PaymentCredential Source #  | |
| Show PaymentCredential Source # | |
Defined in Bcc.Api.Address  | |
data StakeAddressReference Source #
Constructors
| StakeAddressByValue StakeCredential | |
| StakeAddressByPointer StakeAddressPointer | |
| NoStakeAddress | 
Instances
| Eq StakeAddressReference Source # | |
Defined in Bcc.Api.Address Methods (==) ∷ StakeAddressReference → StakeAddressReference → Bool Source # (/=) ∷ StakeAddressReference → StakeAddressReference → Bool Source #  | |
| Show StakeAddressReference Source # | |
Defined in Bcc.Api.Address  | |
newtype StakeAddressPointer Source #
Constructors
| StakeAddressPointer | |
Fields 
  | |
Instances
| Eq StakeAddressPointer Source # | |
Defined in Bcc.Api.Address Methods (==) ∷ StakeAddressPointer → StakeAddressPointer → Bool Source # (/=) ∷ StakeAddressPointer → StakeAddressPointer → Bool Source #  | |
| Show StakeAddressPointer Source # | |
Defined in Bcc.Api.Address  | |
Addresses in any era
data AddressAny Source #
Either a Cole address or a Sophie address.
Sometimes we need to be able to work with either of the two types of address (Cole or Sophie addresses), but without reference to an era in which the address will be used. This type serves that purpose.
Constructors
| AddressCole !(Address ColeAddr) | |
| AddressSophie !(Address SophieAddr) | 
Instances
| Eq AddressAny Source # | |
Defined in Bcc.Api.Address  | |
| Ord AddressAny Source # | |
Defined in Bcc.Api.Address Methods compare ∷ AddressAny → AddressAny → Ordering Source # (<) ∷ AddressAny → AddressAny → Bool Source # (<=) ∷ AddressAny → AddressAny → Bool Source # (>) ∷ AddressAny → AddressAny → Bool Source # (>=) ∷ AddressAny → AddressAny → Bool Source # max ∷ AddressAny → AddressAny → AddressAny Source # min ∷ AddressAny → AddressAny → AddressAny Source #  | |
| Show AddressAny Source # | |
Defined in Bcc.Api.Address  | |
| HasTypeProxy AddressAny Source # | |
Defined in Bcc.Api.Address Associated Types data AsType AddressAny Source # Methods proxyToAsType ∷ Proxy AddressAny → AsType AddressAny Source #  | |
| SerialiseAsRawBytes AddressAny Source # | |
Defined in Bcc.Api.Address  | |
| SerialiseAddress AddressAny Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ AddressAny → Text Source # deserialiseAddress ∷ AsType AddressAny → Text → Maybe AddressAny Source #  | |
| data AsType AddressAny Source # | |
Defined in Bcc.Api.Address  | |
Addresses in specific eras
data AddressInEra era where Source #
An Address that can be used in a particular ledger era.
All current ledger eras support Cole addresses. Sophie addresses are
 supported in the SophieEra and later eras.
Constructors
| AddressInEra ∷ AddressTypeInEra addrtype era → Address addrtype → AddressInEra era | 
Instances
data AddressTypeInEra addrtype era where Source #
Constructors
| ColeAddressInAnyEra ∷ AddressTypeInEra ColeAddr era | |
| SophieAddressInEra ∷ SophieBasedEra era → AddressTypeInEra SophieAddr era | 
Instances
| Show (AddressTypeInEra addrtype era) Source # | |
Defined in Bcc.Api.Address  | |
coleAddressInEra ∷ Address ColeAddr → AddressInEra era Source #
sophieAddressInEra ∷ IsSophieBasedEra era ⇒ Address SophieAddr → AddressInEra era Source #
anyAddressInSophieBasedEra ∷ IsSophieBasedEra era ⇒ AddressAny → AddressInEra era Source #
anyAddressInEra ∷ BccEra era → AddressAny → Maybe (AddressInEra era) Source #
toAddressAny ∷ Address addr → AddressAny Source #
makeSophieAddressInEra ∷ IsSophieBasedEra era ⇒ NetworkId → PaymentCredential → StakeAddressReference → AddressInEra era Source #
Stake addresses
Constructing and inspecting stake addresses
data StakeAddress where Source #
Constructors
| StakeAddress ∷ Network → StakeCredential StandardCrypto → StakeAddress | 
Instances
data StakeCredential Source #
Constructors
| StakeCredentialByKey (Hash StakeKey) | |
| StakeCredentialByScript ScriptHash | 
Instances
| Eq StakeCredential Source # | |
Defined in Bcc.Api.Address Methods  | |
| Ord StakeCredential Source # | |
Defined in Bcc.Api.Address Methods compare ∷ StakeCredential → StakeCredential → Ordering Source # (<) ∷ StakeCredential → StakeCredential → Bool Source # (<=) ∷ StakeCredential → StakeCredential → Bool Source # (>) ∷ StakeCredential → StakeCredential → Bool Source # (>=) ∷ StakeCredential → StakeCredential → Bool Source # max ∷ StakeCredential → StakeCredential → StakeCredential Source # min ∷ StakeCredential → StakeCredential → StakeCredential Source #  | |
| Show StakeCredential Source # | |
Defined in Bcc.Api.Address  | |
Instances
data StakeExtendedKey Source #
Sophie-era stake keys using extended ed25519 cryptographic keys.
They can be used for Sophie stake addresses and witnessing transactions that use stake addresses.
These extended keys are used by HD wallets. So this type provides interoperability with HD wallets. The ITN CLI also supported this key type.
The extended verification keys can be converted (via castVerificationKey)
 to ordinary keys (i.e. VerificationKey StakeKey) but this is not the
 case for the signing keys. The signing keys can be used to witness
 transactions directly, with verification via their non-extended verification
 key (VerificationKey StakeKey).
This is a type level tag, used with other interfaces like Key.
Instances
Internal conversion functions
toSophieAddr ∷ AddressInEra era → Addr StandardCrypto Source #
toSophieStakeAddr ∷ StakeAddress → RewardAcnt StandardCrypto Source #
toSophieStakeCredential ∷ StakeCredential → StakeCredential StandardCrypto Source #
fromSophieAddr ∷ IsSophieBasedEra era ⇒ Addr StandardCrypto → AddressInEra era Source #
fromSophiePaymentCredential ∷ PaymentCredential StandardCrypto → PaymentCredential Source #
fromSophieStakeAddr ∷ RewardAcnt StandardCrypto → StakeAddress Source #
fromSophieStakeCredential ∷ StakeCredential StandardCrypto → StakeCredential Source #
fromSophieStakeReference ∷ StakeReference StandardCrypto → StakeAddressReference Source #
Serialising addresses
class HasTypeProxy addr ⇒ SerialiseAddress addr where Source #
Address serialisation uses different serialisation formats for different kinds of addresses, so it needs its own class.
In particular, Cole addresses are typically formatted in base 58, while Sophie addresses (payment and stake) are formatted using Bech32.
Methods
serialiseAddress ∷ addr → Text Source #
deserialiseAddress ∷ AsType addr → Text → Maybe addr Source #
Instances
| SerialiseAddress StakeAddress Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ StakeAddress → Text Source # deserialiseAddress ∷ AsType StakeAddress → Text → Maybe StakeAddress Source #  | |
| SerialiseAddress AddressAny Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ AddressAny → Text Source # deserialiseAddress ∷ AsType AddressAny → Text → Maybe AddressAny Source #  | |
| IsBccEra era ⇒ SerialiseAddress (AddressInEra era) Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ AddressInEra era → Text Source # deserialiseAddress ∷ AsType (AddressInEra era) → Text → Maybe (AddressInEra era) Source #  | |
| SerialiseAddress (Address SophieAddr) Source # | |
Defined in Bcc.Api.Address Methods serialiseAddress ∷ Address SophieAddr → Text Source # deserialiseAddress ∷ AsType (Address SophieAddr) → Text → Maybe (Address SophieAddr) Source #  | |
| SerialiseAddress (Address ColeAddr) Source # | |
Data family instances
A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.
Values of this type are passed to deserialisation functions for example.
Instances
Helpers
isKeyAddress ∷ AddressInEra era → Bool Source #
Is the UTxO at the address only spendable via a key witness.