avax_addr

Module for Avax address encoding/decoding.

class AvaxPChainAddrDecoder

Bases: IAddrDecoder

Avax P-Chain address decoder class. It allows the Avax P-Chain address decoding.

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

Decode an Avax P-Chain address to bytes.

Parameters:
  • addr (str) – Address string

  • **kwargs – Not used

Returns:

Public key hash bytes

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class AvaxPChainAddrEncoder

Bases: IAddrEncoder

Avax P-Chain address encoder class. It allows the Avax P-Chain address encoding.

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

Encode a public key to Avax P-Chain address.

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

  • **kwargs – Not used

Returns:

Address string

Return type:

str

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

  • TypeError – If the public key is not secp256k1

class AvaxXChainAddrDecoder

Bases: IAddrDecoder

Avax X-Chain address decoder class. It allows the Avax X-Chain address decoding.

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

Decode an Avax X-Chain address to bytes.

Parameters:
  • addr (str) – Address string

  • **kwargs – Not used

Returns:

Public key hash bytes

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class AvaxXChainAddrEncoder

Bases: IAddrEncoder

Avax X-Chain address encoder class. It allows the Avax X-Chain address encoding.

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

Encode a public key to Avax X-Chain address.

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

  • **kwargs – Not used

Returns:

Address string

Return type:

str

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

  • TypeError – If the public key is not secp256k1

AvaxPChainAddr

alias of AvaxPChainAddrEncoder

AvaxXChainAddr

alias of AvaxXChainAddrEncoder