mezoAgent 0.1.4__py3-none-any.whl → 0.2.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.4.dist-info → mezoAgent-0.2.1.dist-info}/METADATA +2 -2
- mezoAgent-0.2.1.dist-info/RECORD +8 -0
- mezo_agent/__init__.py +1 -1
- mezo_agent/transaction.py +54 -2
- mezoAgent-0.1.4.dist-info/RECORD +0 -8
- {mezoAgent-0.1.4.dist-info → mezoAgent-0.2.1.dist-info}/WHEEL +0 -0
- {mezoAgent-0.1.4.dist-info → mezoAgent-0.2.1.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: mezoAgent
|
3
|
-
Version: 0.1
|
3
|
+
Version: 0.2.1
|
4
4
|
Summary: A LangChain based tool kit for AI Agents to send BTC and mUSD transactions on Mezo Matsnet.
|
5
5
|
Author: Dreadwulf
|
6
|
-
Author-email:
|
6
|
+
Author-email: dreadwulf@wtf.com
|
7
7
|
Requires-Python: >=3.7
|
8
8
|
Requires-Dist: web3
|
9
9
|
Requires-Dist: langchain
|
@@ -0,0 +1,8 @@
|
|
1
|
+
mezo_agent/__init__.py,sha256=lsonH0-yY3Die0cRmiwsPSHwZQDh_UEAVIpc2uwZYIM,80
|
2
|
+
mezo_agent/config.py,sha256=c16-JHEbK5rFBKO-QdxBRtrl4DSlYzGckD9BzbTw2dY,1708
|
3
|
+
mezo_agent/parsing.py,sha256=dFqNHGH0LoG4_TEsHKcorj6aY_Rh4H8f5Yj7ZdfKJzE,1454
|
4
|
+
mezo_agent/transaction.py,sha256=IX9X8Wt_vbxwU1VOYCcbm2H9ZPW9NJNoAcULemmTstE,4175
|
5
|
+
mezoAgent-0.2.1.dist-info/METADATA,sha256=Wf-LTpO3t0t1dtiB68gAhW3gKQPfLODdpmFI4mrm6Pk,344
|
6
|
+
mezoAgent-0.2.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
7
|
+
mezoAgent-0.2.1.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
|
8
|
+
mezoAgent-0.2.1.dist-info/RECORD,,
|
mezo_agent/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
from .transaction import mezo_agent_transaction_btc
|
1
|
+
from .transaction import mezo_agent_transaction_btc, mezo_agent_musd_transaction
|
mezo_agent/transaction.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from web3.exceptions import Web3Exception
|
2
2
|
from langchain.tools import tool
|
3
|
-
from .config import web3_instance, sender_address, account
|
3
|
+
from .config import web3_instance, sender_address, account, musd_contract
|
4
4
|
from .parsing import extract_transaction_details
|
5
5
|
|
6
6
|
@tool
|
@@ -50,4 +50,56 @@ def mezo_agent_transaction_btc(transaction_prompt: str) -> str:
|
|
50
50
|
tx_hash = web3_instance.eth.send_raw_transaction(signed_tx.raw_transaction)
|
51
51
|
return f"✅ BTC Transaction Successful! Hash: {tx_hash.hex()}"
|
52
52
|
except Web3Exception as e:
|
53
|
-
return f"❌ BTC Transaction Failed: {str(e)}"
|
53
|
+
return f"❌ BTC Transaction Failed: {str(e)}"
|
54
|
+
|
55
|
+
@tool
|
56
|
+
def mezo_agent_musd_transaction(transaction_prompt: str) -> str:
|
57
|
+
"""
|
58
|
+
Sends mUSD on Mezo Matsnet. Parses a transaction request and executes the transfer.
|
59
|
+
|
60
|
+
The transaction_prompt should contain details including the amount, the currency
|
61
|
+
(which must be "mUSD"), and the recipient's wallet address.
|
62
|
+
"""
|
63
|
+
transaction_details = extract_transaction_details(transaction_prompt)
|
64
|
+
|
65
|
+
if isinstance(transaction_details, str): # Handle errors during extraction
|
66
|
+
return transaction_details
|
67
|
+
|
68
|
+
amount = float(transaction_details["amount"])
|
69
|
+
currency = transaction_details["currency"].lower()
|
70
|
+
recipient = transaction_details["recipient"]
|
71
|
+
|
72
|
+
if currency != "musd":
|
73
|
+
return "❌ This function only supports mUSD transactions."
|
74
|
+
|
75
|
+
# Convert the mUSD amount to its smallest unit (assumes 18 decimals, similar to ETH)
|
76
|
+
amount_token = web3_instance.to_wei(amount, "ether")
|
77
|
+
|
78
|
+
try:
|
79
|
+
# Fetch nonce and gas price for the sender
|
80
|
+
nonce = web3_instance.eth.get_transaction_count(sender_address)
|
81
|
+
gas_price = web3_instance.eth.gas_price
|
82
|
+
|
83
|
+
# Estimate gas required for the token transfer
|
84
|
+
gas_limit = musd_contract.functions.transfer(recipient, amount_token).estimateGas({
|
85
|
+
'from': sender_address
|
86
|
+
})
|
87
|
+
except Exception as e:
|
88
|
+
return f"❌ Failed to prepare mUSD transaction: {str(e)}"
|
89
|
+
|
90
|
+
# Build the transaction for the token transfer
|
91
|
+
tx = musd_contract.functions.transfer(recipient, amount_token).buildTransaction({
|
92
|
+
'chainId': 31611, # Mezo Testnet Chain ID
|
93
|
+
'from': sender_address,
|
94
|
+
'nonce': nonce,
|
95
|
+
'gas': gas_limit,
|
96
|
+
'gasPrice': gas_price
|
97
|
+
})
|
98
|
+
|
99
|
+
try:
|
100
|
+
# Sign and send the transaction
|
101
|
+
signed_tx = account.sign_transaction(tx)
|
102
|
+
tx_hash = web3_instance.eth.send_raw_transaction(signed_tx.raw_transaction)
|
103
|
+
return f"✅ mUSD Transaction Successful! Hash: {tx_hash.hex()}"
|
104
|
+
except Web3Exception as e:
|
105
|
+
return f"❌ mUSD Transaction Failed: {str(e)}"
|
mezoAgent-0.1.4.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
mezo_agent/__init__.py,sha256=CTQD3Y_lY9lzhuTzIeQjqsNzy7sYjOPygVSSK3wBlps,51
|
2
|
-
mezo_agent/config.py,sha256=c16-JHEbK5rFBKO-QdxBRtrl4DSlYzGckD9BzbTw2dY,1708
|
3
|
-
mezo_agent/parsing.py,sha256=dFqNHGH0LoG4_TEsHKcorj6aY_Rh4H8f5Yj7ZdfKJzE,1454
|
4
|
-
mezo_agent/transaction.py,sha256=75q88q94WJLg0UahMhkAfMqSxBfW-bqK3iZMGykmc-k,2069
|
5
|
-
mezoAgent-0.1.4.dist-info/METADATA,sha256=xYqUvTErxTwqLghZILJOFYOAmhOzfx96wOuA8k9eK2Y,343
|
6
|
-
mezoAgent-0.1.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
7
|
-
mezoAgent-0.1.4.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
|
8
|
-
mezoAgent-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|