diff --git a/tests/test_router_decoder.py b/tests/test_router_decoder.py index 6f07395..1ee6cc1 100644 --- a/tests/test_router_decoder.py +++ b/tests/test_router_decoder.py @@ -53,7 +53,7 @@ def test_build_abi_map(command_id, expected_fct_abi, expected_selector): expected_function_names_05 = (None, None) trx_hash_09 = HexStr("0x2b6af8ef8fe18829a0fcf2b0f391c55daf76f53bb68369ecaefdb1f38045f919") -expected_function_names_09 = ("PERMIT2_PERMIT", "V2_SWAP_EXACT_IN", "V2_SWAP_EXACT_IN", "V3_SWAP_EXACT_IN", "V2_SWAP_EXACT_IN", "V3_SWAP_EXACT_IN", None) +expected_function_names_09 = ("PERMIT2_PERMIT", "V2_SWAP_EXACT_IN", "V2_SWAP_EXACT_IN", "V3_SWAP_EXACT_IN", "V2_SWAP_EXACT_IN", "V3_SWAP_EXACT_IN", None) # noqa @pytest.mark.parametrize( @@ -80,7 +80,7 @@ def test_decode_transaction(trx_hash, w3, rpc_endpoint, expected_fct_names): if expected_name: assert expected_name == command_inputs[i][0].fn_name else: - assert type(command_inputs[i]) == str + assert type(command_inputs[i]) is str int(command_inputs[i], 16) # check the str is actually a hex diff --git a/uniswap_universal_router_decoder/router_decoder.py b/uniswap_universal_router_decoder/router_decoder.py index b0b0579..98d92a4 100644 --- a/uniswap_universal_router_decoder/router_decoder.py +++ b/uniswap_universal_router_decoder/router_decoder.py @@ -113,7 +113,7 @@ def decode_v3_path(v3_fn_name: str, path: Union[bytes, str]) -> Tuple[Union[int, valid_fn_names = ("V3_SWAP_EXACT_IN", "V3_SWAP_EXACT_OUT") if v3_fn_name.upper() not in valid_fn_names: raise ValueError(f"v3_fn_name must be in {valid_fn_names}") - path_str = path.hex() if type(path) == bytes else str(path) + path_str = path.hex() if isinstance(path, bytes) else str(path) path_str = path_str[2:] if path_str.startswith("0x") else path_str path_list: List[Union[int, ChecksumAddress]] = [Web3.toChecksumAddress(path_str[0:40]), ] parsed_remaining_path: List[List[Union[int, ChecksumAddress]]] = [