pnpfucius 2.0.0 → 2.0.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.
Files changed (2) hide show
  1. package/README.md +119 -326
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,369 +1,175 @@
1
- # Privacy Oracle Agent
2
- ![G-rE4VTbAAAlPGj](https://github.com/user-attachments/assets/b314e991-4cb3-4914-8689-470a94411c20)
1
+ # PNPFUCIUS
3
2
 
3
+ **The PNP Exchange CLI & SDK for Solana prediction markets.**
4
4
 
5
- <img width="1536" height="1024" alt="image" src="https://github.com/user-attachments/assets/6dd4f578-959f-4bff-bb72-0b558ce885ae" />
5
+ [![npm version](https://img.shields.io/npm/v/pnpfucius.svg)](https://www.npmjs.com/package/pnpfucius)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
7
 
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**.
8
+ > *"The wise trader predicts with patience"*
12
9
 
13
10
  ## Features
14
11
 
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
12
+ - **Full PNP Exchange Integration** - Create, trade, and settle prediction markets on Solana
13
+ - **PNP Oracle Settlement** - Built-in LLM oracle for market resolution criteria
14
+ - **AMM & P2P Markets** - Support for both V2 (AMM) and V3 (P2P) market types
15
+ - **Custom Odds** - Create markets with custom starting odds
16
+ - **Market Discovery** - Browse all markets on PNP Exchange
17
+ - **Trading Tools** - Buy/sell YES/NO tokens with USDC
18
+ - **Redemption** - Redeem winning positions and claim refunds
19
+ - **Interactive CLI** - Purple-themed terminal interface with slash commands
20
+ - **Helius RPC Integration** - Reliable Solana access via Helius
21
+ - **No External AI Required** - Uses PNP's built-in LLM oracle
27
22
 
28
23
  ## Installation
29
24
 
30
25
  ```bash
26
+ # Install from npm
27
+ npm install pnpfucius
28
+
29
+ # Or clone and install locally
30
+ git clone https://github.com/pnp-protocol/pnpfucius.git
31
+ cd pnpfucius
31
32
  npm install
32
33
  ```
33
34
 
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Run the interactive CLI
39
+ npm run pnpfucius
40
+
41
+ # Run the demo (no wallet required)
42
+ npm run demo
43
+ ```
44
+
34
45
  ## Configuration
35
46
 
36
47
  Create a `.env` file:
37
48
 
38
49
  ```bash
39
- # Required for market creation
40
- WALLET_PRIVATE_KEY=your_base58_private_key_or_array
50
+ # Required for trading/creating markets
51
+ WALLET_KEY=your_base58_private_key
41
52
 
42
53
  # Helius API key (recommended)
43
54
  HELIUS_API_KEY=your_helius_api_key
44
55
 
45
- # Anthropic API key for AI features
46
- ANTHROPIC_API_KEY=your_anthropic_api_key
47
-
48
56
  # Network (devnet or mainnet)
49
57
  NETWORK=devnet
50
58
 
51
59
  # Optional defaults
52
60
  DEFAULT_LIQUIDITY=1000000
53
61
  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
62
  ```
71
63
 
72
64
  Get a free Helius API key at [helius.dev](https://helius.dev)
73
65
 
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>
66
+ ## CLI Commands
102
67
 
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
68
  | Command | Description |
160
69
  |---------|-------------|
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 |
70
+ | `/discover` | Browse ALL PNP markets |
71
+ | `/create [question]` | Create AMM market |
72
+ | `/p2p [question]` | Create P2P market |
73
+ | `/odds <percent> <question>` | Market with custom odds |
74
+ | `/info <address>` | Get market details |
75
+ | `/buy <address> <yes\|no> <usdc>` | Buy YES/NO tokens |
76
+ | `/sell <address> <yes\|no> <amount>` | Sell tokens |
77
+ | `/prices <address>` | Get market prices |
78
+ | `/balance <address>` | Check your balances |
79
+ | `/oracle <address>` | Get LLM settlement criteria |
80
+ | `/settle <address> <yes\|no>` | Settle a market |
81
+ | `/redeem <address>` | Redeem winning position |
82
+ | `/refund <address>` | Claim refund |
168
83
  | `/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...]
84
+ | `/tools` | List all available tools |
85
+ | `/help` | Show help |
86
+ | `/exit` | Exit PNPFUCIUS |
176
87
 
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
88
+ ## SDK Usage
220
89
 
221
90
  ```javascript
222
- import { createAgent, generatePrivacyMarket } from 'privacy-oracle-agent';
91
+ import { createAgent, executeTool } from 'pnpfucius';
223
92
 
224
93
  // Create an agent
225
94
  const agent = await createAgent({ verbose: true });
226
95
 
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
96
+ // Create a market
97
+ const result = await agent.createMarket({
98
+ question: 'Will BTC reach $150k by March 2026?',
99
+ durationDays: 90,
100
+ liquidity: 1000000n
236
101
  });
102
+ console.log('Market created:', result.market);
237
103
 
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
- ```
104
+ // Discover all markets
105
+ const markets = await agent.discoverMarkets();
106
+ console.log('Found markets:', markets.total);
255
107
 
256
- ### Daemon API
108
+ // Get settlement criteria from PNP Oracle
109
+ const criteria = await agent.fetchSettlementCriteria(marketAddress);
110
+ console.log('Settlement criteria:', criteria);
257
111
 
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 }
112
+ // Buy tokens
113
+ const trade = await agent.buyTokens({
114
+ marketAddress: '7xKXw9...',
115
+ side: 'yes',
116
+ amountUsdc: 50
268
117
  });
269
118
 
270
- // Stop daemon
271
- await daemon.stop();
119
+ // Use tools directly
120
+ await executeTool('discover_all_markets', {});
121
+ await executeTool('get_settlement_criteria', { market_address: '...' });
122
+ await executeTool('buy_tokens', { market_address: '...', side: 'yes', amount_usdc: 10 });
272
123
  ```
273
124
 
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
- ```
125
+ ## Available Tools
126
+
127
+ ### Market Creation
128
+ - `create_market` - Create AMM market
129
+ - `create_p2p_market_simple` - Create simple P2P market
130
+ - `create_amm_market_with_odds` - AMM with custom odds
131
+ - `create_p2p_market_with_odds` - P2P with custom odds
132
+ - `create_market_with_oracle` - Market with custom oracle
133
+
134
+ ### Market Discovery
135
+ - `discover_all_markets` - Find all PNP markets
136
+ - `list_markets` - List your markets
137
+ - `get_market_info` - Market details
138
+ - `get_v2_market_info` - V2 (AMM) details
139
+ - `get_p2p_market_info` - P2P details
140
+ - `get_market_metadata` - Market metadata
141
+
142
+ ### Trading
143
+ - `buy_tokens` - Buy YES/NO tokens
144
+ - `sell_tokens` - Sell tokens
145
+ - `buy_v3_tokens` - Buy V3 tokens
146
+ - `get_market_prices` - Current prices
147
+ - `get_balances` - Your balances
148
+
149
+ ### Settlement (PNP Oracle)
150
+ - `get_settlement_criteria` - LLM-generated criteria
151
+ - `get_settlement_data` - Resolution result
152
+ - `wait_for_settlement` - Wait for criteria
153
+ - `settle_market` - Settle with outcome
154
+
155
+ ### Redemption
156
+ - `redeem_position` - Redeem winnings
157
+ - `redeem_v3_position` - Redeem V3
158
+ - `redeem_p2p_position` - Redeem P2P
159
+ - `claim_refund` - Claim refund
160
+ - `claim_p2p_refund` - Claim P2P refund
338
161
 
339
162
  ## How It Works
340
163
 
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.
164
+ 1. **Market Creation**: Create prediction markets with YES/NO outcomes on Solana via PNP Exchange protocol
354
165
 
355
- 8. **Privacy Tokens**: Support for Token-2022 confidential transfers as collateral.
166
+ 2. **PNP Oracle**: Markets use PNP's built-in LLM oracle for settlement criteria and resolution
356
167
 
357
- ## Privacy Focus
168
+ 3. **Trading**: Buy/sell outcome tokens using USDC through bonding curves (AMM) or direct P2P
358
169
 
359
- All generated markets focus on privacy-related topics:
170
+ 4. **Settlement**: Oracle evaluates market conditions and provides resolution
360
171
 
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.
172
+ 5. **Redemption**: Winners redeem tokens for USDC
367
173
 
368
174
  ## Testing
369
175
 
@@ -371,26 +177,13 @@ This creates a focused prediction market ecosystem around privacy topics, helpin
371
177
  npm test
372
178
  ```
373
179
 
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
180
+ ## Links
384
181
 
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
182
+ - [npm Package](https://www.npmjs.com/package/pnpfucius)
183
+ - [PNP Exchange](https://pnp.exchange)
184
+ - [PNP Documentation](https://docs.pnp.exchange)
185
+ - [Helius](https://helius.dev)
387
186
 
388
187
  ## License
389
188
 
390
189
  MIT
391
-
392
- ## Links
393
-
394
- - [PNP Exchange](https://pnp.exchange)
395
- - [Helius](https://helius.dev)
396
- - [Solana Privacy Hackathon](https://solana.com/privacyhack)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pnpfucius",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "PNPFUCIUS - The PNP Exchange SDK & CLI for Solana prediction markets",
5
5
  "main": "src/index.js",
6
6
  "type": "module",