@agether/agether 2.12.2 → 2.13.0
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 +3 -1
- package/package.json +2 -2
- package/skills/agether/SKILL.md +6 -4
- package/src/index.ts +121 -29
package/README.md
CHANGED
|
@@ -115,7 +115,9 @@ Once installed, the following tools are available to your AI agent:
|
|
|
115
115
|
| `morpho_repay` | Repay USDC debt |
|
|
116
116
|
| `morpho_withdraw` | Withdraw collateral back to EOA |
|
|
117
117
|
| `morpho_sponsor` | Deposit collateral for another agent (by ID or address) |
|
|
118
|
-
| `
|
|
118
|
+
| `wallet_fund_token` | Transfer any ERC-20 from EOA into AgentAccount |
|
|
119
|
+
| `wallet_transfer` | Transfer any token/ETH from AgentAccount to any address or agent |
|
|
120
|
+
| `wallet_approve` | Approve a spender for tokens in AgentAccount |
|
|
119
121
|
| `x402_pay` | Make paid API calls via x402 protocol (supports auto-draw) |
|
|
120
122
|
|
|
121
123
|
## Slash Commands
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agether/agether",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "OpenClaw plugin for Agether — onchain credit for AI agents on Ethereum & Base",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"openclaw": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@agether/sdk": "^2.
|
|
12
|
+
"@agether/sdk": "^2.15.0",
|
|
13
13
|
"axios": "^1.6.0",
|
|
14
14
|
"ethers": "^6.9.0"
|
|
15
15
|
},
|
package/skills/agether/SKILL.md
CHANGED
|
@@ -127,7 +127,7 @@ Both `agether_set_agent` and `agether_register` save the agentId to config perma
|
|
|
127
127
|
### Wallet (move funds between EOA ↔ AgentAccount)
|
|
128
128
|
| Tool | Params | What it does |
|
|
129
129
|
|------|--------|-------------|
|
|
130
|
-
| `
|
|
130
|
+
| `wallet_fund_token` | `token`, `amount` | Transfer any ERC-20 token from EOA → AgentAccount |
|
|
131
131
|
| `wallet_withdraw_token` | `token`, `amount` | Withdraw any ERC-20 token from AgentAccount → EOA. Use `amount: "all"` for full balance. |
|
|
132
132
|
| `wallet_withdraw_eth` | `amount` | Withdraw ETH from AgentAccount → EOA. Use `amount: "all"` for full balance. |
|
|
133
133
|
|
|
@@ -251,7 +251,7 @@ IF no auto-funding configured:
|
|
|
251
251
|
```
|
|
252
252
|
1. Check token availability:
|
|
253
253
|
- agether_health for AgentAccount balances
|
|
254
|
-
- If no tokens in AgentAccount but exists in EOA →
|
|
254
|
+
- If no tokens in AgentAccount but exists in EOA → wallet_fund_token first
|
|
255
255
|
2. morpho_markets ← show supply APYs to pick best market
|
|
256
256
|
3. morpho_supply(amount, market?, loanToken?) ← supply tokens to earn yield
|
|
257
257
|
4. Later: morpho_supply_status ← check earned yield
|
|
@@ -450,7 +450,7 @@ If something **fails**:
|
|
|
450
450
|
| `Payment rejected (402)` | No USDC for x402 payment | Borrow USDC first, or enable autoDraw/autoYield in config |
|
|
451
451
|
| `No collateral deposited` | Trying to borrow without collateral | `morpho_deposit` first |
|
|
452
452
|
| `Insufficient collateral` | EOA doesn't have enough of that token | Tell user to send collateral to EOA address |
|
|
453
|
-
| `Insufficient USDC in AgentAccount` | Not enough loan token for repay/pay | Fund via borrow, yield withdrawal, or `
|
|
453
|
+
| `Insufficient USDC in AgentAccount` | Not enough loan token for repay/pay | Fund via borrow, yield withdrawal, or `wallet_fund_token` |
|
|
454
454
|
| `ExecutionFailed` | Smart contract call reverted | Check inner error, usually LTV or approval issue |
|
|
455
455
|
| `PositionNotActive` | No collateral deposited for this token | Deposit collateral with `morpho_deposit` first |
|
|
456
456
|
|
|
@@ -494,7 +494,9 @@ Morpho Blue (direct lending, overcollateralized 125%)
|
|
|
494
494
|
└── Yield tracked via Morpho GraphQL API (no database needed)
|
|
495
495
|
|
|
496
496
|
Wallet transfers:
|
|
497
|
-
├──
|
|
497
|
+
├── wallet_fund_token → any ERC-20 from EOA → AgentAccount
|
|
498
|
+
├── wallet_transfer → any ERC-20 or ETH from AgentAccount → any address/agent
|
|
499
|
+
├── wallet_approve → approve spender for tokens in AgentAccount
|
|
498
500
|
├── wallet_withdraw_token → any ERC-20 from AgentAccount → EOA
|
|
499
501
|
└── wallet_withdraw_eth → ETH from AgentAccount → EOA
|
|
500
502
|
```
|
package/src/index.ts
CHANGED
|
@@ -1180,34 +1180,6 @@ export default function register(api: any) {
|
|
|
1180
1180
|
},
|
|
1181
1181
|
});
|
|
1182
1182
|
|
|
1183
|
-
// ═══════════════════════════════════════════════════════
|
|
1184
|
-
// TOOL: wallet_fund
|
|
1185
|
-
// ═══════════════════════════════════════════════════════
|
|
1186
|
-
api.registerTool({
|
|
1187
|
-
name: "wallet_fund",
|
|
1188
|
-
description: "Transfer USDC from EOA wallet into AgentAccount.",
|
|
1189
|
-
parameters: {
|
|
1190
|
-
type: "object",
|
|
1191
|
-
properties: {
|
|
1192
|
-
amount: { type: "string", description: "USDC amount (e.g. '50')" },
|
|
1193
|
-
},
|
|
1194
|
-
required: ["amount"],
|
|
1195
|
-
},
|
|
1196
|
-
async execute(_id: string, params: { amount: string }) {
|
|
1197
|
-
try {
|
|
1198
|
-
const cfg = getConfig(api);
|
|
1199
|
-
requireChain(cfg);
|
|
1200
|
-
const client = createAgetherClient(cfg);
|
|
1201
|
-
const result = await client.fundAccount(params.amount);
|
|
1202
|
-
return ok(JSON.stringify({
|
|
1203
|
-
status: "funded",
|
|
1204
|
-
amount: `$${params.amount}`,
|
|
1205
|
-
tx: txLink(result.txHash),
|
|
1206
|
-
}));
|
|
1207
|
-
} catch (e) { return fail(e); }
|
|
1208
|
-
},
|
|
1209
|
-
});
|
|
1210
|
-
|
|
1211
1183
|
// ═══════════════════════════════════════════════════════
|
|
1212
1184
|
// TOOL: wallet_withdraw_token
|
|
1213
1185
|
// ═══════════════════════════════════════════════════════
|
|
@@ -1274,6 +1246,126 @@ export default function register(api: any) {
|
|
|
1274
1246
|
},
|
|
1275
1247
|
});
|
|
1276
1248
|
|
|
1249
|
+
// ═══════════════════════════════════════════════════════
|
|
1250
|
+
// TOOL: wallet_fund_token
|
|
1251
|
+
// ═══════════════════════════════════════════════════════
|
|
1252
|
+
api.registerTool({
|
|
1253
|
+
name: "wallet_fund_token",
|
|
1254
|
+
description:
|
|
1255
|
+
"Transfer any ERC-20 token from EOA wallet into AgentAccount. " +
|
|
1256
|
+
"Works with USDC, WETH, wstETH, cbBTC, or any token supported by Morpho markets.",
|
|
1257
|
+
parameters: {
|
|
1258
|
+
type: "object",
|
|
1259
|
+
properties: {
|
|
1260
|
+
token: { type: "string", description: "Token to transfer (e.g. 'USDC', 'WETH')" },
|
|
1261
|
+
amount: { type: "string", description: "Amount to transfer (e.g. '100')" },
|
|
1262
|
+
},
|
|
1263
|
+
required: ["token", "amount"],
|
|
1264
|
+
},
|
|
1265
|
+
async execute(_id: string, params: { token: string; amount: string }) {
|
|
1266
|
+
try {
|
|
1267
|
+
const cfg = getConfig(api);
|
|
1268
|
+
requireChain(cfg);
|
|
1269
|
+
const client = createAgetherClient(cfg);
|
|
1270
|
+
const result = await client.fundAccountToken(params.token, params.amount);
|
|
1271
|
+
return ok(JSON.stringify({
|
|
1272
|
+
status: "funded",
|
|
1273
|
+
amount: `${params.amount} ${params.token}`,
|
|
1274
|
+
tx: txLink(result.txHash),
|
|
1275
|
+
}));
|
|
1276
|
+
} catch (e) { return fail(e); }
|
|
1277
|
+
},
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
// ═══════════════════════════════════════════════════════
|
|
1281
|
+
// TOOL: wallet_transfer
|
|
1282
|
+
// ═══════════════════════════════════════════════════════
|
|
1283
|
+
api.registerTool({
|
|
1284
|
+
name: "wallet_transfer",
|
|
1285
|
+
description:
|
|
1286
|
+
"Transfer any ERC-20 token or ETH from AgentAccount to any address or agent. " +
|
|
1287
|
+
"Specify either 'address' (0x...) or 'agentId' as destination. " +
|
|
1288
|
+
"Set token to 'ETH' for native ETH transfers. Use amount 'all' to send full balance.",
|
|
1289
|
+
parameters: {
|
|
1290
|
+
type: "object",
|
|
1291
|
+
properties: {
|
|
1292
|
+
token: { type: "string", description: "Token to send (e.g. 'USDC', 'WETH', 'ETH')" },
|
|
1293
|
+
amount: { type: "string", description: "Amount to send (e.g. '100' or 'all')" },
|
|
1294
|
+
address: { type: "string", description: "Destination address (0x...)" },
|
|
1295
|
+
agentId: { type: "string", description: "Destination agent ID" },
|
|
1296
|
+
},
|
|
1297
|
+
required: ["token", "amount"],
|
|
1298
|
+
},
|
|
1299
|
+
async execute(_id: string, params: { token: string; amount: string; address?: string; agentId?: string }) {
|
|
1300
|
+
try {
|
|
1301
|
+
const cfg = getConfig(api);
|
|
1302
|
+
requireChain(cfg);
|
|
1303
|
+
const client = createAgetherClient(cfg);
|
|
1304
|
+
|
|
1305
|
+
if (!params.address && !params.agentId) {
|
|
1306
|
+
return fail(new Error("Provide either 'address' or 'agentId' as destination"));
|
|
1307
|
+
}
|
|
1308
|
+
const to = params.address ? { address: params.address } : { agentId: params.agentId };
|
|
1309
|
+
|
|
1310
|
+
let result;
|
|
1311
|
+
if (params.token.toUpperCase() === 'ETH') {
|
|
1312
|
+
result = await client.transferEth(params.amount, to);
|
|
1313
|
+
} else {
|
|
1314
|
+
result = await client.transferToken(params.token, params.amount, to);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
return ok(JSON.stringify({
|
|
1318
|
+
status: "transferred",
|
|
1319
|
+
amount: `${result.amount} ${result.token}`,
|
|
1320
|
+
destination: result.destination,
|
|
1321
|
+
tx: txLink(result.tx),
|
|
1322
|
+
}));
|
|
1323
|
+
} catch (e) { return fail(e); }
|
|
1324
|
+
},
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
// ═══════════════════════════════════════════════════════
|
|
1328
|
+
// TOOL: wallet_approve
|
|
1329
|
+
// ═══════════════════════════════════════════════════════
|
|
1330
|
+
api.registerTool({
|
|
1331
|
+
name: "wallet_approve",
|
|
1332
|
+
description:
|
|
1333
|
+
"Approve a spender (address or agent) to use ERC-20 tokens from AgentAccount. " +
|
|
1334
|
+
"Specify either 'address' (0x...) or 'agentId' as spender. " +
|
|
1335
|
+
"Use amount 'max' for unlimited approval.",
|
|
1336
|
+
parameters: {
|
|
1337
|
+
type: "object",
|
|
1338
|
+
properties: {
|
|
1339
|
+
token: { type: "string", description: "Token to approve (e.g. 'USDC', 'WETH')" },
|
|
1340
|
+
amount: { type: "string", description: "Allowance amount (e.g. '1000' or 'max')" },
|
|
1341
|
+
address: { type: "string", description: "Spender address (0x...)" },
|
|
1342
|
+
agentId: { type: "string", description: "Spender agent ID" },
|
|
1343
|
+
},
|
|
1344
|
+
required: ["token", "amount"],
|
|
1345
|
+
},
|
|
1346
|
+
async execute(_id: string, params: { token: string; amount: string; address?: string; agentId?: string }) {
|
|
1347
|
+
try {
|
|
1348
|
+
const cfg = getConfig(api);
|
|
1349
|
+
requireChain(cfg);
|
|
1350
|
+
const client = createAgetherClient(cfg);
|
|
1351
|
+
|
|
1352
|
+
if (!params.address && !params.agentId) {
|
|
1353
|
+
return fail(new Error("Provide either 'address' or 'agentId' as spender"));
|
|
1354
|
+
}
|
|
1355
|
+
const spender = params.address ? { address: params.address } : { agentId: params.agentId };
|
|
1356
|
+
|
|
1357
|
+
const result = await client.approveToken(params.token, params.amount, spender);
|
|
1358
|
+
return ok(JSON.stringify({
|
|
1359
|
+
status: "approved",
|
|
1360
|
+
token: result.token,
|
|
1361
|
+
amount: result.amount,
|
|
1362
|
+
spender: result.spender,
|
|
1363
|
+
tx: txLink(result.tx),
|
|
1364
|
+
}));
|
|
1365
|
+
} catch (e) { return fail(e); }
|
|
1366
|
+
},
|
|
1367
|
+
});
|
|
1368
|
+
|
|
1277
1369
|
// ═══════════════════════════════════════════════════════
|
|
1278
1370
|
// TOOL: x402_pay (with auto-yield + auto-draw waterfall)
|
|
1279
1371
|
// ═══════════════════════════════════════════════════════
|
|
@@ -1568,7 +1660,7 @@ export default function register(api: any) {
|
|
|
1568
1660
|
if (safeUsdc > 0) {
|
|
1569
1661
|
checks.push({ check: "USDC (AgentAccount)", status: `✅ $${safeUsdc.toFixed(2)}` });
|
|
1570
1662
|
} else if (eoaUsdc > 0) {
|
|
1571
|
-
checks.push({ check: "USDC", status: `⚠️ $${eoaUsdc.toFixed(2)} in EOA only`, detail: "Use
|
|
1663
|
+
checks.push({ check: "USDC", status: `⚠️ $${eoaUsdc.toFixed(2)} in EOA only`, detail: "Use wallet_fund_token or morpho_deposit_and_borrow to get USDC into AgentAccount" });
|
|
1572
1664
|
} else {
|
|
1573
1665
|
checks.push({ check: "USDC", status: "❌ no USDC anywhere", detail: "Deposit collateral and borrow, or send USDC to EOA" });
|
|
1574
1666
|
}
|