xlm_addr

Module for Stellar address encoding/decoding.

class XlmAddrTypes(value)

Bases: IntEnum

Enumerative for Stellar address types.

PUB_KEY = 48
PRIV_KEY = 144
class XlmAddrConst

Bases: object

Class container for Stellar address constants.

CHECKSUM_BYTE_LEN: int = 2
class XlmAddrDecoder

Bases: IAddrDecoder

Stellar address decoder class. It allows the Stellar address decoding.

static DecodeAddr(addr: str, **kwargs: Any) bytes

Decode a Stellar address to bytes.

Parameters:
  • addr (str) – Address string

  • addr_type (XlmAddrTypes) – Expected address type (default: public key)

Returns:

Public key bytes

Return type:

bytes

Raises:
  • ValueError – If the address encoding is not valid

  • TypeError – If the address type is not a XlmAddrTypes enum

class XlmAddrEncoder

Bases: IAddrEncoder

Stellar address encoder class. It allows the Stellar address encoding.

static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str

Encode a public key to Stellar address.

Parameters:
  • pub_key (bytes or IPublicKey) – Public key bytes or object

  • addr_type (XlmAddrTypes) – Address type (default: public key)

Returns:

Address string

Return type:

str

Raises:
  • ValueError – If the public key is not valid

  • TypeError – If the public key is not ed25519 or address type is not a XlmAddrTypes enum

XlmAddr

alias of XlmAddrEncoder