mm-eth 0.5.3__py3-none-any.whl → 0.5.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mm_eth/ens.py CHANGED
@@ -4,13 +4,20 @@ from mm_std import Err, Ok, Result
4
4
  from mm_eth.utils import get_w3
5
5
 
6
6
 
7
- def get_name(nodes: Nodes, address: str, timeout: int = 10, proxies: Proxies = None, attempts: int = 3) -> Result[str]:
8
- result = Err("not_started")
9
- for _ in range(attempts):
10
- try:
11
- w3 = get_w3(random_node(nodes), timeout=timeout, proxy=random_proxy(proxies))
12
- res = w3.ens.name(w3.to_checksum_address(address)) # type: ignore[union-attr]
13
- return Ok(res or "")
14
- except Exception as e:
15
- result = Err(e)
16
- return result
7
+ def get_name_with_retries(
8
+ rpc_urls: Nodes, address: str, retries: int, timeout: float = 5, proxies: Proxies = None
9
+ ) -> Result[str | None]:
10
+ res: Result[str | None] = Err("not started yet")
11
+ for _ in range(retries):
12
+ res = get_name(random_node(rpc_urls), address, timeout=timeout, proxy=random_proxy(proxies))
13
+ if res.is_ok():
14
+ return res
15
+ return res
16
+
17
+
18
+ def get_name(rpc_url: str, address: str, timeout: float = 5, proxy: str | None = None) -> Result[str | None]:
19
+ try:
20
+ w3 = get_w3(rpc_url, timeout=timeout, proxy=proxy)
21
+ return Ok(w3.ens.name(w3.to_checksum_address(address))) # type: ignore[union-attr]
22
+ except Exception as e:
23
+ return Err(e)
mm_eth/utils.py CHANGED
@@ -186,7 +186,7 @@ def log_topic_to_address(topic: HexBytes | str) -> str:
186
186
  return result
187
187
 
188
188
 
189
- def get_w3(rpc_url: str, timeout: int | None = None, proxy: str | None = None) -> Web3:
189
+ def get_w3(rpc_url: str, timeout: float | None = None, proxy: str | None = None) -> Web3:
190
190
  request_kwargs: dict[str, object] = {"timeout": timeout}
191
191
  if proxy:
192
192
  request_kwargs["proxies"] = {"http": proxy, "https": proxy}
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-eth
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Requires-Python: >=3.12
5
- Requires-Dist: mm-crypto-utils>=0.2.5
6
- Requires-Dist: typer>=0.15.1
5
+ Requires-Dist: mm-crypto-utils>=0.2.6
6
+ Requires-Dist: typer>=0.15.2
7
7
  Requires-Dist: web3~=7.8.0
8
8
  Requires-Dist: websocket-client~=1.8.0
@@ -4,7 +4,7 @@ mm_eth/account.py,sha256=k0MNMatBe0zo1iKZiB_Tq6zyEIo22IncD6ewNUJp3dY,2075
4
4
  mm_eth/anvil.py,sha256=98RCfI7dEpxFBTV6UErYvubWVP3n0ctUFn1--4kZ84U,1603
5
5
  mm_eth/constants.py,sha256=Cy_G-IleBH4gAZ4ok8AGHHlqmdW0ZM7ZldyVpzAfWLs,54
6
6
  mm_eth/deploy.py,sha256=SB3ruY808_5UnG8kHR34uVP66P3zOWZu0ImKD7UUv2s,691
7
- mm_eth/ens.py,sha256=zwwVBk1jikIkPhRAB29T6oNHmWPVBTikTpiOWdzrA04,626
7
+ mm_eth/ens.py,sha256=4sEglXdgemKm9fYLCXEvsEeUpdUCqec1GXPklyp19eQ,851
8
8
  mm_eth/erc20.py,sha256=V__yPDG4ABXWfkSdIqffE5qQDjjZl93287YunllN52A,6804
9
9
  mm_eth/ethernodes.py,sha256=9y_poTmFUj6cnWaT9mtfc6S9lAfVXTwLGRqxMQ8hT0Y,3080
10
10
  mm_eth/json_encoder.py,sha256=S4oD-qfTVztMb4sRpY1puhBQwOBofTyQXWszmdXk4og,433
@@ -12,7 +12,7 @@ mm_eth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  mm_eth/rpc.py,sha256=k0eHxo_Dp6G0fHQ_rD-QbwOJz5ngC6kxBjl5NEHnyw8,13832
13
13
  mm_eth/solc.py,sha256=dYRvT8PjZlLDZhNsc_-0790Eug_ZwU2G-iBfIdGj6wQ,1071
14
14
  mm_eth/tx.py,sha256=efSoMCoWkenbGdHo1_LX66_Edz1HvED5-J_i3wrHwMw,4051
15
- mm_eth/utils.py,sha256=sSxt9GZEntZlT0RU8ht9Qon875HPhpd-1JjgqUBEfVo,7405
15
+ mm_eth/utils.py,sha256=gLWT5I7CxFvfHgTQrZSSHUk3YyaDzdmtHwLHFjwuV3I,7407
16
16
  mm_eth/vault.py,sha256=h8NyiOQh5YFskh1lZA3KyvnJUnxl9769ME2ChplG0CM,1477
17
17
  mm_eth/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  mm_eth/cli/calcs.py,sha256=cLFTYNAN-I53tUiSg-zFfVr2afjIZPftDDjHj16FBz0,1068
@@ -41,7 +41,7 @@ mm_eth/cli/cmd/wallet/private_key_cmd.py,sha256=Fv_2OLog1h32pIP7PJITwl_pHdy3BXva
41
41
  mm_eth/cli/examples/balances.toml,sha256=i_ALpiEcf8-0TFiUg1cgJhxxfHYeBl9x0b3tnUWjswU,421
42
42
  mm_eth/cli/examples/call_contract.toml,sha256=ZQWK-409V_vLIZ2bsRD5RCWPPzShPz2KJTTRQY4YaGw,248
43
43
  mm_eth/cli/examples/transfer.toml,sha256=8mWuphDquoSDJw-hb9VJqtonjmv3kJ5Ip8jJ4t5YnfM,1810
44
- mm_eth-0.5.3.dist-info/METADATA,sha256=MbofJfq7eOCzcFGWPp2teKBuUZ9UiitlVm6DZNQj-xM,207
45
- mm_eth-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
46
- mm_eth-0.5.3.dist-info/entry_points.txt,sha256=aGhpsozl8NIrkuUcX5fSgURCcDhr3ShUdeTSIrJq4oc,46
47
- mm_eth-0.5.3.dist-info/RECORD,,
44
+ mm_eth-0.5.5.dist-info/METADATA,sha256=Bch0lbG9AsT2gpUu-WQvD_nZg0KhjjDnrEIkJrHIgk0,207
45
+ mm_eth-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
46
+ mm_eth-0.5.5.dist-info/entry_points.txt,sha256=aGhpsozl8NIrkuUcX5fSgURCcDhr3ShUdeTSIrJq4oc,46
47
+ mm_eth-0.5.5.dist-info/RECORD,,
File without changes