diff --git a/README.md b/README.md index 6d2becd..42ddfdf 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ --- ## Release Notes +### v1.0.1 + - Fix issue #35 - fails to decode input data when there is too many commands ### v1.0.0 - Add support for SWEEP and PAY_PORTION - Fix decoding issues @@ -171,8 +173,8 @@ The result is a tuple, starting with the "in-token" and ending with the "out-tok The Universal Router allows the chaining of several functions in the same transaction. This codec supports it (at least for supported functions) and exposes public methods that can be chained. -The chaining starts with the `encode.chain()` method and ends with the `build()` one which return the full encoded data to be included in the transaction. -Below some examples of encoded input for one function and one example for 2 functions. +The chaining starts with the `encode.chain()` method and ends with the `build()` one which returns the full encoded data to be included in the transaction. +Below some examples of encoded data for one function and one example for 2 functions. Default values for deadlines and expirations can be computed with the static methods `get_default_deadline()` and `get_default_expiration()` respectively. ```python @@ -357,3 +359,6 @@ transaction["data"] = encoded_data # you can now sign and send the transaction to the UR ``` + +## Tutorials and Recipes: +See the [SDK Wiki](https://github.com/Elnaril/uniswap-universal-router-decoder/wiki). diff --git a/pyproject.toml b/pyproject.toml index a820a98..429719f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "uniswap-universal-router-decoder" -version = "1.0.0" +version = "1.0.1" authors = [ { name="Elnaril", email="elnaril_dev@caramail.com" }, ] @@ -12,7 +12,7 @@ description = "Decode & Encode transaction data sent to Uniswap Universal Router readme = "README.md" requires-python = ">=3.8" classifiers = [ - "Development Status :: 2 - Pre-Alpha", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", @@ -27,7 +27,7 @@ license = {text = "MIT License"} dependencies = [ "web3>=6.0.0,<7.0.0", ] -keywords = ["blockchain", "ethereum", "uniswap", "universal router", "decoder", "encoder", "codec", "wrapper"] +keywords = ["blockchain", "ethereum", "uniswap", "universal router", "decoder", "encoder", "codec", "wrapper", "SDK"] [tool.setuptools] packages = ["uniswap_universal_router_decoder"] diff --git a/tests/test_decoder.py b/tests/test_decoder.py index aebee50..3b3ce7c 100644 --- a/tests/test_decoder.py +++ b/tests/test_decoder.py @@ -40,6 +40,9 @@ 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", "SWEEP") # noqa +trx_hash_10 = HexStr("0x586d51e2f92bd16573f0e7e302755ed02b7c2a4b721d63f46bcdcf7179d2f40e") +expected_function_names_10 = ("WRAP_ETH", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", "V3_SWAP_EXACT_OUT", None, "UNWRAP_WETH", "SWEEP") # noqa + @pytest.mark.parametrize( "trx_hash, w3, rpc_endpoint, expected_fct_names", @@ -53,6 +56,7 @@ (trx_hash_07, w3_instance, None, expected_function_names_07), (trx_hash_08, w3_instance, None, expected_function_names_08), (trx_hash_09, w3_instance, None, expected_function_names_09), + (trx_hash_10, w3_instance, None, expected_function_names_10), ) ) def test_decode_transaction(trx_hash, w3, rpc_endpoint, expected_fct_names): diff --git a/uniswap_universal_router_decoder/_decoder.py b/uniswap_universal_router_decoder/_decoder.py index a48c2f8..27bb93a 100644 --- a/uniswap_universal_router_decoder/_decoder.py +++ b/uniswap_universal_router_decoder/_decoder.py @@ -45,7 +45,7 @@ def function_input(self, input_data: Union[HexStr, HexBytes]) -> Tuple[ContractF command = decoded_input["commands"] command_input = decoded_input["inputs"] decoded_command_input = [] - for i, b in enumerate(command[-7:]): + for i, b in enumerate(command): # iterating over bytes produces integers try: abi_mapping = self._abi_map[_RouterFunction(b)]