logiqical 0.2.0 → 0.3.1
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.
- package/README.md +402 -81
- package/dist/cli.mjs +3278 -0
- package/dist/index.d.mts +749 -792
- package/dist/index.d.ts +749 -792
- package/dist/index.js +2283 -774
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2268 -773
- package/dist/index.mjs.map +1 -0
- package/package.json +20 -10
package/README.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Logiqical
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The standalone agent wallet SDK for AI agents on Avalanche and Arena. 88 MCP tools, 11 modules, zero backend dependency.
|
|
4
|
+
|
|
5
|
+
**Swap ARENA tokens, stake for rewards, trade launchpad tokens, bridge cross-chain, trade perps, chat on Arena Social, track whale signals** — all from a single SDK with built-in wallet, spending policies, and transaction simulation.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Logiqical } from "logiqical";
|
|
9
|
+
|
|
10
|
+
const agent = await Logiqical.boot({
|
|
11
|
+
policy: { maxPerTx: "1.0", maxPerDay: "10.0", simulateBeforeSend: true },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.log("Agent:", agent.address);
|
|
15
|
+
|
|
16
|
+
// One-liner: policy check + simulate + sign + broadcast
|
|
17
|
+
await agent.execute(agent.swap.buildBuy(agent.address, "0.5"));
|
|
18
|
+
await agent.execute(agent.staking.buildStake(agent.address, "max"));
|
|
19
|
+
await agent.execute(agent.dex.buildSwap(agent.address, "AVAX", "USDC", "1.0"));
|
|
20
|
+
```
|
|
4
21
|
|
|
5
22
|
## Install
|
|
6
23
|
|
|
@@ -10,53 +27,105 @@ npm install logiqical
|
|
|
10
27
|
|
|
11
28
|
## Quick Start
|
|
12
29
|
|
|
30
|
+
### Option 1: Auto-generate wallet (persisted to keystore)
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { Logiqical } from "logiqical";
|
|
34
|
+
|
|
35
|
+
// First run: generates a new wallet + saves encrypted keystore
|
|
36
|
+
// Subsequent runs: loads the same wallet from keystore
|
|
37
|
+
const agent = await Logiqical.boot();
|
|
38
|
+
|
|
39
|
+
console.log("Address:", agent.address);
|
|
40
|
+
console.log("Balance:", await agent.getBalance(), "AVAX");
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Option 2: Import existing wallet
|
|
44
|
+
|
|
13
45
|
```typescript
|
|
14
|
-
|
|
46
|
+
const agent = new Logiqical({
|
|
47
|
+
privateKey: "0x...",
|
|
48
|
+
arenaApiKey: "arena_...", // for Arena Social, Perps, Tickets
|
|
49
|
+
});
|
|
50
|
+
```
|
|
15
51
|
|
|
16
|
-
|
|
17
|
-
|
|
52
|
+
### Option 3: From mnemonic
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const agent = new Logiqical({
|
|
56
|
+
mnemonic: "word1 word2 ... word12",
|
|
57
|
+
});
|
|
58
|
+
```
|
|
18
59
|
|
|
19
|
-
|
|
20
|
-
const bal = await client.swap.getBalances("0xYourWallet");
|
|
60
|
+
### Option 4: Read-only (no signing)
|
|
21
61
|
|
|
22
|
-
|
|
23
|
-
const
|
|
62
|
+
```typescript
|
|
63
|
+
const agent = new Logiqical({ wallet: "0x..." });
|
|
24
64
|
|
|
25
|
-
//
|
|
26
|
-
const
|
|
65
|
+
// Can read data, but cannot execute transactions
|
|
66
|
+
const info = await agent.staking.getInfo(agent.address);
|
|
67
|
+
const quote = await agent.dex.quote("AVAX", "USDC", "1.0");
|
|
68
|
+
```
|
|
27
69
|
|
|
28
|
-
|
|
29
|
-
const buy = await client.launchpad.buildBuy(wallet, tokenId, "0.1");
|
|
70
|
+
## Core Pattern: `execute()`
|
|
30
71
|
|
|
31
|
-
|
|
32
|
-
const tx = await client.dex.buildSwap(wallet, "AVAX", "USDC", "1.0");
|
|
72
|
+
Every module returns unsigned transactions via `build*()` methods. The `execute()` method handles the entire flow:
|
|
33
73
|
|
|
34
|
-
|
|
35
|
-
|
|
74
|
+
**Policy check → Simulate → Sign → Broadcast → Record spend**
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Works with ANY module's build output
|
|
78
|
+
await agent.execute(agent.swap.buildBuy(agent.address, "0.5"));
|
|
79
|
+
await agent.execute(agent.staking.buildStake(agent.address, "1000"));
|
|
80
|
+
await agent.execute(agent.launchpad.buildBuy(agent.address, "42", "0.1"));
|
|
81
|
+
await agent.execute(agent.dex.buildSwap(agent.address, "AVAX", "USDC", "1.0"));
|
|
82
|
+
await agent.execute(agent.tickets.buildBuyTx(agent.address, "0xSubject"));
|
|
83
|
+
await agent.execute(agent.defi.buildSAvaxStake("5.0"));
|
|
36
84
|
```
|
|
37
85
|
|
|
38
86
|
## Modules
|
|
39
87
|
|
|
40
|
-
### `
|
|
88
|
+
### `agent.swap` — ARENA Token Buy & Sell
|
|
89
|
+
|
|
90
|
+
Buy and sell ARENA tokens on the LFJ DEX with one-liner execution.
|
|
41
91
|
|
|
42
92
|
| Method | Description |
|
|
43
93
|
|--------|-------------|
|
|
44
|
-
| `getBalances(wallet)` | AVAX and ARENA balances |
|
|
45
|
-
| `quote(avax)` | Quote AVAX
|
|
46
|
-
| `sellQuote(arena)` | Quote ARENA
|
|
47
|
-
| `buildBuy(wallet, avax, slippage?)` |
|
|
48
|
-
| `buildSell(wallet, amount, slippage?)` |
|
|
94
|
+
| `getBalances(wallet)` | Get AVAX and ARENA balances |
|
|
95
|
+
| `quote(avax)` | Quote AVAX → ARENA |
|
|
96
|
+
| `sellQuote(arena)` | Quote ARENA → AVAX |
|
|
97
|
+
| `buildBuy(wallet, avax, slippage?)` | Buy ARENA with AVAX |
|
|
98
|
+
| `buildSell(wallet, amount, slippage?)` | Sell ARENA for AVAX (`"max"` for all) |
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const quote = await agent.swap.quote("1.0");
|
|
102
|
+
console.log(`1 AVAX = ${quote.arenaOut} ARENA`);
|
|
103
|
+
|
|
104
|
+
await agent.execute(agent.swap.buildBuy(agent.address, "1.0"));
|
|
105
|
+
```
|
|
49
106
|
|
|
50
|
-
### `
|
|
107
|
+
### `agent.staking` — Stake ARENA for Rewards
|
|
108
|
+
|
|
109
|
+
Stake ARENA tokens to earn rewards. Includes a buy-and-stake combo for one-click entry.
|
|
51
110
|
|
|
52
111
|
| Method | Description |
|
|
53
112
|
|--------|-------------|
|
|
54
113
|
| `getInfo(wallet)` | Staked amount, pending rewards, APY |
|
|
55
114
|
| `buildStake(wallet, amount)` | Stake ARENA tokens |
|
|
56
|
-
| `buildBuyAndStake(wallet, avax, slippage?)` | Buy + stake in one flow |
|
|
57
115
|
| `buildUnstake(wallet, amount)` | Unstake and claim rewards |
|
|
116
|
+
| `buildBuyAndStake(wallet, avax)` | Buy ARENA + stake in one flow |
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const info = await agent.staking.getInfo(agent.address);
|
|
120
|
+
console.log(`Staked: ${info.staked} ARENA, Rewards: ${info.pendingRewards}`);
|
|
121
|
+
|
|
122
|
+
// Buy and stake in one execution
|
|
123
|
+
await agent.execute(agent.staking.buildBuyAndStake(agent.address, "2.0"));
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `agent.launchpad` — Arena Launchpad (Bonding Curve Tokens)
|
|
58
127
|
|
|
59
|
-
|
|
128
|
+
Discover, research, and trade tokens on Arena's launchpad bonding curves. Automatically routes graduated tokens through Arena's DEX.
|
|
60
129
|
|
|
61
130
|
#### Discovery
|
|
62
131
|
| Method | Description |
|
|
@@ -74,7 +143,7 @@ await client.broadcast(signedTx);
|
|
|
74
143
|
| `getHolders(address?, tokenId?, count?)` | Top holders with PnL |
|
|
75
144
|
| `getActivity(tokenId?, address?, count?)` | Recent trade history |
|
|
76
145
|
| `getTrades(count?, offset?)` | Global trade feed |
|
|
77
|
-
| `quote(tokenId, side, amount)` | Bonding curve quote |
|
|
146
|
+
| `quote(tokenId, side, amount)` | Bonding curve price quote |
|
|
78
147
|
| `getPortfolio(wallet)` | Your tracked positions |
|
|
79
148
|
| `getMarketCap(tokenId)` | Market cap breakdown |
|
|
80
149
|
| `getOverview()` | Platform stats |
|
|
@@ -82,103 +151,355 @@ await client.broadcast(signedTx);
|
|
|
82
151
|
#### Trading
|
|
83
152
|
| Method | Description |
|
|
84
153
|
|--------|-------------|
|
|
85
|
-
| `buildBuy(wallet, tokenId, avax, slippage?)` | Buy launchpad token (auto-routes graduated
|
|
86
|
-
| `buildSell(wallet, tokenId, amount, slippage?)` | Sell (`"max"` for all, auto-routes graduated) |
|
|
154
|
+
| `buildBuy(wallet, tokenId, avax, slippage?)` | Buy launchpad token (auto-routes graduated via Arena DEX) |
|
|
155
|
+
| `buildSell(wallet, tokenId, amount, slippage?)` | Sell token (`"max"` for all, auto-routes graduated) |
|
|
87
156
|
|
|
88
157
|
#### Token Launch
|
|
89
158
|
| Method | Description |
|
|
90
159
|
|--------|-------------|
|
|
91
|
-
| `launch(wallet, name, symbol, imageBase64?, paymentToken?, initialBuyAvax?)` |
|
|
92
|
-
| `uploadImage(imageBase64, fileType?)` | Upload
|
|
93
|
-
| `buildCreate(wallet, name, symbol, paymentToken?, initialBuyAvax?)` | Build
|
|
160
|
+
| `launch(wallet, name, symbol, imageBase64?, paymentToken?, initialBuyAvax?)` | Launch a new token on Arena |
|
|
161
|
+
| `uploadImage(imageBase64, fileType?)` | Upload image to Arena CDN |
|
|
162
|
+
| `buildCreate(wallet, name, symbol, paymentToken?, initialBuyAvax?)` | Build createToken tx only |
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Find trending tokens
|
|
166
|
+
const hot = await agent.launchpad.getTopVolume("1h");
|
|
167
|
+
console.log("Trending:", hot.map(t => t.name));
|
|
94
168
|
|
|
95
|
-
|
|
169
|
+
// Buy a launchpad token
|
|
170
|
+
await agent.execute(agent.launchpad.buildBuy(agent.address, "42", "0.5"));
|
|
171
|
+
|
|
172
|
+
// Launch your own token
|
|
173
|
+
const result = await agent.launchpad.launch(
|
|
174
|
+
agent.address, "My Token", "MTK", imageBase64, "arena"
|
|
175
|
+
);
|
|
176
|
+
await agent.execute(result);
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### `agent.dex` — Swap Any Avalanche Token
|
|
180
|
+
|
|
181
|
+
Swap any token pair on Avalanche via the LFJ DEX aggregator.
|
|
96
182
|
|
|
97
183
|
| Method | Description |
|
|
98
184
|
|--------|-------------|
|
|
99
|
-
| `getTokens()` | List
|
|
100
|
-
| `getTokenInfo(address)` | On-chain token
|
|
101
|
-
| `quote(from, to, amount)` | Quote any pair |
|
|
185
|
+
| `getTokens()` | List known tokens (AVAX, USDC, USDT, JOE, etc.) |
|
|
186
|
+
| `getTokenInfo(address)` | On-chain token metadata |
|
|
187
|
+
| `quote(from, to, amount)` | Quote any token pair |
|
|
102
188
|
| `getBalance(wallet, token)` | Any token balance |
|
|
103
189
|
| `buildSwap(wallet, from, to, amount, slippage?)` | Swap any pair |
|
|
104
190
|
|
|
105
|
-
|
|
191
|
+
```typescript
|
|
192
|
+
const quote = await agent.dex.quote("AVAX", "USDC", "10.0");
|
|
193
|
+
console.log(`10 AVAX = ${quote.amountOut} USDC`);
|
|
194
|
+
|
|
195
|
+
await agent.execute(agent.dex.buildSwap(agent.address, "AVAX", "USDC", "10.0"));
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### `agent.tickets` — Arena Tickets (Buy & Sell)
|
|
199
|
+
|
|
200
|
+
Trade Arena social tickets — buy and sell tickets tied to Arena users.
|
|
106
201
|
|
|
107
202
|
| Method | Description |
|
|
108
203
|
|--------|-------------|
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
204
|
+
| `getBuyPrice(subject, amount?)` | Get buy price for tickets |
|
|
205
|
+
| `getSellPrice(subject, amount?)` | Get sell price for tickets |
|
|
206
|
+
| `getBalance(subject, user)` | Check ticket balance |
|
|
207
|
+
| `getSupply(subject)` | Total ticket supply |
|
|
208
|
+
| `getFees()` | Fee structure |
|
|
209
|
+
| `buildBuyTx(wallet, subject, amount?)` | Buy tickets |
|
|
210
|
+
| `buildSellTx(wallet, subject, amount?)` | Sell tickets |
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const price = await agent.tickets.getBuyPrice("0xSubject");
|
|
214
|
+
console.log(`Buy price: ${price.priceAvax} AVAX`);
|
|
215
|
+
|
|
216
|
+
await agent.execute(agent.tickets.buildBuyTx(agent.address, "0xSubject"));
|
|
217
|
+
```
|
|
112
218
|
|
|
113
|
-
|
|
219
|
+
### `agent.perps` — Arena Perps (Hyperliquid)
|
|
114
220
|
|
|
115
|
-
|
|
221
|
+
Trade 250+ perpetual futures markets via Arena's Hyperliquid integration.
|
|
222
|
+
|
|
223
|
+
| Method | Description |
|
|
224
|
+
|--------|-------------|
|
|
225
|
+
| `register()` | Register for perps trading |
|
|
226
|
+
| `getRegistrationStatus()` | Check registration |
|
|
227
|
+
| `getWalletAddress()` | Get Hyperliquid wallet |
|
|
228
|
+
| `getTradingPairs()` | All 250+ trading pairs |
|
|
229
|
+
| `updateLeverage(symbol, leverage, type?)` | Set leverage (1-50x) |
|
|
230
|
+
| `placeOrder(orders)` | Place orders |
|
|
231
|
+
| `cancelOrders(cancels)` | Cancel open orders |
|
|
232
|
+
| `closePosition(symbol, side, size, price, pct?)` | Close a position |
|
|
233
|
+
| `getOrders()` | View open orders |
|
|
234
|
+
| `getPositions(wallet)` | Positions + margin summary |
|
|
116
235
|
|
|
117
236
|
```typescript
|
|
118
|
-
|
|
237
|
+
await agent.perps.register();
|
|
238
|
+
await agent.perps.updateLeverage("ETH", 10, "cross");
|
|
239
|
+
await agent.perps.placeOrder([{
|
|
240
|
+
coin: "ETH", isBuy: true, sz: 0.1, limitPx: 3500,
|
|
241
|
+
orderType: { limit: { tif: "Gtc" } }, reduceOnly: false,
|
|
242
|
+
}]);
|
|
243
|
+
```
|
|
119
244
|
|
|
120
|
-
|
|
245
|
+
### `agent.bridge` — Cross-Chain Bridging (Li.Fi)
|
|
246
|
+
|
|
247
|
+
Bridge tokens across 20+ EVM chains via Li.Fi aggregator.
|
|
248
|
+
|
|
249
|
+
| Method | Description |
|
|
250
|
+
|--------|-------------|
|
|
251
|
+
| `getInfo()` | Supported chains, USDC addresses |
|
|
252
|
+
| `getChains()` | All supported bridge chains |
|
|
253
|
+
| `getTokens(chains)` | Tokens available on chains |
|
|
254
|
+
| `getQuote(fromChain, toChain, fromToken, toToken, amount, address, toAddress?, slippage?)` | Bridge quote with transaction |
|
|
255
|
+
| `getRoutes(fromChain, toChain, fromToken, toToken, amount, address)` | Multiple route options |
|
|
256
|
+
| `getStatus(txHash, fromChain, toChain)` | Check transfer status |
|
|
121
257
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
"arena", // "arena" or "avax" paired
|
|
258
|
+
```typescript
|
|
259
|
+
const quote = await agent.bridge.getQuote(
|
|
260
|
+
43114, 42161, // Avalanche → Arbitrum
|
|
261
|
+
"0xNATIVE", "0xNATIVE", // AVAX → ETH
|
|
262
|
+
"10.0", agent.address
|
|
128
263
|
);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### `agent.social` — Arena Social (Chat, Posts, Follow)
|
|
267
|
+
|
|
268
|
+
Full Arena social integration — search users, chat, post threads, follow/unfollow.
|
|
269
|
+
|
|
270
|
+
| Method | Description |
|
|
271
|
+
|--------|-------------|
|
|
272
|
+
| `searchUsers(query)` | Search Arena users |
|
|
273
|
+
| `getUserByHandle(handle)` | Get user by handle |
|
|
274
|
+
| `getMe()` | Your Arena profile |
|
|
275
|
+
| `getTopUsers()` | Top Arena users |
|
|
276
|
+
| `follow(userId)` / `unfollow(userId)` | Follow/unfollow |
|
|
277
|
+
| `updateProfile(params)` | Update profile |
|
|
278
|
+
| `getConversations()` | List chat conversations |
|
|
279
|
+
| `sendMessage(groupId, text, replyId?)` | Send a chat message |
|
|
280
|
+
| `getMessages(groupId, after?)` | Read messages |
|
|
281
|
+
| `createThread(content, replyToId?)` | Create a post |
|
|
282
|
+
| `likeThread(threadId)` | Like a thread |
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
const me = await agent.social.getMe();
|
|
286
|
+
await agent.social.createThread("Just bought 1000 ARENA. LFG!");
|
|
287
|
+
await agent.social.follow("user-uuid");
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### `agent.signals` — Signals Intelligence
|
|
291
|
+
|
|
292
|
+
Real-time market signals — whale tracking, funding rates, technicals, opportunity scanning.
|
|
293
|
+
|
|
294
|
+
| Method | Description |
|
|
295
|
+
|--------|-------------|
|
|
296
|
+
| `getMarketSignal(coin)` | Price, funding, OI, volume signal |
|
|
297
|
+
| `getTechnicalSignal(coin, interval?)` | SMA, RSI, trend, support/resistance |
|
|
298
|
+
| `getWhalePositions(coin, minUsd?)` | Whale positions from orderbook |
|
|
299
|
+
| `getFundingExtremes(count?)` | Funding rate extremes across all markets |
|
|
300
|
+
| `summary(coin)` | Full signal digest + verdict |
|
|
301
|
+
| `scan(count?)` | Scan all markets for top opportunities |
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
const signal = await agent.signals.summary("ETH");
|
|
305
|
+
console.log(`Verdict: ${signal.verdict}`);
|
|
129
306
|
|
|
130
|
-
|
|
131
|
-
// result.community — Arena community metadata
|
|
132
|
-
// result.imageUrl — hosted image URL
|
|
133
|
-
// result.instructions — step-by-step next actions
|
|
307
|
+
const opportunities = await agent.signals.scan(5);
|
|
134
308
|
```
|
|
135
309
|
|
|
136
|
-
|
|
310
|
+
### `agent.market` — Market Data (CoinGecko)
|
|
311
|
+
|
|
312
|
+
Real-time prices, trending coins, and market data via CoinGecko.
|
|
137
313
|
|
|
138
|
-
|
|
314
|
+
| Method | Description |
|
|
315
|
+
|--------|-------------|
|
|
316
|
+
| `price(ids)` | Get price, 24h change, market cap, volume |
|
|
317
|
+
| `trending()` | Trending coins |
|
|
318
|
+
| `markets(count?, page?)` | Top coins by market cap |
|
|
319
|
+
| `search(query)` | Search coins by name/symbol |
|
|
320
|
+
| `avaxPrice()` | AVAX price + 24h change |
|
|
321
|
+
| `arenaPrice()` | ARENA price + 24h change |
|
|
139
322
|
|
|
140
323
|
```typescript
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// → Routes via bonding curve OR Arena DEX automatically
|
|
324
|
+
const avax = await agent.market.avaxPrice();
|
|
325
|
+
console.log(`AVAX: $${avax.usd} (${avax.change24h.toFixed(1)}%)`);
|
|
144
326
|
```
|
|
145
327
|
|
|
146
|
-
|
|
328
|
+
### `agent.defi` — DeFi (sAVAX Liquid Staking + ERC-4626 Vaults)
|
|
147
329
|
|
|
148
|
-
|
|
149
|
-
2. **Initialize** — pass your wallet address
|
|
150
|
-
3. **Trade** — the SDK auto-registers an API key, builds unsigned transactions, you sign and broadcast
|
|
330
|
+
Liquid staking via Benqi (sAVAX) and any ERC-4626 vault on Avalanche.
|
|
151
331
|
|
|
152
|
-
|
|
332
|
+
| Method | Description |
|
|
333
|
+
|--------|-------------|
|
|
334
|
+
| `sAvaxInfo(wallet?)` | Exchange rate, total staked, your balance |
|
|
335
|
+
| `sAvaxStakeQuote(avax)` | Quote AVAX → sAVAX |
|
|
336
|
+
| `buildSAvaxStake(avax)` | Stake AVAX → sAVAX |
|
|
337
|
+
| `buildSAvaxUnstake(wallet, amount)` | Request unstake sAVAX |
|
|
338
|
+
| `vaultInfo(vaultAddress, wallet?)` | ERC-4626 vault info |
|
|
339
|
+
| `vaultDepositQuote(vaultAddress, amount)` | Quote vault deposit |
|
|
340
|
+
| `buildVaultDeposit(wallet, vaultAddress, amount)` | Deposit into vault |
|
|
341
|
+
| `buildVaultWithdraw(wallet, vaultAddress, amount)` | Withdraw from vault |
|
|
153
342
|
|
|
154
|
-
|
|
343
|
+
```typescript
|
|
344
|
+
await agent.execute(agent.defi.buildSAvaxStake("10.0"));
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Spending Policies
|
|
348
|
+
|
|
349
|
+
Protect your agent with configurable guardrails.
|
|
155
350
|
|
|
156
351
|
```typescript
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
352
|
+
const agent = await Logiqical.boot({
|
|
353
|
+
policy: {
|
|
354
|
+
maxPerTx: "1.0", // Max 1 AVAX per transaction
|
|
355
|
+
maxPerHour: "5.0", // Max 5 AVAX per hour
|
|
356
|
+
maxPerDay: "20.0", // Max 20 AVAX per day
|
|
357
|
+
allowedContracts: ["0x..."], // Only interact with these contracts
|
|
358
|
+
simulateBeforeSend: true, // Simulate via eth_call before broadcasting
|
|
359
|
+
dryRun: false, // Set true to test without sending
|
|
360
|
+
},
|
|
162
361
|
});
|
|
362
|
+
|
|
363
|
+
// Check budget any time
|
|
364
|
+
const budget = agent.getBudgetStatus();
|
|
365
|
+
console.log(`Spent today: ${budget.spentToday} / ${budget.dailyLimit} AVAX`);
|
|
366
|
+
|
|
367
|
+
// Update policy on the fly
|
|
368
|
+
agent.updatePolicy({ maxPerTx: "2.0" });
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Smart Contract Calls
|
|
372
|
+
|
|
373
|
+
Call any contract method with policy enforcement.
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
await agent.call({
|
|
377
|
+
contract: "0xTokenAddress",
|
|
378
|
+
abi: ["function transfer(address,uint256) returns (bool)"],
|
|
379
|
+
method: "transfer",
|
|
380
|
+
args: ["0xRecipient", ethers.parseUnits("100", 18)],
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## MCP Server (88 Tools)
|
|
385
|
+
|
|
386
|
+
Run as an MCP server for Claude, Cursor, or any MCP-compatible client.
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
npx logiqical-mcp
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Set environment variables:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
LOGIQICAL_PRIVATE_KEY=0x... # or omit to auto-generate
|
|
396
|
+
LOGIQICAL_NETWORK=avalanche # default
|
|
397
|
+
ARENA_API_KEY=arena_... # for social, perps, tickets
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Or add to your MCP config:
|
|
401
|
+
|
|
402
|
+
```json
|
|
403
|
+
{
|
|
404
|
+
"mcpServers": {
|
|
405
|
+
"logiqical": {
|
|
406
|
+
"command": "npx",
|
|
407
|
+
"args": ["logiqical-mcp"],
|
|
408
|
+
"env": {
|
|
409
|
+
"LOGIQICAL_PRIVATE_KEY": "0x..."
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### All 88 MCP Tools
|
|
417
|
+
|
|
418
|
+
| Category | Tools | Description |
|
|
419
|
+
|----------|-------|-------------|
|
|
420
|
+
| Wallet | 4 | Get address, balance, send AVAX, sign messages |
|
|
421
|
+
| ARENA Token | 6 | Buy/sell ARENA, quotes, balances |
|
|
422
|
+
| ARENA Staking | 4 | Stake, unstake, buy-and-stake, info |
|
|
423
|
+
| DEX | 6 | Swap any token, quotes, balances, token list, info |
|
|
424
|
+
| Arena Launchpad | 6 | Buy/sell launchpad tokens, quotes, discovery |
|
|
425
|
+
| Arena Tickets | 8 | Buy/sell tickets, prices, balances, supply, fees |
|
|
426
|
+
| Cross-Chain Bridge | 8 | Bridge quotes, routes, status, chains, tokens, info |
|
|
427
|
+
| Arena Perps | 9 | Place/cancel orders, positions, leverage, register |
|
|
428
|
+
| Signals Intelligence | 6 | Market signals, technicals, whales, funding, scan |
|
|
429
|
+
| Arena Social | 13 | Chat, DMs, posts, follow, search, profile |
|
|
430
|
+
| Market Data | 6 | Prices, trending, top coins, search, AVAX/ARENA price |
|
|
431
|
+
| DeFi | 8 | sAVAX staking, vault deposit/withdraw, quotes |
|
|
432
|
+
| Policy | 3 | Get/set policy, budget status |
|
|
433
|
+
| Contract Call | 1 | Call any smart contract method |
|
|
434
|
+
| **Total** | **88** | |
|
|
435
|
+
|
|
436
|
+
## Multi-Chain Support
|
|
437
|
+
|
|
438
|
+
20 EVM chains in the built-in registry:
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
// Default: Avalanche
|
|
442
|
+
const agent = await Logiqical.boot();
|
|
443
|
+
|
|
444
|
+
// Use any chain
|
|
445
|
+
const agent = new Logiqical({ privateKey: "0x...", network: "base" });
|
|
446
|
+
|
|
447
|
+
// Switch at runtime
|
|
448
|
+
const baseAgent = agent.switchNetwork("arbitrum");
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Supported chains:** Avalanche, Fuji, Ethereum, Base, Arbitrum, Optimism, Polygon, BSC, Fantom, Gnosis, zkSync Era, Linea, Scroll, Blast, Mantle, Celo, Moonbeam, Sei, Mode, Aurora
|
|
452
|
+
|
|
453
|
+
## Architecture
|
|
454
|
+
|
|
455
|
+
```
|
|
456
|
+
logiqical
|
|
457
|
+
├── Logiqical # Main class — wallet + execute() + policy
|
|
458
|
+
├── AgentWallet # Generate, boot, keystore, sign, broadcast
|
|
459
|
+
├── PolicyEngine # Per-tx limits, budgets, simulation, dry-run
|
|
460
|
+
├── Modules
|
|
461
|
+
│ ├── SwapModule # ARENA token buy/sell
|
|
462
|
+
│ ├── StakingModule # ARENA staking + rewards
|
|
463
|
+
│ ├── LaunchpadModule # Arena launchpad bonding curves
|
|
464
|
+
│ ├── DexModule # Any-token swaps (LFJ DEX)
|
|
465
|
+
│ ├── TicketsModule # Arena social tickets
|
|
466
|
+
│ ├── PerpsModule # Perpetual futures (Hyperliquid)
|
|
467
|
+
│ ├── BridgeModule # Cross-chain (Li.Fi)
|
|
468
|
+
│ ├── SocialModule # Arena chat, posts, follow
|
|
469
|
+
│ ├── SignalsModule # Market intelligence
|
|
470
|
+
│ ├── MarketModule # CoinGecko data
|
|
471
|
+
│ └── DefiModule # sAVAX + ERC-4626 vaults
|
|
472
|
+
├── MCP Server # 88-tool server for AI agents
|
|
473
|
+
└── Errors # Typed errors with codes
|
|
163
474
|
```
|
|
164
475
|
|
|
165
476
|
## Features
|
|
166
477
|
|
|
167
|
-
- **
|
|
168
|
-
- **
|
|
169
|
-
- **
|
|
170
|
-
- **
|
|
171
|
-
- **
|
|
172
|
-
- **
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
175
|
-
- **
|
|
478
|
+
- **Standalone** — no backend needed, direct contract calls + API calls
|
|
479
|
+
- **Agent wallet** — generate, boot from keystore, import key or mnemonic
|
|
480
|
+
- **execute() pattern** — one-liner: policy → simulate → sign → broadcast
|
|
481
|
+
- **Spending policies** — per-tx limits, hourly/daily budgets, allowlists, dry-run
|
|
482
|
+
- **Transaction simulation** — eth_call before broadcast catches reverts early
|
|
483
|
+
- **88 MCP tools** — plug into Claude, Cursor, or any MCP client
|
|
484
|
+
- **11 modules** — ARENA swap, staking, launchpad, DEX, tickets, perps, bridge, social, signals, market, DeFi
|
|
485
|
+
- **20 EVM chains** — Avalanche, Ethereum, Base, Arbitrum, and 16 more
|
|
486
|
+
- **Typed errors** — `LogiqicalError` with codes like `SLIPPAGE_EXCEEDED`, `CONTRACT_REVERT`
|
|
487
|
+
- **Dual build** — ESM + CJS + TypeScript declarations
|
|
488
|
+
- **SSRF protection** — safe fetch with HTTPS enforcement, timeout, size limits
|
|
489
|
+
|
|
490
|
+
## Acknowledgments
|
|
491
|
+
|
|
492
|
+
SDK architecture inspired by [Evalanche](https://github.com/iJaack/Evalanche) by [@iJaack](https://github.com/iJaack) — the `execute()` pattern, spending policies, keystore boot flow, and MCP server design were influenced by his work on agent tooling for Avalanche.
|
|
176
493
|
|
|
177
494
|
## Built on
|
|
178
495
|
|
|
179
496
|
- [Avalanche C-Chain](https://avax.network)
|
|
180
|
-
- [Arena](https://arena.social)
|
|
181
|
-
- [
|
|
497
|
+
- [Arena](https://arena.social) — Social, Perps, Launchpad, Tickets
|
|
498
|
+
- [LFJ (Trader Joe)](https://lfj.gg) — DEX aggregation
|
|
499
|
+
- [Benqi](https://benqi.fi) — sAVAX liquid staking
|
|
500
|
+
- [Li.Fi](https://li.fi) — Cross-chain bridging
|
|
501
|
+
- [Hyperliquid](https://hyperliquid.xyz) — Perpetual futures
|
|
502
|
+
- [CoinGecko](https://coingecko.com) — Market data
|
|
182
503
|
|
|
183
504
|
## License
|
|
184
505
|
|