From 0042b5855c5963cda91383014af58bbaf2e9da50 Mon Sep 17 00:00:00 2001 From: drethereum Date: Wed, 6 Dec 2023 14:40:50 -0700 Subject: [PATCH] error logic --- macros/streamline/functions.py.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/macros/streamline/functions.py.sql b/macros/streamline/functions.py.sql index bc64d11..d4fa26a 100644 --- a/macros/streamline/functions.py.sql +++ b/macros/streamline/functions.py.sql @@ -182,11 +182,10 @@ def transform(events: dict): {% macro create_udf_hex_to_base58() %} def transform_hex_to_base58(input): - if input is None: - return None + if input is None or not input.startswith('0x'): + return 'Invalid input' - if input.startswith('0x'): - input = input[2:] + input = input[2:] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" byte_array = bytes.fromhex(input) @@ -307,7 +306,7 @@ def transform_hex_to_tezos(input, prefix): } if prefix not in prefixes: - return 'Invalid prefix' + return 'Invalid prefix: Must be tz1, tz2, or tz3' prefix_bytes = bytes.fromhex(prefixes[prefix])