aptos_addr

Module for Aptos address encoding/decoding.

class AptosAddrConst

Bases: object

Class container for Aptos address constants.

SINGLE_SIG_SUFFIX_BYTE: bytes = b'\x00'
class AptosAddrDecoder

Bases: IAddrDecoder

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

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

Decode an Aptos address to bytes.

Parameters:
  • addr (str) – Address string

  • **kwargs – Not used

Returns:

Public key bytes

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class AptosAddrEncoder

Bases: IAddrEncoder

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

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

Encode a public key to Aptos address.

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

  • trim_zeroes (bool, optional) – True to trim left zeroes from the address string, false otherwise (default)

Returns:

Address string

Return type:

str

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

  • TypeError – If the public key is not ed25519

AptosAddr

alias of AptosAddrEncoder