This commit is contained in:
drethereum 2023-12-05 09:23:00 -07:00
parent 47f46c5fe5
commit 45533df1cd

View File

@ -317,29 +317,8 @@ def transform_hex_to_tezos(input, prefix):
full_hash = prefixed_hash + checksum
tezos_address = transform_hex_to_base58(full_hash.hex())
tezos_address = fsc_utils.create_udf_hex_to_base58(full_hash.hex())
return tezos_address
def transform_hex_to_base58(input):
if input is None:
return None
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
byte_array = bytes.fromhex(input)
num = int.from_bytes(byte_array, 'big')
encoded = ''
while num > 0:
num, remainder = divmod(num, 58)
encoded = ALPHABET[remainder] + encoded
for byte in byte_array:
if byte == 0:
encoded = '1' + encoded
else:
break
return encoded
{% endmacro %}