示例#1
0
    def stellar_address(self) -> str:
        """Returns the Stellar-encoded address, as a string.

        :return: The Stellar-encoded string representation of the public key.
        """
        return kin_utils.encode_check('account',
                                      bytes(self._verify_key)).decode()
示例#2
0
    def stellar_seed(self) -> str:
        """Returns the Stellar-encoded seed, as a string.

        :return: The Stellar-encoded string representation of the private key.
        """
        return kin_utils.encode_check('seed',
                                      bytes(self._signing_key)).decode()
示例#3
0
def parse_hint(value: bytes) -> str:
    """
    Return a hint for a signature.

    An address is built by:
    1. Prefix byte (0x30 - G)
    2. 32 bytes public key
    3. 2 bytes checksum

    The hint contains the last 4 bytes of the public key, so we can construct a partial address from it.
    More info: https://github.com/stellar/laboratory/blob/master/src/utilities/extrapolateFromXdr.js#L101
    """
    partial_address = utils.encode_check('account', bytes(28) + value)
    partial_address = 'G' + '_' * 46 + partial_address[46:51].decode(
    ) + '_' * 4
    return partial_address
示例#4
0
def parse_account(value: bytes) -> str:
    """Return the address from the address bytes."""
    return utils.encode_check('account', value).decode()