mezoAgent 0.6.4__py3-none-any.whl → 0.6.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mezoAgent
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: A Python package for Mezo Agent transactions with LangChain tools
5
5
  Author: Dreadwulf, Duck, Digi
6
6
  Requires-Dist: python-dotenv
@@ -4,13 +4,13 @@ mezo_agent/chat.py,sha256=ZtNurUDV7UzJjbFyU96DNGy37hO3gl0osn19mRu7ER8,859
4
4
  mezo_agent/config.py,sha256=6xFgk80eiBLTasKGW73Ne8hNhMtx8BbQ_Ef79YOyDlc,3233
5
5
  mezo_agent/parsing.py,sha256=dnS5Qw9V8qvSA_IPgn6nCUnyEfZP9TphO8DnH8oUuiM,5080
6
6
  mezo_agent/swap_musd_btc.py,sha256=Co-XcfK73spm94VC6qzGY0VYoGwsMDKKHM8ToGh2JxU,4289
7
- mezo_agent/token_balance_tool.py,sha256=DoNuHLr_b8P-g3AGYO3_D80Z6tDd9LR-kRdxcKAPN38,1448
8
- mezo_agent/token_price_tool.py,sha256=9oayEJm_-lS7SXEcvoKPyJOEVY7EiUO3t_IzKrutgx8,1042
9
- mezo_agent/token_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ mezo_agent/token_balance_tool.py,sha256=n5xkHWGhkJdQZILN0fDe-n4NHgXSHTSloEHJfkLMsWE,1442
8
+ mezo_agent/token_price_tool.py,sha256=vD-ukq0D_4zmjIy9bZ9qL44nGctf-hWzkQuTd-0wy2U,930
9
+ mezo_agent/token_utils.py,sha256=3NH_Z_vbZ0uupuuGjEbmwsbUkubluQbL-0xR9kia7nU,1118
10
10
  mezo_agent/transaction.py,sha256=YpfWrkEaf0YGM_Kc4cFwlT9GmBGZkeJHWm0VGHs9Gks,4199
11
- mezo_agent/utils.py,sha256=XRq--PRJbWlG9kpz99QHWu7mLpYY4MYblm38U1xK4YE,2381
11
+ mezo_agent/utils.py,sha256=hsGtL_iXvUVGnY5aHPQ0v6Jejxd4P4qw0yOtS1omToU,1397
12
12
  mezo_agent/data/new_router.json,sha256=A8U-NVfe1F-hDyR90_SuH8jDAxmzyyHWdJW62j9TZsc,26756
13
- mezoAgent-0.6.4.dist-info/METADATA,sha256=Qoep4c59KYhXpQJIO3G_DKBuQ9zgueA2RIpIdqbUses,273
14
- mezoAgent-0.6.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
15
- mezoAgent-0.6.4.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
16
- mezoAgent-0.6.4.dist-info/RECORD,,
13
+ mezoAgent-0.6.5.dist-info/METADATA,sha256=aww4rbst9dQN-a_KYXzyKDoWTeJunsS26IagAdIs1mM,273
14
+ mezoAgent-0.6.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
15
+ mezoAgent-0.6.5.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
16
+ mezoAgent-0.6.5.dist-info/RECORD,,
@@ -1,7 +1,7 @@
1
1
  from langchain.tools import tool
2
2
  from mezo_agent.config import web3_instance, sender_address, ERC20_ABI
3
3
  from mezo_agent.parsing import extract_balance_details
4
- from mezo_agent.token_utils import get_token_address_by_symbol # ✅ Import from new module
4
+ from mezo_agent.token_utils import get_token_address_by_symbol # ✅ Correct import
5
5
 
6
6
  @tool
7
7
  def mezo_agent_token_balance_tool(balance_prompt: str) -> str:
@@ -33,3 +33,4 @@ def mezo_agent_token_balance_tool(balance_prompt: str) -> str:
33
33
  return f"✅ {token_symbol.upper()} Balance: {balance}"
34
34
  except Exception as e:
35
35
  return f"❌ Failed to fetch balance: {str(e)}"
36
+
@@ -1,7 +1,7 @@
1
1
  from langchain.tools import tool
2
2
  from mezo_agent.config import query_graph
3
3
  from mezo_agent.parsing import extract_price_details
4
- from mezo_agent.token_utils import get_token_address_by_symbol # ✅ Import from new module
4
+ from mezo_agent.utils import get_token_price # ✅ Correct import
5
5
 
6
6
  @tool
7
7
  def mezo_agent_token_price_tool(price_prompt: str) -> str:
