pnpfucius 2.0.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 ADDED
@@ -0,0 +1,396 @@
1
+ # Privacy Oracle Agent
2
+ ![G-rE4VTbAAAlPGj](https://github.com/user-attachments/assets/b314e991-4cb3-4914-8689-470a94411c20)
3
+
4
+
5
+ <img width="1536" height="1024" alt="image" src="https://github.com/user-attachments/assets/6dd4f578-959f-4bff-bb72-0b558ce885ae" />
6
+
7
+
8
+
9
+ An AI-powered agent for creating privacy-themed prediction markets on Solana using the PNP Exchange protocol and Helius infrastructure.
10
+
11
+ **Powered by Opus 4.5**.
12
+
13
+ ## Features
14
+
15
+ - **Claude AI-powered market generation** - Uses Claude API to generate relevant, verifiable prediction markets from news and topics
16
+ - **AI news scoring** - Automatically scores incoming news for privacy relevance (0-100)
17
+ - **AI resolution helper** - Analyzes markets to determine if conditions have been met
18
+ - Multiple market categories: regulation, technology, adoption, events
19
+ - Supports both AMM and P2P market creation
20
+ - **Autonomous daemon mode** with configurable schedules (cron or interval)
21
+ - **News monitoring** via RSS feeds for timely market generation
22
+ - **Webhook server** for Helius transaction events
23
+ - Market analytics and statistics tracking
24
+ - Privacy token collateral support (Token-2022 confidential transfers)
25
+ - Interactive CLI wizard for guided market creation
26
+ - Full Helius RPC integration for reliable Solana access
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install
32
+ ```
33
+
34
+ ## Configuration
35
+
36
+ Create a `.env` file:
37
+
38
+ ```bash
39
+ # Required for market creation
40
+ WALLET_PRIVATE_KEY=your_base58_private_key_or_array
41
+
42
+ # Helius API key (recommended)
43
+ HELIUS_API_KEY=your_helius_api_key
44
+
45
+ # Anthropic API key for AI features
46
+ ANTHROPIC_API_KEY=your_anthropic_api_key
47
+
48
+ # Network (devnet or mainnet)
49
+ NETWORK=devnet
50
+
51
+ # Optional defaults
52
+ DEFAULT_LIQUIDITY=1000000
53
+ DEFAULT_DURATION_DAYS=30
54
+
55
+ # Daemon settings
56
+ DAEMON_SCHEDULE=1h
57
+ DAEMON_MARKETS_PER_ROUND=1
58
+ DAEMON_STORAGE_PATH=./data/markets.db
59
+
60
+ # News monitoring
61
+ NEWS_ENABLED=false
62
+
63
+ # Webhook server
64
+ WEBHOOK_ENABLED=false
65
+ WEBHOOK_PORT=3000
66
+ WEBHOOK_AUTH_TOKEN=
67
+
68
+ # Privacy collateral
69
+ COLLATERAL_TOKEN=USDC
70
+ ```
71
+
72
+ Get a free Helius API key at [helius.dev](https://helius.dev)
73
+
74
+ ## Usage
75
+
76
+ ### CLI Commands
77
+
78
+ ```bash
79
+ # Generate market ideas (no wallet needed)
80
+ npm run agent generate -c 5
81
+
82
+ # Generate from specific category
83
+ npm run agent generate -k technology -c 3
84
+
85
+ # Show market categories
86
+ npm run agent categories
87
+
88
+ # Create a single privacy-themed market
89
+ npm run agent create
90
+
91
+ # Create with custom question
92
+ npm run agent create -q "Will GDPR fines exceed $5B in 2026?"
93
+
94
+ # Create multiple markets
95
+ npm run agent batch -c 3
96
+
97
+ # List existing markets
98
+ npm run agent list
99
+
100
+ # Get market info
101
+ npm run agent info <market_address>
102
+
103
+ # Show config
104
+ npm run agent config
105
+
106
+ # Interactive mode (guided wizard)
107
+ npm run agent interactive
108
+
109
+ # View market statistics
110
+ npm run agent stats --period 7d
111
+
112
+ # List supported collateral tokens
113
+ npm run agent tokens
114
+
115
+ # Check if a mint supports confidential transfers
116
+ npm run agent tokens --check <mint_address>
117
+ ```
118
+
119
+ ### AI-Powered Commands
120
+
121
+ ```bash
122
+ # Generate markets using Claude AI
123
+ npm run agent ai-generate -c 3
124
+
125
+ # Generate markets about a specific topic
126
+ npm run agent ai-generate -t "Tornado Cash sanctions" -c 2
127
+
128
+ # Generate and create markets on-chain
129
+ npm run agent ai-generate -c 3 --create
130
+
131
+ # Score news headlines for privacy relevance
132
+ npm run agent ai-score "EU proposes new encryption regulations" "Bitcoin hits new high"
133
+
134
+ # Analyze markets for potential resolution
135
+ npm run agent ai-resolve --all
136
+ npm run agent ai-resolve -m <market_address>
137
+ ```
138
+
139
+ ### Claude Predict - Interactive AI Agent
140
+
141
+ Run the Claude Code-like interactive CLI powered by Claude Opus 4.5:
142
+
143
+ ```bash
144
+ # Start Claude Predict
145
+ npm run predict
146
+
147
+ # Or use the binary directly
148
+ npx claude-predict
149
+ ```
150
+
151
+ Claude Predict provides an interactive chat interface where you can:
152
+ - Generate market ideas through natural conversation
153
+ - Create markets on Solana with simple commands
154
+ - Score news headlines for market potential
155
+ - Analyze markets for resolution
156
+ - Execute shell commands and file operations
157
+
158
+ **Slash Commands:**
159
+ | Command | Description |
160
+ |---------|-------------|
161
+ | `/help` | Show available commands |
162
+ | `/generate [n]` | Generate n market ideas |
163
+ | `/create [question]` | Create a new market |
164
+ | `/stats [period]` | Show market statistics |
165
+ | `/news [limit]` | Fetch recent privacy news |
166
+ | `/markets [status]` | List your markets |
167
+ | `/score <headline>` | Score news for relevance |
168
+ | `/config` | Show configuration |
169
+ | `/exit` | Exit Claude Predict |
170
+
171
+ **Example Session:**
172
+ ```
173
+ > Generate 3 market ideas about GDPR
174
+
175
+ [Claude Predict generates ideas using AI...]
176
+
177
+ 1. Will GDPR fines exceed €5B total in 2026?
178
+ 2. Will Meta receive another GDPR fine by Q3 2026?
179
+ 3. Will the EU approve the AI Act privacy provisions by June 2026?
180
+
181
+ > Create the first one with 1000 USDC liquidity
182
+
183
+ [Creating market on Solana...]
184
+
185
+ ✓ Market created successfully!
186
+ Address: 7xKXw9fZq...abc123
187
+ ```
188
+
189
+ ### Daemon Mode
190
+
191
+ Run as an autonomous daemon that creates markets on a schedule:
192
+
193
+ ```bash
194
+ # Basic daemon (1 market per hour)
195
+ npm run daemon
196
+
197
+ # Custom schedule with news monitoring
198
+ npm run agent daemon -s 30m -c 2 --news
199
+
200
+ # With webhook server for Helius events
201
+ npm run agent daemon -s 1h --webhooks --webhook-port 3000
202
+
203
+ # Dry run (generate without creating on-chain)
204
+ npm run agent daemon --dry-run
205
+
206
+ # Limited iterations
207
+ npm run agent daemon -n 10 -s 5m
208
+ ```
209
+
210
+ Daemon options:
211
+ - `-s, --schedule <schedule>` - Cron expression or interval (30m, 1h, 24h)
212
+ - `-n, --iterations <count>` - Max iterations (infinite if omitted)
213
+ - `-c, --count <count>` - Markets per cycle (default: 1)
214
+ - `--dry-run` - Generate without creating on-chain
215
+ - `--news` - Enable news monitoring for timely markets
216
+ - `--webhooks` - Enable webhook server
217
+ - `--webhook-port <port>` - Webhook port (default: 3000)
218
+
219
+ ### Programmatic Usage
220
+
221
+ ```javascript
222
+ import { createAgent, generatePrivacyMarket } from 'privacy-oracle-agent';
223
+
224
+ // Create an agent
225
+ const agent = await createAgent({ verbose: true });
226
+
227
+ // Generate and create a privacy market
228
+ const result = await agent.createPrivacyMarket();
229
+ console.log('Created market:', result.market);
230
+
231
+ // Or create with custom question
232
+ const custom = await agent.createMarket({
233
+ question: 'Will Tornado Cash sanctions be lifted by 2027?',
234
+ durationDays: 365,
235
+ liquidity: 5000000n
236
+ });
237
+
238
+ // Batch create markets
239
+ const batch = await agent.createBatchMarkets(5);
240
+ ```
241
+
242
+ ### Quick Create
243
+
244
+ ```javascript
245
+ import { quickCreate } from 'privacy-oracle-agent';
246
+
247
+ // Auto-generate a privacy market
248
+ const market = await quickCreate();
249
+
250
+ // Or with custom question
251
+ const custom = await quickCreate('Will the US pass federal privacy law by 2027?', {
252
+ durationDays: 365
253
+ });
254
+ ```
255
+
256
+ ### Daemon API
257
+
258
+ ```javascript
259
+ import { startDaemon } from 'privacy-oracle-agent';
260
+
261
+ // Start daemon programmatically
262
+ const daemon = await startDaemon({
263
+ daemon: {
264
+ schedule: '1h',
265
+ marketsPerRound: 2
266
+ },
267
+ news: { enabled: true }
268
+ });
269
+
270
+ // Stop daemon
271
+ await daemon.stop();
272
+ ```
273
+
274
+ ## Market Categories
275
+
276
+ | Category | Weight | Urgency | Examples |
277
+ |----------|--------|---------|----------|
278
+ | Privacy Regulation | 25% | Timely | GDPR fines, federal privacy laws, encryption bans |
279
+ | Privacy Technology | 30% | Evergreen | ZK adoption, Tornado Cash, confidential transactions |
280
+ | Privacy Adoption | 25% | Timely | Signal users, privacy coin delistings, enterprise ZK |
281
+ | Privacy Events | 20% | Breaking | Data breaches, surveillance scandals, hackathon wins |
282
+
283
+ ## Architecture
284
+
285
+ ```
286
+ privacy-oracle-agent/
287
+ bin/
288
+ claude-predict.js # Claude Predict entry point
289
+ src/
290
+ agent.js # Core agent class with PNP SDK integration
291
+ cli.js # Command line interface
292
+ config.js # Environment and configuration handling
293
+ privacy-markets.js # Market templates and AI generation
294
+ index.js # Public API exports
295
+ predict/
296
+ agent.js # Claude Predict agentic loop
297
+ prompts.js # System prompts
298
+ slash-commands.js # /help, /generate, etc.
299
+ tools/
300
+ index.js # Tool registry & executor
301
+ market-tools.js # Market generation & creation
302
+ news-tools.js # News scoring & fetching
303
+ analytics-tools.js # Statistics tools
304
+ file-tools.js # File operations
305
+ bash-tool.js # Shell command execution
306
+ ui/
307
+ welcome.js # Welcome screen
308
+ renderer.js # Markdown & output rendering
309
+ helius/
310
+ client.js # Helius API wrapper (DAS, webhooks, etc.)
311
+ transaction-tracker.js # Transaction confirmation tracking
312
+ webhooks.js # Express server for Helius webhooks
313
+ daemon/
314
+ index.js # Main daemon orchestrator
315
+ scheduler.js # Cron-style scheduling
316
+ lifecycle.js # Graceful shutdown handling
317
+ storage/
318
+ market-store.js # SQLite persistence layer
319
+ monitoring/
320
+ news-monitor.js # RSS feed monitoring
321
+ news-scorer.js # Relevance scoring algorithm
322
+ ai/
323
+ market-generator.js # Claude AI market generation
324
+ scorer.js # AI news relevance scoring
325
+ resolver.js # AI market resolution helper
326
+ index.js # AI module exports
327
+ analytics/
328
+ aggregator.js # Dashboard data aggregation
329
+ collateral/
330
+ privacy-tokens.js # Privacy token support
331
+ events/
332
+ emitter.js # Central event bus
333
+ utils/
334
+ spinner.js # CLI spinners and progress
335
+ test/
336
+ *.test.js # Test suites
337
+ ```
338
+
339
+ ## How It Works
340
+
341
+ 1. **AI Market Generation**: Uses Claude API to generate verifiable YES/NO prediction market questions from news headlines or topics, with appropriate timeframes and liquidity suggestions.
342
+
343
+ 2. **News Scoring**: AI scores incoming news items 0-100 for privacy relevance, filtering high-score items for market generation.
344
+
345
+ 3. **Resolution Analysis**: AI analyzes markets to determine if conditions have been met, providing confidence scores and suggested actions.
346
+
347
+ 4. **Template Fallback**: When AI is unavailable, uses weighted random selection across privacy-themed categories with dynamic template filling.
348
+
349
+ 5. **Helius Integration**: All Solana RPC calls go through Helius for reliability, speed, and better transaction landing rates.
350
+
351
+ 6. **PNP SDK**: Markets are created on the PNP Exchange protocol, supporting both AMM pools and P2P betting.
352
+
353
+ 7. **Daemon Mode**: Autonomous operation with configurable schedules, news monitoring, and webhook integration.
354
+
355
+ 8. **Privacy Tokens**: Support for Token-2022 confidential transfers as collateral.
356
+
357
+ ## Privacy Focus
358
+
359
+ All generated markets focus on privacy-related topics:
360
+
361
+ - Regulatory developments around data protection
362
+ - Zero-knowledge technology adoption
363
+ - Privacy tool usage metrics
364
+ - Significant privacy events and breaches
365
+
366
+ This creates a focused prediction market ecosystem around privacy topics, helping gauge community sentiment on important privacy developments.
367
+
368
+ ## Testing
369
+
370
+ ```bash
371
+ npm test
372
+ ```
373
+
374
+ ## Contributing
375
+
376
+ Contributions welcome! Areas of interest:
377
+
378
+ - Additional market categories and templates
379
+ - Integration with more privacy protocols
380
+ - Enhanced AI market generation
381
+ - Market monitoring and analytics
382
+
383
+ - ## Bounties Targeted
384
+
385
+ - **Helius ($5,000)** - Best privacy project leveraging Helius RPCs and developer tooling
386
+ - **PNP Exchange ($2,500)** - AI agents creating prediction markets with privacy-focused tokens
387
+
388
+ ## License
389
+
390
+ MIT
391
+
392
+ ## Links
393
+
394
+ - [PNP Exchange](https://pnp.exchange)
395
+ - [Helius](https://helius.dev)
396
+ - [Solana Privacy Hackathon](https://solana.com/privacyhack)
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { ClaudePredictAgent } from '../src/predict/agent.js';
3
+
4
+ const agent = new ClaudePredictAgent();
5
+ await agent.run();
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // PNPFUCIUS - The PNP Exchange CLI
3
+ // "The wise trader predicts with patience"
4
+
5
+ import { PnpfuciusAgent } from '../src/predict/agent.js';
6
+
7
+ const agent = new PnpfuciusAgent();
8
+ await agent.run();
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "pnpfucius",
3
+ "version": "2.0.0",
4
+ "description": "PNPFUCIUS - The PNP Exchange SDK & CLI for Solana prediction markets",
5
+ "main": "src/index.js",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": "./src/index.js",
9
+ "./cli": "./bin/pnpfucius.js",
10
+ "./agent": "./src/agent.js",
11
+ "./config": "./src/config.js",
12
+ "./tools": "./src/predict/tools/index.js"
13
+ },
14
+ "bin": {
15
+ "pnpfucius": "./bin/pnpfucius.js"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "bin",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "start": "node bin/pnpfucius.js",
25
+ "pnpfucius": "node bin/pnpfucius.js",
26
+ "cli": "node bin/pnpfucius.js",
27
+ "demo": "node scripts/demo.js",
28
+ "daemon": "node src/cli.js daemon",
29
+ "test": "node --test test/*.test.js"
30
+ },
31
+ "keywords": [
32
+ "solana",
33
+ "prediction-markets",
34
+ "pnp",
35
+ "pnp-exchange",
36
+ "trading",
37
+ "defi",
38
+ "helius",
39
+ "cli",
40
+ "sdk",
41
+ "oracle",
42
+ "amm",
43
+ "p2p"
44
+ ],
45
+ "author": "ARK Technologies",
46
+ "license": "MIT",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/pnp-protocol/pnpfucius.git"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/pnp-protocol/pnpfucius/issues"
53
+ },
54
+ "homepage": "https://pnp.exchange",
55
+ "engines": {
56
+ "node": ">=18.0.0"
57
+ },
58
+ "dependencies": {
59
+ "@solana/web3.js": "^1.98.4",
60
+ "better-sqlite3": "^11.7.0",
61
+ "chalk": "^5.6.2",
62
+ "commander": "^14.0.2",
63
+ "cron-parser": "^4.9.0",
64
+ "dotenv": "^17.2.3",
65
+ "express": "^4.22.1",
66
+ "inquirer": "^9.3.8",
67
+ "ora": "^8.2.0",
68
+ "pnp-sdk": "^0.2.3",
69
+ "rss-parser": "^3.13.0"
70
+ }
71
+ }