web3-agent-kit 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- web3_agent_kit-0.4.0/PKG-INFO +557 -0
- web3_agent_kit-0.4.0/README.md +523 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/pyproject.toml +43 -2
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/__init__.py +31 -1
- web3_agent_kit-0.4.0/src/multi_wallet.py +618 -0
- web3_agent_kit-0.4.0/src/plugins/__init__.py +430 -0
- web3_agent_kit-0.4.0/src/plugins/examples/gas_tracker.py +66 -0
- web3_agent_kit-0.4.0/src/yield_optimizer.py +559 -0
- web3_agent_kit-0.4.0/tests/test_bridge.py +143 -0
- web3_agent_kit-0.4.0/tests/test_defi.py +510 -0
- web3_agent_kit-0.4.0/tests/test_llm.py +156 -0
- web3_agent_kit-0.4.0/tests/test_multi_wallet.py +201 -0
- web3_agent_kit-0.4.0/tests/test_plugins.py +335 -0
- web3_agent_kit-0.4.0/tests/test_portfolio.py +175 -0
- web3_agent_kit-0.4.0/tests/test_sniper.py +186 -0
- web3_agent_kit-0.4.0/tests/test_yield_optimizer.py +262 -0
- web3_agent_kit-0.4.0/web3_agent_kit.egg-info/PKG-INFO +557 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/web3_agent_kit.egg-info/SOURCES.txt +12 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/web3_agent_kit.egg-info/requires.txt +2 -0
- web3_agent_kit-0.3.0/PKG-INFO +0 -333
- web3_agent_kit-0.3.0/README.md +0 -301
- web3_agent_kit-0.3.0/web3_agent_kit.egg-info/PKG-INFO +0 -333
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/LICENSE +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/setup.cfg +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/setup.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/agent.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/bridge.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/chain.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/defi/__init__.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/llm.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/portfolio.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/sniper.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/utils/__init__.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/src/wallet.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/tests/test_core.py +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/web3_agent_kit.egg-info/dependency_links.txt +0 -0
- {web3_agent_kit-0.3.0 → web3_agent_kit-0.4.0}/web3_agent_kit.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: web3-agent-kit
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Open-source framework for building autonomous AI agents that interact with blockchain networks
|
|
5
|
+
Author-email: Maulana <khasbim240803@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ulsreall/web3-agent-kit
|
|
8
|
+
Project-URL: Repository, https://github.com/ulsreall/web3-agent-kit
|
|
9
|
+
Project-URL: Issues, https://github.com/ulsreall/web3-agent-kit/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/ulsreall/web3-agent-kit#readme
|
|
11
|
+
Keywords: web3,ai,agent,blockchain,defi,ethereum,uniswap,llm,yield,multi-wallet,plugins
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: web3>=6.0.0
|
|
25
|
+
Requires-Dist: eth-account>=0.10.0
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
27
|
+
Requires-Dist: requests>=2.31.0
|
|
28
|
+
Requires-Dist: httpx>=0.25.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# 🤖 Web3 Agent Kit
|
|
36
|
+
|
|
37
|
+
> **Build autonomous AI agents that interact with blockchains — in minutes, not months.**
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/web3-agent-kit/)
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
[](https://www.python.org/downloads/)
|
|
42
|
+
[](https://github.com/ulsreall/web3-agent-kit/actions)
|
|
43
|
+
| [](https://github.com/ulsreall/web3-agent-kit#readme) |
|
|
44
|
+
[](https://twitter.com/itseywacc)
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="assets/demo.gif" alt="Web3 Agent Kit Demo" width="700"/>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🤔 Why Web3 Agent Kit?
|
|
53
|
+
|
|
54
|
+
Building AI agents that interact with blockchains is **hard**. You need to juggle RPC providers, wallet management, transaction signing, gas estimation, DeFi protocol ABIs, LLM integration, and safety rails — all before writing a single line of business logic.
|
|
55
|
+
|
|
56
|
+
**Web3 Agent Kit handles all of that for you.**
|
|
57
|
+
|
|
58
|
+
| Pain Point | Without Web3 Agent Kit | With Web3 Agent Kit |
|
|
59
|
+
|------------|------------------------|---------------------|
|
|
60
|
+
| **Setup** | Days of boilerplate | `pip install` → 5 lines of code |
|
|
61
|
+
| **Multi-chain** | Write adapters per chain | Built-in for 7+ chains |
|
|
62
|
+
| **LLM Integration** | Manual prompt engineering | Natural language goals, auto-parsed |
|
|
63
|
+
| **Safety** | Build your own guardrails | Spend limits, kill switch, operator confirmation |
|
|
64
|
+
| **DeFi** | Read docs, write ABIs | Drop-in Uniswap, Aave, bridges |
|
|
65
|
+
| **Yield** | Manual research, claim, compound | Auto-compound, cross-protocol APY comparison |
|
|
66
|
+
| **Multi-wallet** | Manage keys manually | Batch ops, consolidated portfolio, wallet groups |
|
|
67
|
+
| **Extensibility** | Hard-coded logic | Plugin system — community can extend anything |
|
|
68
|
+
| **Error Handling** | Manual retry logic | Auto-fallback across LLM providers & RPCs |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🏗️ Architecture
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
76
|
+
│ User / Application │
|
|
77
|
+
│ "Swap 0.1 ETH to USDC on Base" │
|
|
78
|
+
└──────────────────────────────┬──────────────────────────────────────┘
|
|
79
|
+
│
|
|
80
|
+
▼
|
|
81
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
82
|
+
│ Agent Framework │
|
|
83
|
+
│ ┌───────────┐ ┌──────────────┐ ┌─────────────┐ ┌────────────┐ │
|
|
84
|
+
│ │ Goal │→ │ LLM Planner │→ │ Tool │→ │ Transaction│ │
|
|
85
|
+
│ │ Parser │ │ (cascade) │ │ Router │ │ Executor │ │
|
|
86
|
+
│ └───────────┘ └──────────────┘ └─────────────┘ └─────┬──────┘ │
|
|
87
|
+
└───────────────────────────────────────────────────────────┼────────┘
|
|
88
|
+
│
|
|
89
|
+
┌────────────────────────────┼────────┐
|
|
90
|
+
│ Safety Layer │ │
|
|
91
|
+
│ ┌─────────────────────────┼──────┐ │
|
|
92
|
+
│ │ Spend Governor │ │ │
|
|
93
|
+
│ │ • Per-tx limits │ │ │
|
|
94
|
+
│ │ • Daily caps │ │ │
|
|
95
|
+
│ │ • Kill switch │ │ │
|
|
96
|
+
│ │ • Operator confirmation │ │ │
|
|
97
|
+
│ └─────────────────────────┘ │ │
|
|
98
|
+
└────────────────────────────────────┘
|
|
99
|
+
│
|
|
100
|
+
┌────────────────────────────┼────────┐
|
|
101
|
+
│ Tool Ecosystem │ │
|
|
102
|
+
│ ┌─────────┐ ┌──────────┐ │ │
|
|
103
|
+
│ │ Uniswap │ │ Bridge │ │ │
|
|
104
|
+
│ │ V2/V3 │ │ Agg. │ │ │
|
|
105
|
+
│ ├─────────┤ ├──────────┤ │ │
|
|
106
|
+
│ │ Sniper │ │ Portfolio│ │ │
|
|
107
|
+
│ │ Module │ │ Tracker │ │ │
|
|
108
|
+
│ └─────────┘ └──────────┘ │ │
|
|
109
|
+
└────────────────────────────┼────────┘
|
|
110
|
+
│
|
|
111
|
+
┌────────────────────────────┼────────┐
|
|
112
|
+
│ Chain Abstraction Layer │ │
|
|
113
|
+
│ ┌──────┐ ┌──────┐ ┌────┐ │ │
|
|
114
|
+
│ │ ETH │ │ BASE │ │ARB │ │ │
|
|
115
|
+
│ ├──────┤ ├──────┤ ├────┤ │ │
|
|
116
|
+
│ │ OP │ │ MATIC│ │AVAX│ │ │
|
|
117
|
+
│ ├──────┤ ├──────┤ ├────┤ │ │
|
|
118
|
+
│ │ BSC │ │ │ │ │ │ │
|
|
119
|
+
│ └──────┘ └──────┘ └────┘ │ │
|
|
120
|
+
└────────────────────────────────────┘
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 📊 Comparison vs Alternatives
|
|
126
|
+
|
|
127
|
+
| Feature | Web3 Agent Kit | LangChain + Web3 | Custom Bot | Goat SDK |
|
|
128
|
+
|---------|:--------------:|:----------------:|:----------:|:--------:|
|
|
129
|
+
| **Setup Time** | Minutes | Hours | Days | Hours |
|
|
130
|
+
| **Multi-chain** | 7+ chains | Manual | Manual | Limited |
|
|
131
|
+
| **Built-in LLM** | 6 providers | DIY | ❌ | ❌ |
|
|
132
|
+
| **DeFi Tools** | Uniswap, Aave, bridges | ❌ | ❌ | Limited |
|
|
133
|
+
| **Token Sniper** | ✅ | ❌ | ❌ | ❌ |
|
|
134
|
+
| **Yield Optimizer** | ✅ | ❌ | ❌ | ❌ |
|
|
135
|
+
| **Multi-Wallet** | ✅ | ❌ | ❌ | ❌ |
|
|
136
|
+
| **Plugin System** | ✅ | ❌ | ❌ | ❌ |
|
|
137
|
+
| **Safety Rails** | ✅ Governor | ❌ | ❌ | ❌ |
|
|
138
|
+
| **Natural Language** | ✅ | Partial | ❌ | ❌ |
|
|
139
|
+
| **Python Native** | ✅ | ✅ | Varies | ❌ (TS) |
|
|
140
|
+
| **Type Hints** | ✅ | Partial | Varies | N/A |
|
|
141
|
+
| **Active Maintenance** | ✅ | ✅ | Depends | Limited |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🎯 Quick Start
|
|
146
|
+
|
|
147
|
+
### 1. Install
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install web3-agent-kit
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. Set Environment Variables
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Required: Wallet private key
|
|
157
|
+
export PRIVATE_KEY="0x..."
|
|
158
|
+
|
|
159
|
+
# Required: At least one LLM provider key
|
|
160
|
+
export OPENAI_API_KEY="sk-..." # OpenAI
|
|
161
|
+
export ANTHROPIC_API_KEY="sk-ant-..." # Anthropic (best reasoning)
|
|
162
|
+
export GROQ_API_KEY="gsk_..." # Groq (fastest)
|
|
163
|
+
export DEEPSEEK_API_KEY="sk-..." # DeepSeek (cheapest)
|
|
164
|
+
|
|
165
|
+
# Optional: Custom RPC endpoints (public defaults are provided)
|
|
166
|
+
export ETH_RPC="https://..."
|
|
167
|
+
export BASE_RPC="https://..."
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 3. Write Your First Agent
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from web3_agent_kit import Agent, Wallet, Chain, ChainManager
|
|
174
|
+
from web3_agent_kit.defi import Uniswap
|
|
175
|
+
|
|
176
|
+
# Setup
|
|
177
|
+
chain_manager = ChainManager(chains=[Chain.BASE])
|
|
178
|
+
wallet = Wallet.from_env("PRIVATE_KEY", chain_manager=chain_manager)
|
|
179
|
+
uniswap = Uniswap(chain_manager=chain_manager)
|
|
180
|
+
|
|
181
|
+
# Create agent with LLM reasoning
|
|
182
|
+
agent = Agent(
|
|
183
|
+
wallet=wallet,
|
|
184
|
+
chains=[Chain.BASE],
|
|
185
|
+
tools=[uniswap],
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
# Natural language swap — that's it!
|
|
189
|
+
result = agent.run("Swap 0.1 ETH to USDC on Base")
|
|
190
|
+
print(result)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 4. Run It
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
python my_agent.py
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
> 💡 **Tip:** Start with a small amount on a testnet or use `dry_run=True` mode to validate behavior before going live.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## ✨ Features
|
|
204
|
+
|
|
205
|
+
### 🤖 Core
|
|
206
|
+
- 🔗 **Multi-chain support** — Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BSC
|
|
207
|
+
- 🧠 **LLM-powered reasoning** — Multi-provider cascade (OpenAI, Anthropic, Groq, DeepSeek, OpenRouter, Kimi)
|
|
208
|
+
- 🎯 **Natural language goals** — Tell the agent what to do in plain English
|
|
209
|
+
- 🔐 **Governed signing** — Safety caps, kill-switch, operator confirmation
|
|
210
|
+
|
|
211
|
+
### 💰 DeFi
|
|
212
|
+
- 💱 **Uniswap V2 swaps** — Actual token swaps with quotes, approvals, slippage protection
|
|
213
|
+
- 🌉 **Cross-chain bridges** — Li.Fi + Socket aggregators for best routes
|
|
214
|
+
- 📊 **Portfolio tracking** — Real-time balances, P&L across all chains
|
|
215
|
+
|
|
216
|
+
### 🔫 Sniper
|
|
217
|
+
- 🎯 **Token sniper** — Monitor new liquidity pools, auto-buy safe tokens
|
|
218
|
+
- 🛡️ **Risk assessment** — Honeypot detection, liquidity checks, contract analysis
|
|
219
|
+
- ⚡ **Live monitoring** — Background thread with callback alerts
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 🎯 Showcase
|
|
224
|
+
|
|
225
|
+
### Telegram Bot
|
|
226
|
+
A full-featured Telegram bot built with web3-agent-kit:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
cd showcase/telegram-bot
|
|
230
|
+
pip install -r requirements.txt
|
|
231
|
+
python bot.py
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Features: balance check, token swap, portfolio tracking, token sniper, cross-chain bridge.
|
|
235
|
+
|
|
236
|
+
[](showcase/telegram-bot/)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 📦 Examples
|
|
241
|
+
|
|
242
|
+
| Example | Description |
|
|
243
|
+
|---------|-------------|
|
|
244
|
+
| `examples/llm_swap_agent.py` | LLM-powered natural language swapping |
|
|
245
|
+
| `examples/direct_swap.py` | Programmatic Uniswap swap without LLM |
|
|
246
|
+
| `examples/token_sniper.py` | Monitor new pairs, auto-buy safe tokens |
|
|
247
|
+
| `examples/portfolio_dashboard.py` | Real-time portfolio across chains |
|
|
248
|
+
| `examples/bridge_agent.py` | Cross-chain transfers via Li.Fi/Socket |
|
|
249
|
+
| `examples/swap_agent.py` | Autonomous token swapping |
|
|
250
|
+
| `examples/yield_optimizer.py` | Cross-protocol yield farming + auto-compound |
|
|
251
|
+
| `examples/multi_wallet.py` | Multi-wallet management + batch ops |
|
|
252
|
+
| `examples/plugin_system.py` | Plugin system usage + custom plugins |
|
|
253
|
+
| `examples/airdrop_farmer.py` | Multi-chain airdrop farming |
|
|
254
|
+
| `examples/sniper_bot.py` | Token launch sniper |
|
|
255
|
+
| `examples/portfolio_tracker.py` | Portfolio tracking & reporting |
|
|
256
|
+
| `examples/llm_swap_agent.py` | LLM-powered natural language swapping |
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 🧠 LLM Integration
|
|
261
|
+
|
|
262
|
+
Multi-provider cascade with automatic fallback:
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
from web3_agent_kit.llm import LLM
|
|
266
|
+
|
|
267
|
+
# Auto-detect from environment variables
|
|
268
|
+
llm = LLM()
|
|
269
|
+
|
|
270
|
+
# Cascade order: Anthropic → Kimi → OpenRouter → DeepSeek → Groq → OpenAI
|
|
271
|
+
|
|
272
|
+
# Simple chat
|
|
273
|
+
response = llm.chat("What is the best yield on Base?")
|
|
274
|
+
|
|
275
|
+
# JSON response
|
|
276
|
+
data = llm.chat_json("Analyze this swap: 0.1 ETH to USDC")
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Supported providers:**
|
|
280
|
+
- **Anthropic** (Claude) — Best reasoning
|
|
281
|
+
- **OpenAI** (GPT-4) — General purpose
|
|
282
|
+
- **Groq** (Llama) — Fastest inference
|
|
283
|
+
- **DeepSeek** — Cheapest
|
|
284
|
+
- **OpenRouter** — Multi-model fallback
|
|
285
|
+
- **Kimi** — Long context
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 🔫 Token Sniper
|
|
290
|
+
|
|
291
|
+
Monitor new liquidity pools and auto-buy safe tokens:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
from web3_agent_kit import TokenSniper, SniperConfig, RiskLevel
|
|
295
|
+
|
|
296
|
+
config = SniperConfig(
|
|
297
|
+
max_buy=0.005, # max 0.005 ETH per snipe
|
|
298
|
+
auto_buy=True, # auto-buy safe tokens
|
|
299
|
+
honeypot_check=True, # check if token is honeypot
|
|
300
|
+
min_liquidity=0.5, # min 0.5 ETH liquidity
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
sniper = TokenSniper(chain_manager, wallet, config, uniswap=uniswap)
|
|
304
|
+
|
|
305
|
+
# Scan recent blocks
|
|
306
|
+
pairs = sniper.scan_recent_blocks(num_blocks=100, chain=Chain.BASE)
|
|
307
|
+
|
|
308
|
+
# Or start live monitoring
|
|
309
|
+
sniper.start(chain=Chain.BASE, poll_interval=12)
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## 📊 Portfolio Dashboard
|
|
315
|
+
|
|
316
|
+
Track balances and P&L across chains:
|
|
317
|
+
|
|
318
|
+
```python
|
|
319
|
+
from web3_agent_kit import PortfolioTracker
|
|
320
|
+
|
|
321
|
+
tracker = PortfolioTracker(chain_manager, wallet)
|
|
322
|
+
summary = tracker.get_summary()
|
|
323
|
+
|
|
324
|
+
print(summary)
|
|
325
|
+
# 📊 Portfolio: 0x1234...
|
|
326
|
+
# 💰 Total Value: $12,345.67
|
|
327
|
+
#
|
|
328
|
+
# 🔗 ETHEREUM: $8,000.00
|
|
329
|
+
# Native: 1.5000 ETH ($5,250.00)
|
|
330
|
+
# USDC: 2750.0000 ($2,750.00)
|
|
331
|
+
#
|
|
332
|
+
# 🔗 BASE: $4,345.67
|
|
333
|
+
# Native: 1.2000 ETH ($4,200.00)
|
|
334
|
+
# USDC: 145.6700 ($145.67)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 🌉 Bridge Agent
|
|
340
|
+
|
|
341
|
+
Cross-chain transfers via Li.Fi and Socket:
|
|
342
|
+
|
|
343
|
+
```python
|
|
344
|
+
from web3_agent_kit import BridgeAgent
|
|
345
|
+
|
|
346
|
+
bridge = BridgeAgent(chain_manager, wallet)
|
|
347
|
+
|
|
348
|
+
# Get best routes
|
|
349
|
+
routes = bridge.get_routes("ETH", 0.1, Chain.ETHEREUM, Chain.BASE)
|
|
350
|
+
|
|
351
|
+
for route in routes:
|
|
352
|
+
print(f"{route.bridge_name}: {route.amount_out:.6f} ETH (fee: ${route.fee_usd:.2f})")
|
|
353
|
+
|
|
354
|
+
# Execute transfer
|
|
355
|
+
result = bridge.transfer("ETH", 0.1, Chain.ETHEREUM, Chain.BASE)
|
|
356
|
+
print(f"TX: {result.tx_hash}")
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 🌾 Yield Optimizer
|
|
362
|
+
|
|
363
|
+
Auto-compound and compare yield across DeFi protocols:
|
|
364
|
+
|
|
365
|
+
```python
|
|
366
|
+
from web3_agent_kit import YieldOptimizer, YieldConfig, RiskLevel
|
|
367
|
+
|
|
368
|
+
optimizer = YieldOptimizer(wallet, Chain.ETHEREUM, YieldConfig(
|
|
369
|
+
min_apy=2.0,
|
|
370
|
+
max_risk=RiskLevel.MEDIUM,
|
|
371
|
+
auto_compound_threshold=25,
|
|
372
|
+
))
|
|
373
|
+
|
|
374
|
+
# Scan & compare
|
|
375
|
+
opportunities = optimizer.scan_opportunities("USDC")
|
|
376
|
+
best = optimizer.find_best("USDC", amount=10000)
|
|
377
|
+
|
|
378
|
+
# Deposit & auto-compound
|
|
379
|
+
optimizer.deposit(best, amount=10000)
|
|
380
|
+
optimizer.auto_compound_all()
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Protocols:** Aave V3, Compound V3, Morpho, Lido, Rocket Pool, Fluid
|
|
384
|
+
**Data source:** DeFiLlama API (real-time APY/TVL)
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## 👛 Multi-Wallet Manager
|
|
389
|
+
|
|
390
|
+
Manage multiple wallets with batch operations:
|
|
391
|
+
|
|
392
|
+
```python
|
|
393
|
+
from web3_agent_kit import MultiWalletManager, Chain
|
|
394
|
+
|
|
395
|
+
manager = MultiWalletManager(chain=Chain.ETHEREUM)
|
|
396
|
+
|
|
397
|
+
# Create wallet groups
|
|
398
|
+
manager.create_wallet("trading-01", group="trading")
|
|
399
|
+
manager.create_wallet("airdrop-01", group="airdrop")
|
|
400
|
+
|
|
401
|
+
# Batch send from all airdrop wallets
|
|
402
|
+
results = manager.batch_send(
|
|
403
|
+
recipients=["0xAddr1", "0xAddr2"],
|
|
404
|
+
amount=0.001,
|
|
405
|
+
group_filter="airdrop",
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
# Consolidate funds back
|
|
409
|
+
manager.consolidate_to("main", group_filter="airdrop")
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Features:** Wallet groups, batch send (native + ERC20), consolidated portfolio, fund consolidation.
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## 🔌 Plugin System
|
|
417
|
+
|
|
418
|
+
Extend with community plugins:
|
|
419
|
+
|
|
420
|
+
```python
|
|
421
|
+
from web3_agent_kit.plugins import PluginManager
|
|
422
|
+
|
|
423
|
+
manager = PluginManager()
|
|
424
|
+
manager.load_dir("./my_plugins/")
|
|
425
|
+
manager.setup_all(agent)
|
|
426
|
+
|
|
427
|
+
# Plugins can hook into agent lifecycle
|
|
428
|
+
# manager.before_transaction(tx)
|
|
429
|
+
# manager.on_block(block_number)
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Create a plugin:**
|
|
433
|
+
|
|
434
|
+
```python
|
|
435
|
+
from web3_agent_kit.plugins import Plugin, PluginMeta
|
|
436
|
+
|
|
437
|
+
class MyPlugin(Plugin):
|
|
438
|
+
@property
|
|
439
|
+
def meta(self):
|
|
440
|
+
return PluginMeta(name="my-plugin", version="1.0.0",
|
|
441
|
+
description="Does cool things", author="You")
|
|
442
|
+
|
|
443
|
+
def setup(self, agent):
|
|
444
|
+
self.agent = agent
|
|
445
|
+
|
|
446
|
+
def execute(self, action, **kwargs):
|
|
447
|
+
return {"result": "done"}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Discovery:** Local directories, Python entry points, or manual registration.
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## 📁 Project Structure
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
web3-agent-kit/
|
|
458
|
+
├── src/
|
|
459
|
+
│ ├── __init__.py # Package exports
|
|
460
|
+
│ ├── agent.py # Agent framework + LLM reasoning
|
|
461
|
+
│ ├── llm.py # Multi-provider LLM client
|
|
462
|
+
│ ├── wallet.py # Wallet management + signing
|
|
463
|
+
│ ├── chain.py # Multi-chain RPC + config
|
|
464
|
+
│ ├── sniper.py # Token sniper + monitoring
|
|
465
|
+
│ ├── portfolio.py # Portfolio tracking + P&L
|
|
466
|
+
│ ├── bridge.py # Cross-chain bridge agent
|
|
467
|
+
│ ├── yield_optimizer.py # Yield optimizer + auto-compound
|
|
468
|
+
│ ├── multi_wallet.py # Multi-wallet manager + batch ops
|
|
469
|
+
│ ├── plugins/
|
|
470
|
+
│ │ ├── __init__.py # Plugin system (base, registry, manager)
|
|
471
|
+
│ │ └── examples/
|
|
472
|
+
│ │ └── gas_tracker.py
|
|
473
|
+
│ └── defi/
|
|
474
|
+
│ └── __init__.py # Uniswap, Aerodrome, Aave, Curve
|
|
475
|
+
├── examples/ # 13 ready-to-use examples
|
|
476
|
+
├── tests/ # Test suite
|
|
477
|
+
└── docs/ # Documentation
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## ⚡ Benchmarks
|
|
483
|
+
|
|
484
|
+
> 📝 *Benchmarks will be published after v1.0 release. Numbers below are preliminary estimates on standard hardware.*
|
|
485
|
+
|
|
486
|
+
| Metric | Value | Notes |
|
|
487
|
+
|--------|-------|-------|
|
|
488
|
+
| Swap execution (incl. LLM) | ~3–8s | Depends on LLM provider |
|
|
489
|
+
| Swap execution (no LLM) | ~1–3s | Direct RPC interaction |
|
|
490
|
+
| Portfolio fetch (7 chains) | ~2–4s | Parallel RPC calls |
|
|
491
|
+
| Sniper block scan (100 blocks) | ~5–10s | Per chain |
|
|
492
|
+
| Bridge route discovery | ~1–2s | Aggregator API latency |
|
|
493
|
+
|
|
494
|
+
*Benchmarks run on: Python 3.11, 4-core CPU, SSD, public RPC endpoints.*
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## 🔐 Safety
|
|
499
|
+
|
|
500
|
+
Web3 Agent Kit includes built-in safety features:
|
|
501
|
+
|
|
502
|
+
```python
|
|
503
|
+
from web3_agent_kit.safety import SpendGovernor, SpendLimits
|
|
504
|
+
|
|
505
|
+
governor = SpendGovernor(
|
|
506
|
+
limits=SpendLimits(
|
|
507
|
+
max_per_tx=0.1, # max 0.1 ETH per transaction
|
|
508
|
+
daily_limit=1.0, # max 1 ETH per day
|
|
509
|
+
),
|
|
510
|
+
require_confirm=True, # operator must confirm
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
# Kill switch for emergencies
|
|
514
|
+
governor.kill() # blocks all transactions
|
|
515
|
+
governor.unkill() # resume
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## 🛠️ Supported Chains
|
|
521
|
+
|
|
522
|
+
| Chain | Status | Uniswap | Bridge |
|
|
523
|
+
|-------|--------|---------|--------|
|
|
524
|
+
| Ethereum | ✅ | ✅ | ✅ |
|
|
525
|
+
| Base | ✅ | ✅ | ✅ |
|
|
526
|
+
| Arbitrum | ✅ | ✅ | ✅ |
|
|
527
|
+
| Optimism | ✅ | ✅ | ✅ |
|
|
528
|
+
| Polygon | ✅ | ✅ | ✅ |
|
|
529
|
+
| Avalanche | ✅ | — | ✅ |
|
|
530
|
+
| BSC | ✅ | — | ✅ |
|
|
531
|
+
| Solana | 🔜 | — | — |
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
## 🤝 Contributing
|
|
536
|
+
|
|
537
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## 📄 License
|
|
542
|
+
|
|
543
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## 🙏 Acknowledgments
|
|
548
|
+
|
|
549
|
+
Built with:
|
|
550
|
+
- [web3.py](https://github.com/ethereum/web3.py) — Ethereum interactions
|
|
551
|
+
- [OpenAI](https://openai.com) / [Anthropic](https://anthropic.com) / [Groq](https://groq.com) — LLM providers
|
|
552
|
+
- [Uniswap](https://uniswap.org) — DEX protocol
|
|
553
|
+
- [Li.Fi](https://li.fi) / [Socket](https://socket.tech) — Bridge aggregators
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
**Built by [Maulana](https://github.com/ulsreall)** · [Twitter](https://twitter.com/itseywacc)
|