@@ -11,8 +11,6 @@ def mezo_agent_token_price_tool(price_prompt: str) -> str:
11
11
  :param price_prompt: User query containing the token symbol.
12
12
  :return: Token price details.
13
13
  """
14
- from mezo_agent.utils import get_token_price # ✅ Import moved inside function
15
-
16
14
  details = extract_price_details(price_prompt)
17
15
 
18
16
  if isinstance(details, str): # Handle extraction errors
@@ -27,3 +25,4 @@ def mezo_agent_token_price_tool(price_prompt: str) -> str:
27
25
  return get_token_price(token_symbol)
28
26
  except Exception as e:
29
27
  return f"❌ Failed to fetch token price: {str(e)}"
28
+
mezo_agent/token_utils.py CHANGED
@@ -0,0 +1,32 @@
1
+ from mezo_agent.config import query_graph, web3_instance
2
+
3
+ def get_token_address_by_symbol(symbol: str) -> str:
4
+ """
5
+ Fetches the token contract address dynamically from the Goldsky subgraph.
6
+ :param symbol: Token symbol (e.g., 'MUSD', 'WBTC').
7
+ :return: Ethereum checksum address of the token.
8
+ """
9
+ if symbol.lower() == "btc":
10
+ symbol = "wtbtc"
11
+
12
+ query_all = '''
13
+ {
14
+ tokens(first: 100) {
15
+ id
16
+ symbol
17
+ }
18
+ }
19
+ '''
20
+ data = query_graph(query_all)
21
+ tokens = data.get("data", {}).get("tokens", [])
22
+
23
+ matching_tokens = [t for t in tokens if t["symbol"].lower() == symbol.lower()]
24
+
25
+ if matching_tokens:
26
+ token_address = matching_tokens[0]["id"]
27
+ checksum_address = web3_instance.to_checksum_address(token_address)
28
+ print(f"✅ Token {symbol} found at address: {checksum_address}") # Debugging
29
+ return checksum_address
30
+ else:
31
+ available_symbols = [t["symbol"] for t in tokens]
32
+ raise Exception(f"❌ Token '{symbol}' not found. Available: {', '.join(available_symbols)}")
mezo_agent/utils.py CHANGED
@@ -1,36 +1,5 @@
1
1
  from mezo_agent.config import web3_instance, query_graph
2
- from mezo_agent.utils import get_token_address_by_symbol
3
-
4
- def get_token_address_by_symbol(symbol: str) -> str:
5
- """
6
- Fetches the token contract address dynamically from the Goldsky subgraph.
7
- :param symbol: Token symbol (e.g., 'MUSD', 'WBTC').
8
- :return: Ethereum checksum address of the token.
9
- """
10
- if symbol.lower() == "btc":
11
- symbol = "wtbtc"
12
-
13
- query_all = '''
14
- {
15
- tokens(first: 100) {
16
- id
17
- symbol
18
- }
19
- }
20
- '''
21
- data = query_graph(query_all)
22
- tokens = data.get("data", {}).get("tokens", [])
23
- matching_tokens = [t for t in tokens if t["symbol"].lower() == symbol.lower()]
24
-
25
- if matching_tokens:
26
- token_address = matching_tokens[0]["id"]
27
- checksum_address = web3_instance.to_checksum_address(token_address)
28
- print(f"✅ Token {symbol} found at address: {checksum_address}") # Debugging
29
- return checksum_address
30
- else:
31
- available_symbols = [t["symbol"] for t in tokens]
32
- raise Exception(f"Token '{symbol}' not found. Available: {', '.join(available_symbols)}")
33
-
2
+ from mezo_agent.token_utils import get_token_address_by_symbol # ✅ Import from token_utils.py
34
3
 
35
4
  def get_token_price(token_symbol: str) -> str:
36
5
  """
@@ -43,7 +12,7 @@ def get_token_price(token_symbol: str) -> str:
43
12
  token_symbol = "wtbtc"
44
13
 
45
14
  try:
46
- token_address = get_token_address_by_symbol(token_symbol)
15
+ token_address = get_token_address_by_symbol(token_symbol) # ✅ Now correctly imported
47
16
  except Exception as e:
48
17
  return f"❌ Token lookup error: {e}"
49
18
 
@@ -67,4 +36,4 @@ def get_token_price(token_symbol: str) -> str:
67
36
  derivedETH = token_data.get("derivedETH", "N/A")
68
37
  return f"✅ Price of {token_symbol.upper()}: {derivedUSD} USD, {derivedETH} ETH."
69
38
  except Exception as e:
70
- return f"❌ Failed to get price data: {e}"
39
+ return f"❌ Failed to get price data: {e}"