diff --git a/uniswap/types.py b/uniswap/types.py index a0a2a38..a43c132 100644 --- a/uniswap/types.py +++ b/uniswap/types.py @@ -46,6 +46,3 @@ class UniswapV4_PathKey: tickSpacing : int # The hooks of the pool hooks : 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 873b00e..6babcaa 100644 --- a/uniswap/uniswap4.py +++ b/uniswap/uniswap4.py @@ -215,9 +215,10 @@ def get_quote_exact_input( :path is a swap route """ + quote_path = [item.astulpe() for item in path] quote_params = { "exactCurrency": currency, - "path": path, + "path": quote_path, "recipient": self.address, "exactAmount": qty, } @@ -238,9 +239,10 @@ def get_quote_exact_output( :path is a swap route """ + quote_path = [item.astulpe() for item in path] quote_params = { "exactCurrency": currency, - "path": path, + "path": quote_path, "recipient": self.address, "exactAmount": qty, } diff --git a/uniswap/util.py b/uniswap/util.py index 1be2f99..7a50c5d 100644 --- a/uniswap/util.py +++ b/uniswap/util.py @@ -81,8 +81,11 @@ def _encode_path(token_in: AddressLike, route: List[Tuple[int, AddressLike]]) -> # Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts -def decode_sqrt_ratioX96(amount_0: int, amount_1: int) -> int: - return int(amount_0 * amount_0 * 10**amount_1 >> 192) +def decode_sqrt_ratioX96(sqrtPriceX96: int) -> float: + Q96 = 2**96 + ratio = sqrtPriceX96 / Q96 + price = ratio**2 + return price # Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts def encode_sqrt_ratioX96(amount_0: int, amount_1: int) -> int: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy