icx_addr

Module for Icon address encoding/decoding.

class IcxAddrConst

Bases: object

Class container for Icon address constants.

KEY_HASH_BYTE_LEN: int = 20
class IcxAddrDecoder

Bases: IAddrDecoder

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

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

Decode an Icon 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 IcxAddrEncoder

Bases: IAddrEncoder

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

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

Encode a public key to Icon address.

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

  • **kwargs – Not used

Returns:

Address string

Return type:

str

Raised:

ValueError: If the public key is not valid TypeError: If the public key is not secp256k1

IcxAddr

alias of IcxAddrEncoder