mezoAgent 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {mezoAgent-0.1.0.dist-info → mezoAgent-0.1.1.dist-info}/METADATA +1 -1
- mezoAgent-0.1.1.dist-info/RECORD +6 -0
- mezoTransactionTool/transaction_tools.py +13 -13
- mezoAgent-0.1.0.dist-info/RECORD +0 -6
- {mezoAgent-0.1.0.dist-info → mezoAgent-0.1.1.dist-info}/WHEEL +0 -0
- {mezoAgent-0.1.0.dist-info → mezoAgent-0.1.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
mezoTransactionTool/__init__.py,sha256=4izlG8P3PTGXZb_RvEQ3HlPMxQ1jzSINnF9nSlxnEXE,161
|
2
|
+
mezoTransactionTool/transaction_tools.py,sha256=jvVtD0T72-XR5BlBxZEMV_LMD_u4m2Y00X3Qybo6SXQ,6488
|
3
|
+
mezoAgent-0.1.1.dist-info/METADATA,sha256=xbeDFoJsEQDQBYJK60GjATHq55qXOrjN3o0INUJwjM0,536
|
4
|
+
mezoAgent-0.1.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
5
|
+
mezoAgent-0.1.1.dist-info/top_level.txt,sha256=Czoa5A8CU_I_oPKDa5OXa5H7RM4Jk94PF9mIpz2V9t4,20
|
6
|
+
mezoAgent-0.1.1.dist-info/RECORD,,
|
@@ -24,12 +24,12 @@ if not PRIVATE_KEY:
|
|
24
24
|
PRIVATE_KEY = None # Allow package to be installed but prevent transactions
|
25
25
|
|
26
26
|
# ✅ Create Account Object
|
27
|
-
account =
|
27
|
+
account = Web3.eth.account.from_key(PRIVATE_KEY)
|
28
28
|
sender_address = account.address
|
29
29
|
|
30
30
|
MUSD_ADDRESS = "0x637e22A1EBbca50EA2d34027c238317fD10003eB"
|
31
31
|
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 =
|
32
|
+
musd_contract = Web3.eth.contract(address=MUSD_ADDRESS, abi=ERC20_ABI)
|
33
33
|
|
34
34
|
# ✅ Define Structured Output Parser for Transaction Details
|
35
35
|
response_schemas = [
|
@@ -87,19 +87,19 @@ def mezo_agent_transaction_btc(transaction_prompt: str) -> str:
|
|
87
87
|
return "❌ This function only supports BTC transactions."
|
88
88
|
|
89
89
|
# ✅ Convert amount to Wei (BTC uses 18 decimals on Mezo Matsnet)
|
90
|
-
amount_wei =
|
90
|
+
amount_wei = Web3.to_wei(amount, "ether")
|
91
91
|
|
92
92
|
# ✅ Check sender's BTC balance
|
93
|
-
sender_balance =
|
94
|
-
sender_balance_btc =
|
93
|
+
sender_balance = Web3.eth.get_balance(sender_address)
|
94
|
+
sender_balance_btc = Web3.from_wei(sender_balance, "ether")
|
95
95
|
|
96
96
|
if sender_balance < amount_wei:
|
97
97
|
return f"❌ Insufficient BTC balance! You have {sender_balance_btc} BTC but need {amount} BTC."
|
98
98
|
|
99
99
|
# ✅ Fetch nonce and gas price
|
100
|
-
nonce =
|
101
|
-
gas_price =
|
102
|
-
gas_limit =
|
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})
|
103
103
|
|
104
104
|
tx = {
|
105
105
|
"to": recipient,
|
@@ -113,7 +113,7 @@ def mezo_agent_transaction_btc(transaction_prompt: str) -> str:
|
|
113
113
|
try:
|
114
114
|
# ✅ Sign and send the transaction
|
115
115
|
signed_tx = account.sign_transaction(tx)
|
116
|
-
tx_hash =
|
116
|
+
tx_hash = Web3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
117
117
|
return f"✅ BTC Transaction Successful! Hash: {tx_hash.hex()}"
|
118
118
|
|
119
119
|
except Web3Exception as e:
|
@@ -146,8 +146,8 @@ def mezo_agent_transaction_musd(transaction_prompt: str) -> str:
|
|
146
146
|
|
147
147
|
# ✅ Convert amount to Wei (mUSD uses 18 decimals)
|
148
148
|
amount_musd_wei = int(amount * 10**18)
|
149
|
-
nonce =
|
150
|
-
gas_price =
|
149
|
+
nonce = Web3.eth.get_transaction_count(sender_address)
|
150
|
+
gas_price = Web3.eth.gas_price
|
151
151
|
|
152
152
|
try:
|
153
153
|
# ✅ Build the transaction for mUSD transfer
|
@@ -158,8 +158,8 @@ def mezo_agent_transaction_musd(transaction_prompt: str) -> str:
|
|
158
158
|
"gasPrice": gas_price,
|
159
159
|
})
|
160
160
|
|
161
|
-
signed_txn =
|
162
|
-
tx_hash =
|
161
|
+
signed_txn = Web3.eth.account.sign_transaction(txn, PRIVATE_KEY)
|
162
|
+
tx_hash = Web3.eth.send_raw_transaction(signed_txn.raw_transaction)
|
163
163
|
|
164
164
|
return f"✅ mUSD Transaction Successful! Hash: {tx_hash.hex()}"
|
165
165
|
|
mezoAgent-0.1.0.dist-info/RECORD
DELETED
@@ -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,,
|
File without changes
|
File without changes
|