aawp-skill 1.4.1 → 1.5.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 CHANGED
@@ -169,6 +169,56 @@ All LP fees flow back to the AAWP wallet automatically.
169
169
 
170
170
  ---
171
171
 
172
+ ### Yield / DeFi
173
+
174
+ Earn yield via **Aave V3** (Base, Ethereum, Arbitrum, Optimism, Polygon) and **Venus Protocol** (BSC).
175
+
176
+ ```bash
177
+ node scripts/yield.js --chain base rates # Browse supply/borrow APYs
178
+ node scripts/yield.js --chain base supply USDC 100 # Supply 100 USDC
179
+ node scripts/yield.js --chain base withdraw USDC 50 # Withdraw 50 USDC
180
+ node scripts/yield.js --chain base borrow USDC 200 # Borrow against collateral
181
+ node scripts/yield.js --chain base repay USDC 200 # Repay debt (max to clear)
182
+ node scripts/yield.js --chain base positions # View all open positions
183
+ ```
184
+
185
+ ### NFT Operations
186
+
187
+ Manage ERC-721 and ERC-1155 tokens across all 6 chains.
188
+
189
+ ```bash
190
+ node scripts/nft.js --chain base balance # List all NFTs owned
191
+ node scripts/nft.js --chain base info <contract> <tokenId> # Token metadata + owner
192
+ node scripts/nft.js --chain base transfer <contract> <tokenId> <to>
193
+ node scripts/nft.js --chain base approve <contract> <tokenId> <operator>
194
+ node scripts/nft.js --chain base mint <contract> [tokenId] # ERC-1155 mint
195
+ node scripts/nft.js --chain base floor <contract> # Floor price (OpenSea/BscScan)
196
+ ```
197
+
198
+ ### Limit Orders
199
+
200
+ Place on-chain limit orders via **CoW Protocol** (Base, Ethereum, Arbitrum, Optimism, Polygon) and **1inch Limit Order v4** (BSC).
201
+
202
+ ```bash
203
+ node scripts/limit-order.js --chain base place ETH USDC 0.1 3000 # Sell 0.1 ETH at $3000
204
+ node scripts/limit-order.js --chain base list # Open orders
205
+ node scripts/limit-order.js --chain base cancel <orderUid> # Cancel
206
+ node scripts/limit-order.js --chain base status <orderUid> # Check fill status
207
+ ```
208
+
209
+ ### Cross-chain Portfolio
210
+
211
+ Parallel snapshot of all balances across all 6 chains with USD pricing.
212
+
213
+ ```bash
214
+ node scripts/portfolio.js # Full portfolio — all chains
215
+ node scripts/portfolio.js --chain base # Single chain breakdown
216
+ ```
217
+
218
+ Output: native + ERC-20 balances, USD value per asset, total net worth.
219
+
220
+ ---
221
+
172
222
  ### Backup & restore
173
223
 
