cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.Types.Address

Description

This module provides the main Address data type used by the wallet.

Synopsis

Documentation

newtype Address Source #

Representation of Cardano addresses.

Addresses are basically a human-friendly representation of public keys. Historically in Cardano, there exist different sort of addresses, and new ones are to come. So far, we can distinguish between three types of address:

  • Byron Random addresses, which holds a payload with derivation path details
  • Byron Sequential addresses, also known as Icarus'style addresses
  • Shelley base addresses, see also implementation-decisions/address

For more details, see also About Address Derivation

Shelley base addresses can be divided into two types:

  • Single Addresses: which only hold a public spending key
  • Group Addresses: which hold both a spending and delegation keys

It'll therefore seem legitimate to represent addresses as:

data Address
  = ByronAddress !ByteString
  | SingleAddress !XPub
  | GroupAddress !XPub XPub

However, there's a major drawback to this approach: we have to consider all three constructors everywhere, and make sure we test every function using them three despite having no need for such fine-grained representation.

Indeed, from the wallet core code, addresses are nothing more than an opaque bunch of bytes that can be compared with each other. When signing transactions, we have to look up addresses anyway and therefore can re-derive their corresponding public keys. The only moment the distinction between address types matters is when it comes to representing addresses at the edge of the application (the API layer). And here, this is precisely where we need to also what target backend we're connected to. Different backends use different encodings which may not be compatible.

Therefore, for simplicity, it's easier to consider addresses as "bytes", and only peak into these bytes whenever we need to do something with them. This makes it fairly clear that addresses are just an opaque string for the wallet layer and that the underlying encoding is rather agnostic to the underlying backend.

Instances

Instances details
Eq Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Ord Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Read Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Show Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Generic Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

NFData Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Hashable Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Buildable Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

PersistFieldSql Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

ToText Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

FromText Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

MkKeyFingerprint SharedKey Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Shared

MkKeyFingerprint ByronKey Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

MkKeyFingerprint ShelleyKey Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Shelley

MkKeyFingerprint IcarusKey Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Icarus

SymbolToField "rndStateAddressAddress" RndStateAddress Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "rndStatePendingAddressAddress" RndStatePendingAddress Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "seqStateAddressAddress" SeqStateAddress Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "txCollateralOutAddress" TxCollateralOut Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "txOutputAddress" TxOut Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "utxoOutputAddress" UTxO Address Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

IsOurs ( RndState n) Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Random

EncodeAddress n => ToJSON ( ApiT Address , Proxy n) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

DecodeAddress n => FromJSON ( ApiT Address , Proxy n) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

EncodeAddress n => ToHttpApiData ( ApiT Address , Proxy n) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

DecodeAddress n => FromHttpApiData ( ApiT Address , Proxy n) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

KnownNat p => IsOurs ( RndAnyState n p) Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Random

SupportsDiscovery n k => IsOurs ( SeqState n k) Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Sequential

SupportsDiscovery n k => IsOurs ( SharedState n k) Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Shared

KnownNat p => IsOurs ( SeqAnyState n k p) Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Sequential

type Rep Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

type Rep Address = D1 (' MetaData "Address" "Cardano.Wallet.Primitive.Types.Address" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "Address" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unAddress") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ByteString )))

data AddressState Source #

Denotes if an address has been previously used or not... whether that be in the output of a transaction on the blockchain or one in our pending set.

Constructors

Used
Unused

Instances

Instances details
Bounded AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Enum AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Eq AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Show AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Generic AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

NFData AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

Buildable AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

PersistFieldSql AddressState Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField AddressState Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

ToText AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

FromText AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

SymbolToField "rndStateAddressStatus" RndStateAddress AddressState Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

SymbolToField "seqStateAddressStatus" SeqStateAddress AddressState Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

ToJSON ( ApiT AddressState ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT AddressState ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep AddressState Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Address

type Rep AddressState = D1 (' MetaData "AddressState" "Cardano.Wallet.Primitive.Types.Address" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Used" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Unused" ' PrefixI ' False ) ( U1 :: Type -> Type ))