ada_shelley_addr
Module for Cardano Shelley address encoding/decoding. Reference: https://cips.cardano.org/cips/cip19
- class AdaShelleyAddrNetworkTags(value)
Bases:
IntEnum
Enumerative for Cardano Shelley network tags.
- TESTNET = 0
- MAINNET = 1
- class AdaShelleyAddrHeaderTypes(value)
Bases:
IntEnum
Enumerative for Cardano Shelley header types.
- PAYMENT = 0
- REWARD = 14
- class AdaShelleyAddrConst
Bases:
object
Class container for Cardano Shelley address constants.
- NETWORK_TAG_TO_ADDR_HRP: Dict[AdaShelleyAddrNetworkTags, str] = {AdaShelleyAddrNetworkTags.TESTNET: 'addr_test', AdaShelleyAddrNetworkTags.MAINNET: 'addr'}
- NETWORK_TAG_TO_REWARD_ADDR_HRP: Dict[AdaShelleyAddrNetworkTags, str] = {AdaShelleyAddrNetworkTags.TESTNET: 'stake_test', AdaShelleyAddrNetworkTags.MAINNET: 'stake'}
- class AdaShelleyAddrDecoder
Bases:
IAddrDecoder
Cardano Shelley address decoder class. It allows the Cardano Shelley address decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode a Cardano Shelley address to bytes.
- Parameters:
addr (str) – Address string
**kwargs – Not used
net_tag (AdaShelleyAddrNetworkTags) – Expected network tag (default: main net)
- Returns:
Public keys hash bytes (public key + public staking key)
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
TypeError – If the network tag is not a AdaShelleyAddrNetworkTags enum
- class AdaShelleyAddrEncoder
Bases:
IAddrEncoder
Cardano Shelley address encoder class. It allows the Cardano Shelley address encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to Cardano Shelley address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
pub_skey (bytes or IPublicKey) – Public staking key bytes or object
net_tag (AdaShelleyAddrNetworkTags) – Network tag (default: main net)
- Returns:
Address string
- Return type:
str
- Raises:
ValueError – If the public key is not valid
TypeError – If the public key is not ed25519 or the network tag is not a AdaShelleyAddrNetworkTags enum
- class AdaShelleyStakingAddrDecoder
Bases:
IAddrDecoder
Cardano Shelley staking address decoder class. It allows the Cardano Shelley staking address decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode a Cardano Shelley address to bytes.
- Parameters:
addr (str) – Address string
**kwargs – Not used
net_tag (AdaShelleyAddrNetworkTags) – Network tag (default: main net)
- Returns:
Public keys hash bytes (public key + public staking key)
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
TypeError – If the network tag is not a AdaShelleyAddrNetworkTags enum
- class AdaShelleyStakingAddrEncoder
Bases:
IAddrEncoder
Cardano Shelley staking address encoder class. It allows the Cardano Shelley staking address encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to Cardano Shelley staking address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
net_tag (AdaShelleyAddrNetworkTags) – Network tag (default: main net)
- Returns:
Address string
- Return type:
str
- Raises:
ValueError – If the public key is not valid
TypeError – If the public key is not ed25519 or the network tag is not a AdaShelleyAddrNetworkTags enum
- AdaShelleyAddr
alias of
AdaShelleyAddrEncoder
- AdaShelleyStakingAddr
alias of
AdaShelleyStakingAddrEncoder
- AdaShelleyRewardAddrDecoder
alias of
AdaShelleyStakingAddrDecoder
- AdaShelleyRewardAddrEncoder
alias of
AdaShelleyStakingAddrEncoder
- AdaShelleyRewardAddr
alias of
AdaShelleyStakingAddrEncoder