174
224
  ```bash
package/bin/install.js ADDED
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const os = require('os');
7
+ const { execSync, spawnSync } = require('child_process');
8
+
9
+ const VERSION = require('../package.json').version;
10
+ const SKILL_NAME = 'aawp';
11
+ const RAW_BASE = 'https://raw.githubusercontent.com/aawp-ai/aawp/main/skills/aawp';
12
+ const FALLBACK = 'https://aawp.ai/skill';
13
+
14
+ // ── ANSI colors ───────────────────────────────────────────────────────────────
15
+ const isTTY = process.stdout.isTTY;
16
+ const c = (code, s) => isTTY ? `\x1b[${code}m${s}\x1b[0m` : s;
17
+ const bold = s => c('1', s);
18
+ const dim = s => c('2', s);
19
+ const green = s => c('32', s);
20
+ const blue = s => c('34', s);
21
+ const yellow = s => c('33', s);
22
+ const red = s => c('31', s);
23
+
24
+ const info = s => console.log(` ${blue('→')} ${s}`);
25
+ const success = s => console.log(` ${green('✓')} ${s}`);
26
+ const warn = s => console.log(` ${yellow('!')} ${s}`);
27
+ const fail = s => console.log(` ${red('✗')} ${s}`);
28
+
29
+ // ── Fetch helper ──────────────────────────────────────────────────────────────
30
+ async function fetchText(url) {
31
+ if (typeof fetch !== 'undefined') {
32
+ const res = await fetch(url);
33
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
34
+ return res.text();
35
+ }
36
+ return new Promise((resolve, reject) => {
37
+ const proto = url.startsWith('https') ? require('https') : require('http');
38
+ proto.get(url, res => {
39
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
40
+ return fetchText(res.headers.location).then(resolve).catch(reject);
41
+ }
42
+ if (res.statusCode !== 200) return reject(new Error(`HTTP ${res.statusCode}`));
43
+ const chunks = [];
44
+ res.on('data', c => chunks.push(c));
45
+ res.on('end', () => resolve(Buffer.concat(chunks).toString()));
46
+ res.on('error', reject);
47
+ }).on('error', reject);
48
+ });
49
+ }
50
+
51
+ async function downloadSkillMd() {
52
+ try {
53
+ return await fetchText(`${RAW_BASE}/SKILL.md`);
54
+ } catch {
55
+ return fetchText(`${FALLBACK}/SKILL.md`);
56
+ }
57
+ }
58
+
59
+ // ── Client detection ──────────────────────────────────────────────────────────
60
+ const HOME = os.homedir();
61
+
62
+ function hasCmd(cmd) {
63
+ try { execSync(`command -v ${cmd}`, { stdio: 'ignore' }); return true; } catch { return false; }
64
+ }
65
+ function dirExists(p) {
66
+ try { return fs.statSync(p).isDirectory(); } catch { return false; }
67
+ }
68
+
69
+ const CLIENTS = [
70
+ {
71
+ name: 'OpenClaw',
72
+ detect: () => hasCmd('clawhub'),
73
+ install: async () => {
74
+ const r = spawnSync('clawhub', ['install', SKILL_NAME], { stdio: 'inherit' });
75
+ return r.status === 0;
76
+ },
77
+ skillDir: null,
78
+ },
79
+ {
80
+ name: 'Cursor',
81
+ detect: () => hasCmd('cursor') || dirExists(path.join(HOME, '.cursor')),
82
+ skillDir: path.join(HOME, '.cursor', 'skills'),
83
+ },
84
+ {
85
+ name: 'Claude Code',
86
+ detect: () => hasCmd('claude') || dirExists(path.join(HOME, '.claude')),
87
+ skillDir: path.join(HOME, '.claude', 'skills'),
88
+ },
89
+ {
90
+ name: 'Gemini CLI',
91
+ detect: () => hasCmd('gemini') || dirExists(path.join(HOME, '.gemini')),
92
+ skillDir: path.join(HOME, '.gemini', 'skills'),
93
+ },
94
+ {
95
+ name: 'OpenCode',
96
+ detect: () => hasCmd('opencode') || dirExists(path.join(HOME, '.config', 'opencode')),
97
+ skillDir: path.join(HOME, '.config', 'opencode', 'skills'),
98
+ },
99
+ {
100
+ name: 'Goose',
101
+ detect: () => hasCmd('goose') || dirExists(path.join(HOME, '.config', 'goose')),
102
+ skillDir: path.join(HOME, '.config', 'goose', 'skills'),
103
+ },
104
+ ];
105
+
106
+ const UNIVERSAL_DIR = path.join(HOME, '.agents', 'skills');
107
+
108
+ // ── Install to dir ────────────────────────────────────────────────────────────
109
+ function installToDir(baseDir, skillMd) {
110
+ const dest = path.join(baseDir, SKILL_NAME);
111
+ fs.mkdirSync(dest, { recursive: true });
112
+ fs.writeFileSync(path.join(dest, 'SKILL.md'), skillMd, 'utf8');
113
+ return dest;
114
+ }
115
+
116
+ // ── Main ──────────────────────────────────────────────────────────────────────
117
+ async function main() {
118
+ console.log('');
119
+ console.log(` ${bold('AAWP Skill Installer')} ${dim('v' + VERSION)}`);
120
+ console.log(` ${dim('AI Agent Wallet Protocol — aawp.ai')}`);
121
+ console.log('');
122
+
123
+ const detected = CLIENTS.filter(c => c.detect());
124
+ const detectedNames = detected.map(c => c.name);
125
+
126
+ if (detected.length === 0) {
127
+ info('No AI clients detected — installing to universal ~/.agents/skills/');
128
+ } else {
129
+ info(`Detected: ${detectedNames.join(', ')}`);
130
+ }
131
+ console.log('');
132
+
133
+ info('Downloading SKILL.md...');
134
+ let skillMd;
135
+ try {
136
+ skillMd = await downloadSkillMd();
137
+ success('SKILL.md fetched');
138
+ } catch (e) {
139
+ fail(`Failed to download SKILL.md: ${e.message}`);
140
+ process.exit(1);
141
+ }
142
+ console.log('');
143
+
144
+ let count = 0;
145
+
146
+ const openclaw = detected.find(c => c.name === 'OpenClaw');
147
+ if (openclaw) {
148
+ info('Installing via clawhub (OpenClaw)...');
149
+ try {
150
+ const ok = await openclaw.install();
151
+ if (ok) { success('Installed via clawhub'); count++; }
152
+ else { warn('clawhub failed — falling back to file install'); }
153
+ } catch (e) {
154
+ warn(`clawhub error: ${e.message}`);
155
+ }
156
+ console.log('');
157
+ }
158
+
159
+ const seenDirs = new Set();
160
+ const dirsToInstall = [];
161
+
162
+ for (const client of detected) {
163
+ if (client.skillDir && !seenDirs.has(client.skillDir)) {
164
+ seenDirs.add(client.skillDir);
165
+ dirsToInstall.push({ dir: client.skillDir, label: client.name });
166
+ }
167
+ }
168
+
169
+ if (!seenDirs.has(UNIVERSAL_DIR)) {
170
+ dirsToInstall.push({ dir: UNIVERSAL_DIR, label: 'universal (~/.agents/skills)' });
171
+ }
172
+
173
+ for (const { dir, label } of dirsToInstall) {
174
+ const shortDir = dir.replace(HOME, '~');
175
+ info(`Installing to ${shortDir}/aawp/ ${dim('(' + label + ')')}`);
176
+ try {
177
+ const dest = installToDir(dir, skillMd);
178
+ success(`Installed → ${dest.replace(HOME, '~')}/SKILL.md`);
179
+ count++;
180
+ } catch (e) {
181
+ fail(`Failed: ${e.message}`);
182
+ }
183
+ }
184
+
185
+ console.log('');
186
+ if (count > 0) {
187
+ console.log(` ${bold(green('AAWP skill installed!'))}`);
188
+ console.log('');
189
+ console.log(` ${dim('Restart your AI client to load the skill.')}`);
190
+ console.log(` ${dim('Then ask: "set up my AAWP wallet"')}`);
191
+ console.log(` ${dim('Full autonomy (24/7 daemon + cron): clawhub install aawp')}`);
192
+ console.log(` ${dim('Docs: https://aawp.ai · https://github.com/aawp-ai/aawp')}`);
193
+ } else {
194
+ warn('Nothing was installed.');
195
+ console.log(` ${dim('Try manually: copy SKILL.md to your client\'s skills directory.')}`);
196
+ }
197
+ console.log('');
198
+ }
199
+
200
+ main().catch(e => {
201
+ fail(`Unexpected error: ${e.message}`);
202
+ process.exit(1);
203
+ });
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "aawp-skill",
3
- "version": "1.4.1",
4
- "type": "commonjs",
5
- "dependencies": {
6
- "clanker-sdk": "latest",
7
- "viem": "^2.0.0"
8
- }
9
- }
3
+ "version": "1.5.1",
4
+ "description": "AAWP — AI Agent Wallet Protocol skill installer",
5
+ "bin": {
6
+ "aawp-skill": "bin/install.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node bin/install.js"
10
+ },
11
+ "files": [
12
+ "bin/install.js",
13
+ "README.md"
14
+ ],
15
+ "keywords": ["aawp", "ai-agent", "wallet", "web3", "skill"],
16
+ "author": "aawp-ai",
17
+ "license": "BUSL-1.1",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/aawp-ai/aawp.git"
21
+ },
22
+ "homepage": "https://aawp.ai"
23
+ }