update udf (#95)

This commit is contained in:
drethereum 2024-06-27 12:58:40 -06:00 committed by GitHub
parent 554550f414
commit 6709d4655a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,6 +132,14 @@ def transform_base58_to_hex(base58):
base_count = len(ALPHABET)
num = 0
leading_zeros = 0
for char in base58:
if char == '1':
leading_zeros += 1
else:
break
for char in base58:
num *= base_count
if char in ALPHABET:
@ -144,7 +152,9 @@ def transform_base58_to_hex(base58):
if len(hex_string) % 2 != 0:
hex_string = '0' + hex_string
return '0x' + hex_string
hex_leading_zeros = '00' * leading_zeros
return '0x' + hex_leading_zeros + hex_string
{% endmacro %}