diff --git a/uniswap/types.py b/uniswap/types.py index acc5105..beb65b7 100644 --- a/uniswap/types.py +++ b/uniswap/types.py @@ -1,6 +1,7 @@ from typing import Union from dataclasses import dataclass from eth_typing.evm import Address, ChecksumAddress +from typing import List, Tuple AddressLike = Union[Address, ChecksumAddress] @@ -44,7 +45,7 @@ class UniswapV4_PathKey: # Ticks that involve positions must be a multiple of tick spacing tickSpacing : int # The hooks of the pool - hooks : list[Address] + hooks : List[Address] - def __repr__(self) -> (Address, Address, int, int, list[Address]): + def __repr__(self) -> Tuple(Address, Address, int, int, List[Address]): return (self.currency0, self.currency1, self.fee, self.tickSpacing, self.hooks) \ No newline at end of file diff --git a/uniswap/uniswap4.py b/uniswap/uniswap4.py index 1278221..24a6831 100644 --- a/uniswap/uniswap4.py +++ b/uniswap/uniswap4.py @@ -130,7 +130,7 @@ def get_quote_exact_input_single( sqrt_price_limit_x96: int = 0, zero_for_one: bool = True, hooks: Union[AddressLike, str, None] = NOHOOK_ADDRESS, - ): + ) -> Any: """ :if `zero_to_one` is true: given `qty` amount of the input `token0`, returns the maximum output amount of output `token1`. :if `zero_to_one` is false: returns the minimum amount of `token0` required to buy `qty` amount of `token1`. @@ -173,7 +173,7 @@ def get_quote_exact_output_single( sqrt_price_limit_x96: int = 0, zero_for_one: bool = True, hooks: Union[AddressLike, str, None] = NOHOOK_ADDRESS, - ): + ) -> Any: """ :if `zero_to_one` is true: given `qty` amount of the input `token0`, returns the maximum output amount of output `token1`. :if `zero_to_one` is false: returns the minimum amount of `token0` required to buy `qty` amount of `token1`. @@ -210,14 +210,11 @@ def get_quote_exact_input( currency: AddressLike, # input token qty: int, path : list[UniswapV4_PathKey], - ): + ) -> Any: """ :path is a swap route """ - if currency0 == currency1: - raise ValueError - quote_params = { "exactCurrency": currency, "path": path, @@ -236,14 +233,11 @@ def get_quote_exact_output( currency: AddressLike, # input token qty: int, path : list[UniswapV4_PathKey], - ): + ) -> Any: """ :path is a swap route """ - if currency0 == currency1: - raise ValueError - quote_params = { "exactCurrency": currency, "path": path,