mezoAgent 0.1.0__py3-none-any.whl → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mezoAgent
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A LangChain tool for sending BTC and mUSD transactions on Mezo Matsnet.
5
5
  Home-page: https://github.com/yourusername/mezoTransactionTool
6
6
  Author: Dreadwulf
@@ -0,0 +1,6 @@
1
+ mezoTransactionTool/__init__.py,sha256=4izlG8P3PTGXZb_RvEQ3HlPMxQ1jzSINnF9nSlxnEXE,161
2
+ mezoTransactionTool/transaction_tools.py,sha256=XlyTaqiDGxN0tyqdyJA6tIX6xq6d6hfaQe-V2XKGcAU,6814
3
+ mezoAgent-0.1.2.dist-info/METADATA,sha256=9-Hi0dTMOqtYOOO8u1kjg-OGgFQTkAFxiy2CH5DP4-A,536
4
+ mezoAgent-0.1.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
5
+ mezoAgent-0.1.2.dist-info/top_level.txt,sha256=Czoa5A8CU_I_oPKDa5OXa5H7RM4Jk94PF9mIpz2V9t4,20
6
+ mezoAgent-0.1.2.dist-info/RECORD,,
@@ -17,19 +17,29 @@ if os.path.exists(USER_ENV_PATH):
17
17
  else:
18
18
  print("⚠️ Warning: No `.env` file found in your project directory! Transactions requiring signing may fail.")
19
19
 
20
- # ✅ Load Private Key from User's `.env`
20
+ # ✅ Load Private Keys from User's `.env`
21
21
  PRIVATE_KEY = os.getenv("PRIVATE_KEY")
22
+ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
22
23
  if not PRIVATE_KEY:
23
24
  print("⚠️ Warning: PRIVATE_KEY not set. Please create a `.env` file in your project with your keys.")
24
25
  PRIVATE_KEY = None # Allow package to be installed but prevent transactions
25
26
 
27
+ RPC_URL = "https://rpc.test.mezo.org"
28
+
29
+ # ✅ Initialize Web3 instance
30
+ web3_instance = Web3(Web3.HTTPProvider(RPC_URL))
31
+
32
+ # ✅ Check if connection is successful
33
+ if not web3_instance.is_connected():
34
+ raise ConnectionError("❌ Failed to connect to Mezo Matsnet RPC.")
35
+
26
36
  # ✅ Create Account Object
27
- account = web3.eth.account.from_key(PRIVATE_KEY)
37
+ account = Web3.eth.account.from_key(PRIVATE_KEY)
28
38
  sender_address = account.address
29
39
 
30
40
  MUSD_ADDRESS = "0x637e22A1EBbca50EA2d34027c238317fD10003eB"
31
41
  ERC20_ABI = json.loads('[{"constant": false, "inputs": [{"name": "recipient", "type": "address"},{"name": "amount", "type": "uint256"}],"name": "transfer","outputs": [{"name": "", "type": "bool"}],"stateMutability": "nonpayable","type":"function"}]')
32
- musd_contract = web3.eth.contract(address=MUSD_ADDRESS, abi=ERC20_ABI)
42
+ musd_contract = Web3.eth.contract(address=MUSD_ADDRESS, abi=ERC20_ABI)
33
43
 
34
44
  # ✅ Define Structured Output Parser for Transaction Details
35
45
  response_schemas = [
@@ -87,19 +97,19 @@ def mezo_agent_transaction_btc(transaction_prompt: str) -> str:
87
97
  return "❌ This function only supports BTC transactions."
88
98
 
89
99
  # ✅ Convert amount to Wei (BTC uses 18 decimals on Mezo Matsnet)
90
- amount_wei = web3.to_wei(amount, "ether")
100
+ amount_wei = Web3.to_wei(amount, "ether")
91
101
 
92
102
  # ✅ Check sender's BTC balance
93
- sender_balance = web3.eth.get_balance(sender_address)
94
- sender_balance_btc = web3.from_wei(sender_balance, "ether")
103
+ sender_balance = Web3.eth.get_balance(sender_address)
104
+ sender_balance_btc = Web3.from_wei(sender_balance, "ether")
95
105
 
96
106
  if sender_balance < amount_wei:
97
107
  return f"❌ Insufficient BTC balance! You have {sender_balance_btc} BTC but need {amount} BTC."
98
108
 
99
109
  # ✅ Fetch nonce and gas price
100
- nonce = web3.eth.get_transaction_count(sender_address)
101
- gas_price = web3.eth.gas_price
102
- gas_limit = web3.eth.estimate_gas({"to": recipient, "value": amount_wei, "from": sender_address})
110
+ nonce = Web3.eth.get_transaction_count(sender_address)
111
+ gas_price = Web3.eth.gas_price
112
+ gas_limit = Web3.eth.estimate_gas({"to": recipient, "value": amount_wei, "from": sender_address})
103
113
 
104
114
  tx = {
105
115
  "to": recipient,
@@ -113,7 +123,7 @@ def mezo_agent_transaction_btc(transaction_prompt: str) -> str:
113
123
  try:
114
124
  # ✅ Sign and send the transaction
115
125
  signed_tx = account.sign_transaction(tx)
116
- tx_hash = web3.eth.send_raw_transaction(signed_tx.raw_transaction)
126
+ tx_hash = Web3.eth.send_raw_transaction(signed_tx.raw_transaction)
117
127
  return f"✅ BTC Transaction Successful! Hash: {tx_hash.hex()}"
118
128
 
119
129
  except Web3Exception as e:
@@ -146,8 +156,8 @@ def mezo_agent_transaction_musd(transaction_prompt: str) -> str:
146
156
 
147
157
  # ✅ Convert amount to Wei (mUSD uses 18 decimals)
148
158
  amount_musd_wei = int(amount * 10**18)
149
- nonce = web3.eth.get_transaction_count(sender_address)
150
- gas_price = web3.eth.gas_price
159
+ nonce = Web3.eth.get_transaction_count(sender_address)
160
+ gas_price = Web3.eth.gas_price
151
161
 
152
162
  try:
153
163
  # ✅ Build the transaction for mUSD transfer
@@ -158,8 +168,8 @@ def mezo_agent_transaction_musd(transaction_prompt: str) -> str:
158
168
  "gasPrice": gas_price,
159
169
  })
160
170
 
161
- signed_txn = web3.eth.account.sign_transaction(txn, PRIVATE_KEY)
162
- tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
171
+ signed_txn = Web3.eth.account.sign_transaction(txn, PRIVATE_KEY)
172
+ tx_hash = Web3.eth.send_raw_transaction(signed_txn.raw_transaction)
163
173
 
164
174
  return f"✅ mUSD Transaction Successful! Hash: {tx_hash.hex()}"
165
175
 
@@ -1,6 +0,0 @@
1
- mezoTransactionTool/__init__.py,sha256=4izlG8P3PTGXZb_RvEQ3HlPMxQ1jzSINnF9nSlxnEXE,161
2
- mezoTransactionTool/transaction_tools.py,sha256=6TlJPFvqB0kSpmjAXKuhPZsJ7JvNcyWYm6TYCCC_Mtc,6488
3
- mezoAgent-0.1.0.dist-info/METADATA,sha256=m8ciD6ojJT8StDWvzwCsHzLSc5HPIxDImbiLl1ujHr8,536
4
- mezoAgent-0.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
5
- mezoAgent-0.1.0.dist-info/top_level.txt,sha256=Czoa5A8CU_I_oPKDa5OXa5H7RM4Jk94PF9mIpz2V9t4,20
6
- mezoAgent-0.1.0.dist-info/RECORD,,