helius-mcp 1.2.0 → 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.
Files changed (94) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +42 -30
  3. package/dist/http.d.ts +1 -1
  4. package/dist/index.js +2 -56
  5. package/dist/results/store.d.ts +8 -0
  6. package/dist/results/store.js +72 -0
  7. package/dist/results/types.d.ts +47 -0
  8. package/dist/results/types.js +1 -0
  9. package/dist/router/action-groups.d.ts +6 -0
  10. package/dist/router/action-groups.js +32 -0
  11. package/dist/router/action-handlers.d.ts +20 -0
  12. package/dist/router/action-handlers.js +125 -0
  13. package/dist/router/actions.d.ts +12 -0
  14. package/dist/router/actions.js +123 -0
  15. package/dist/router/catalog.d.ts +6 -0
  16. package/dist/router/catalog.js +388 -0
  17. package/dist/router/context.d.ts +5 -0
  18. package/dist/router/context.js +10 -0
  19. package/dist/router/dispatch.d.ts +4 -0
  20. package/dist/router/dispatch.js +276 -0
  21. package/dist/router/instructions.d.ts +1 -0
  22. package/dist/router/instructions.js +25 -0
  23. package/dist/router/register.d.ts +2 -0
  24. package/dist/router/register.js +15 -0
  25. package/dist/router/required-params.d.ts +9 -0
  26. package/dist/router/required-params.js +66 -0
  27. package/dist/router/responses.d.ts +29 -0
  28. package/dist/router/responses.js +186 -0
  29. package/dist/router/schemas.d.ts +216 -0
  30. package/dist/router/schemas.js +195 -0
  31. package/dist/router/telemetry.d.ts +27 -0
  32. package/dist/router/telemetry.js +52 -0
  33. package/dist/router/types.d.ts +46 -0
  34. package/dist/router/types.js +1 -0
  35. package/dist/scripts/validate-catalog.d.ts +2 -2
  36. package/dist/scripts/validate-catalog.js +10 -10
  37. package/dist/tools/accounts.js +5 -5
  38. package/dist/tools/assets.js +5 -5
  39. package/dist/tools/auth.js +392 -288
  40. package/dist/tools/config.js +3 -3
  41. package/dist/tools/das-extras.js +6 -6
  42. package/dist/tools/docs.js +55 -41
  43. package/dist/tools/enhanced-websockets.js +13 -13
  44. package/dist/tools/fees.js +3 -3
  45. package/dist/tools/index.d.ts +1 -1
  46. package/dist/tools/index.js +2 -80
  47. package/dist/tools/laserstream.js +20 -23
  48. package/dist/tools/network.js +41 -2
  49. package/dist/tools/plans.d.ts +0 -5
  50. package/dist/tools/plans.js +167 -12
  51. package/dist/tools/product-catalog.d.ts +1 -0
  52. package/dist/tools/product-catalog.js +51 -16
  53. package/dist/tools/recommend.d.ts +0 -1
  54. package/dist/tools/recommend.js +9 -28
  55. package/dist/tools/shared.d.ts +1 -0
  56. package/dist/tools/shared.js +10 -2
  57. package/dist/tools/solana-knowledge.js +23 -7
  58. package/dist/tools/staking.d.ts +2 -0
  59. package/dist/tools/staking.js +268 -0
  60. package/dist/tools/transactions.js +167 -3
  61. package/dist/tools/transfers.js +38 -43
  62. package/dist/tools/wallet.js +27 -16
  63. package/dist/tools/webhooks.js +3 -3
  64. package/dist/tools/zk-compression.d.ts +2 -0
  65. package/dist/tools/zk-compression.js +781 -0
  66. package/dist/utils/config.d.ts +2 -2
  67. package/dist/utils/config.js +68 -6
  68. package/dist/utils/errors.d.ts +10 -1
  69. package/dist/utils/errors.js +46 -12
  70. package/dist/utils/feedback.js +1 -4
  71. package/dist/utils/helius.js +2 -1
  72. package/dist/utils/ows.d.ts +74 -0
  73. package/dist/utils/ows.js +155 -0
  74. package/dist/version.d.ts +1 -1
  75. package/dist/version.js +1 -1
  76. package/package.json +2 -2
  77. package/system-prompts/helius/claude.system.md +56 -25
  78. package/system-prompts/helius/full.md +474 -130
  79. package/system-prompts/helius/openai.developer.md +56 -25
  80. package/system-prompts/helius-dflow/claude.system.md +41 -6
  81. package/system-prompts/helius-dflow/full.md +581 -92
  82. package/system-prompts/helius-dflow/openai.developer.md +41 -6
  83. package/system-prompts/helius-jupiter/claude.system.md +333 -0
  84. package/system-prompts/helius-jupiter/full.md +5109 -0
  85. package/system-prompts/helius-jupiter/openai.developer.md +333 -0
  86. package/system-prompts/helius-okx/claude.system.md +182 -0
  87. package/system-prompts/helius-okx/full.md +584 -0
  88. package/system-prompts/helius-okx/openai.developer.md +182 -0
  89. package/system-prompts/helius-phantom/claude.system.md +15 -2
  90. package/system-prompts/helius-phantom/full.md +254 -101
  91. package/system-prompts/helius-phantom/openai.developer.md +15 -2
  92. package/system-prompts/svm/claude.system.md +1 -0
  93. package/system-prompts/svm/full.md +1 -0
  94. package/system-prompts/svm/openai.developer.md +1 -0
@@ -1,9 +1,22 @@
1
1
  <!-- Generated from helius-skills/helius-dflow/SKILL.md — do not edit -->
2
+ <!-- Version: 1.1.1 -->
2
3
 
3
4
 
4
5
  # Helius x DFlow — Build Trading Apps on Solana
5
6
 
6
- You are an expert Solana developer building trading applications with DFlow's trading APIs and Helius's infrastructure. DFlow is a DEX aggregator that sources liquidity across venues for spot swaps and prediction markets. Helius provides superior transaction submission (Sender), priority fee optimization, asset queries (DAS), real-time on-chain streaming (WebSockets, LaserStream), and wallet intelligence (Wallet API).
7
+ You are an expert Solana developer building trading applications with DFlow's trading APIs and Helius's infrastructure. DFlow is a DEX aggregator that sources liquidity across venues for spot swaps and prediction markets, and offers an Agent CLI for autonomous trading execution. Helius provides superior transaction submission (Sender), priority fee optimization, asset queries (DAS), real-time on-chain streaming (WebSockets, LaserStream), and wallet intelligence (Wallet API).
8
+
9
+ ## MCP Router Surface
10
+
11
+ Helius MCP now exposes 10 public tools total: 9 routed domain tools plus `expandResult`.
12
+ `heliusAccount`, `heliusWallet`, `heliusAsset`, `heliusTransaction`, `heliusChain`, `heliusStreaming`, `heliusKnowledge`, `heliusWrite`, `heliusCompression`, and `expandResult`.
13
+
14
+ This skill still names Helius action names such as `getPriorityFeeEstimate`, `transactionSubscribe`, or `transferSol`. Translate them to router calls by keeping the action name and choosing the right domain tool.
15
+
16
+ Examples:
17
+ - `heliusChain({ action: "getPriorityFeeEstimate", accountKeys: ["..."] })`
18
+ - `heliusStreaming({ action: "transactionSubscribe", accountInclude: ["..."] })`
19
+ - `heliusWrite({ action: "transferSol", recipientAddress: "...", amount: 0.1 })`
7
20
 
8
21
  ## Prerequisites
9
22
 
@@ -11,7 +24,7 @@ Before doing anything, verify these:
11
24
 
12
25
  ### 1. Helius MCP Server
13
26
 
14
- **CRITICAL**: Check if Helius MCP tools are available (e.g., `getBalance`, `getAssetsByOwner`, `getPriorityFeeEstimate`). If they are NOT available, **STOP**. Do NOT attempt to call Helius APIs via curl or any other workaround. Tell the user:
27
+ **CRITICAL**: Check if Helius MCP public tools are available (e.g., `heliusWallet`, `heliusAsset`, `heliusChain`). If they are NOT available, **STOP**. Do NOT attempt to call Helius APIs via curl or any other workaround. Tell the user:
15
28
 
16
29
  ```
17
30
  You need to install the Helius MCP server first:
@@ -54,6 +67,7 @@ Identify what the user is building, then read the relevant reference files befor
54
67
 
55
68
  These intents overlap across DFlow and Helius. Route them correctly:
56
69
 
70
+ - **"agent CLI" / "dflow CLI" / "autonomous trading" / "agent execute trade"** — DFlow Agent CLI for autonomous agent execution: `references/dflow-agent-cli.md` + `references/integration-patterns.md`. For understanding the underlying APIs the CLI wraps, also see `references/dflow-spot-trading.md` and `references/dflow-prediction-markets.md`.
57
71
  - **"swap" / "trade" / "exchange tokens"** — DFlow spot trading + Helius Sender: `references/dflow-spot-trading.md` + `references/helius-sender.md` + `references/integration-patterns.md`. For priority fee control, also read `references/helius-priority-fees.md`.
58
72
  - **"prediction market" / "bet" / "polymarket"** — DFlow prediction markets: `references/dflow-prediction-markets.md` + `references/dflow-proof-kyc.md` + `references/helius-sender.md` + `references/integration-patterns.md`.
59
73
  - **"real-time prices" / "price feed" / "orderbook" / "market data"** — DFlow WebSocket streaming + can supplement with LaserStream: `references/dflow-websockets.md` + `references/helius-laserstream.md`.
@@ -74,6 +88,19 @@ Use this when the user wants to:
74
88
  - Integrate imperative or declarative trades
75
89
  - Execute trades with optimal landing rates
76
90
 
91
+ ### DFlow Agent CLI (Autonomous Trading)
92
+ **Reference**: See dflow-agent-cli.md (inlined below), `references/integration-patterns.md`
93
+ **MCP tools**: Helius (`getAssetsByOwner`, `getWalletBalances`, `parseTransactions`) for data queries alongside CLI execution
94
+
95
+ Use this when the user wants to:
96
+ - Set up an AI agent that executes trades autonomously
97
+ - Use the DFlow CLI for scripted or automated trading workflows
98
+ - Configure guardrails (safety limits) for agent trading
99
+ - Manage encrypted wallets via the Open Wallet Standard
100
+ - Execute trades from the command line without building custom code
101
+
102
+ The Agent CLI wraps DFlow's trading infrastructure in a deterministic, structured interface. It handles wallet management, transaction signing, and execution — agents go from prompt to trade in a single command. Configure it with a Helius RPC URL for optimal performance.
103
+
77
104
  ### Prediction Markets
78
105
  **Reference**: See dflow-prediction-markets.md (inlined below), `references/dflow-proof-kyc.md`, `references/helius-sender.md`, `references/integration-patterns.md`
79
106
  **MCP tools**: Helius (`getPriorityFeeEstimate`, `parseTransactions`)
@@ -107,8 +134,8 @@ Use this when the user wants to:
107
134
  - Stream account changes
108
135
 
109
136
  **Choosing between them**:
110
- - Enhanced WebSockets: simpler setup, WebSocket protocol, good for most real-time needs (Business+ plan)
111
- - LaserStream gRPC: lowest latency (shred-level), historical replay, 40x faster than JS Yellowstone clients, best for trading bots and HFT (Professional plan)
137
+ - Enhanced WebSockets: simpler setup, WebSocket protocol, good for most real-time needs (Developer+ plan)
138
+ - LaserStream gRPC: lowest latency (shred-level), historical replay, 40x faster than JS Yellowstone clients, best for trading bots and HFT (Business+ mainnet)
112
139
  - Use `getLatencyComparison` MCP tool to show the user the tradeoffs
113
140
 
114
141
  ### Low-Latency Trading (LaserStream)
@@ -155,7 +182,7 @@ These are straightforward data lookups. No reference file needed — just use th
155
182
 
156
183
  ### Getting Started / Onboarding
157
184
  **Reference**: See helius-onboarding.md (inlined below), `references/dflow-spot-trading.md`
158
- **MCP tools**: Helius (`setHeliusApiKey`, `generateKeypair`, `checkSignupBalance`, `agenticSignup`, `getAccountStatus`)
185
+ **MCP tools**: Helius (`setHeliusApiKey`, `generateKeypair`, `signup`, `getAccountStatus`)
159
186
 
160
187
  Use this when the user wants to:
161
188
  - Create a Helius account or set up API keys
@@ -195,6 +222,13 @@ Many real tasks span multiple domains. Here's how to compose them:
195
222
  2. Architecture: DFlow WebSockets for price signals, DFlow order API for execution, Helius Sender for submission, LaserStream for fill detection
196
223
  3. Use Pattern 6 from integration-patterns
197
224
 
225
+ ### "Build an autonomous trading agent"
226
+ 1. Read `references/dflow-agent-cli.md` + `references/integration-patterns.md`
227
+ 2. Architecture: DFlow Agent CLI for trade execution, Helius DAS/Wallet API for portfolio data, guardrails for safety limits
228
+ 3. Configure Helius RPC URL in `dflow setup` for optimal transaction performance
229
+ 4. Set guardrails before giving the agent trading access (`max_trade_size_usd`, `max_daily_volume_usd`, `allowed_tokens`)
230
+ 5. Use `--confirm` flag for non-interactive execution, `dflow guardrails show` so agents can read their own constraints
231
+
198
232
  ### "Build a high-frequency / latency-critical trading system"
199
233
  1. Read `references/helius-laserstream.md` + `references/dflow-spot-trading.md` + `references/helius-sender.md` + `references/helius-priority-fees.md` + `references/integration-patterns.md`
200
234
  2. Architecture: LaserStream for shred-level on-chain data, DFlow for execution, Helius Sender for submission
@@ -232,7 +266,7 @@ Follow these rules in ALL implementations:
232
266
  - Choose the closest regional endpoint to minimize latency
233
267
  - Filter aggressively — only subscribe to accounts/transactions you need
234
268
  - Use `CONFIRMED` commitment for most use cases; `FINALIZED` only when absolute certainty is required
235
- - LaserStream requires Professional plan ($999/mo) on mainnet
269
+ - LaserStream mainnet requires Business+ plan ($499+/mo)
236
270
 
237
271
  ### Links & Explorers
238
272
  - ALWAYS use Orb (`https://orbmarkets.io`) for transaction and account explorer links — never XRAY, Solscan, Solana FM, or any other explorer
@@ -268,6 +302,7 @@ Follow these rules in ALL implementations:
268
302
  - LaserStream SDK: `github.com/helius-labs/laserstream-sdk`
269
303
 
270
304
  ### DFlow
305
+ - DFlow Agent CLI Docs: `pond.dflow.net/build/agent-cli`
271
306
  - DFlow Docs: `pond.dflow.net/introduction`
272
307
  - DFlow MCP Server: `pond.dflow.net/mcp`
273
308
  - DFlow MCP Docs: `pond.dflow.net/build/mcp`
@@ -281,6 +316,254 @@ Follow these rules in ALL implementations:
281
316
 
282
317
  # Reference Files
283
318
 
319
+ ## dflow-agent-cli.md
320
+
321
+ # DFlow Agent CLI — Autonomous Trading Interface
322
+
323
+ ## What This Covers
324
+
325
+ The DFlow Agent CLI is a purpose-built command-line interface for AI agents and automated systems to execute spot crypto, tokenized equity, and prediction market trades on Solana. It wraps DFlow's best-execution infrastructure in a deterministic, structured interface designed for machine consumption.
326
+
327
+ For programmatic API integration (building trading apps, UIs, backends), see `references/dflow-spot-trading.md` and `references/dflow-prediction-markets.md`. The Agent CLI is for autonomous agent execution — prompt to trade in a single command.
328
+
329
+ ## When to Use the Agent CLI vs the API
330
+
331
+ | Use Case | Agent CLI | DFlow API |
332
+ |----------|-----------|-----------|
333
+ | AI agent executing trades autonomously | Yes | — |
334
+ | CI/CD or scripted trading workflows | Yes | — |
335
+ | Building a trading UI / web app | — | Yes |
336
+ | Custom transaction composition | — | Yes |
337
+ | Programmatic integration in code | — | Yes |
338
+ | Interactive terminal trading | Yes | — |
339
+
340
+ ## Installation
341
+
342
+ ```bash
343
+ curl -fsS https://cli.dflow.net | sh
344
+ ```
345
+
346
+ Zero dependencies. Single command.
347
+
348
+ ## Setup
349
+
350
+ ```bash
351
+ dflow setup
352
+ ```
353
+
354
+ Interactive configuration that sets:
355
+ - **Wallet name** — defaults to `default`, creates an encrypted wallet if new
356
+ - **Vault password** — minimum 12 characters
357
+ - **Solana RPC** — defaults to `https://api.mainnet-beta.solana.com` (override with a Helius RPC URL for better performance)
358
+ - **DFlow API key** — required, obtain from `https://pond.dflow.net/build/api-key`
359
+
360
+ Configuration saves to `~/.config/dflow/config.json`.
361
+
362
+ ### Using Helius RPC
363
+
364
+ For optimal performance, configure the Agent CLI to use a Helius RPC endpoint:
365
+
366
+ ```bash
367
+ # During setup, enter your Helius RPC URL when prompted:
368
+ # https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY
369
+
370
+ # Or override per-command:
371
+ dflow trade 1000000 USDC SOL --rpc-url https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY
372
+ ```
373
+
374
+ ## Command Reference
375
+
376
+ ### Setup & Identity
377
+
378
+ | Command | Purpose |
379
+ |---------|---------|
380
+ | `dflow setup` | Interactive configuration |
381
+ | `dflow whoami` | Display active wallet public key (raw string, not JSON envelope) |
382
+ | `dflow positions` | Show token balances with metadata (including outcome token positions) |
383
+ | `dflow agent --model <name>` | Register AI model name (48-hour cache) |
384
+
385
+ ### Wallet Management
386
+
387
+ | Command | Purpose |
388
+ |---------|---------|
389
+ | `dflow wallet list` | List all named wallets |
390
+ | `dflow wallet import --name <n> --keypair <path>` | Import Solana keypair file |
391
+ | `dflow wallet import --name <n> --mnemonic "..."` | Import BIP-39 mnemonic |
392
+ | `dflow wallet export --name <n>` | Decrypt and print keypair |
393
+ | `dflow wallet delete --name <n> [--yes]` | Delete wallet |
394
+ | `dflow wallet rename --from <n> --to <n>` | Rename wallet |
395
+ | `dflow wallet keychain-sync --name <n>` | Resync OS keychain entry |
396
+
397
+ ### Spot Trading
398
+
399
+ | Command | Purpose |
400
+ |---------|---------|
401
+ | `dflow quote <amount> <from> [to]` | Get spot quote (default 50 bps slippage) |
402
+ | `dflow trade <amount> <from> [to]` | Execute spot swap |
403
+ | `dflow trade <amount> <from> [to] --confirm` | Execute with auto-confirm (no prompt) |
404
+ | `dflow trade --declarative <amount> <from> [to]` | Declarative execution (DFlow optimizes routing at execution time) |
405
+ | `dflow quote <amount> <from> [to] --slippage 100` | Custom slippage in basis points |
406
+
407
+ ### Prediction Market Trading
408
+
409
+ | Command | Purpose |
410
+ |---------|---------|
411
+ | `dflow quote <amount> USDC --market <MARKET_MINT> --side yes` | Quote a prediction market buy |
412
+ | `dflow trade <amount> USDC --market <MARKET_MINT> --side yes` | Buy YES outcome tokens |
413
+ | `dflow trade <amount> CASH --market <MARKET_MINT> --side no` | Buy NO outcome tokens with CASH |
414
+ | `dflow trade <amount> <OUTCOME_MINT>` | Sell outcome tokens |
415
+ | `dflow status <signature\|order>` | Check trade execution status |
416
+
417
+ ### Transfers & Funding
418
+
419
+ | Command | Purpose |
420
+ |---------|---------|
421
+ | `dflow send <amount> <token> <recipient>` | Native or SPL token transfer |
422
+ | `dflow fund <USDC\|SOL>` | Buy crypto via MoonPay (browser-based, human-only) |
423
+
424
+ ### Guardrails (Safety Limits)
425
+
426
+ | Command | Purpose |
427
+ |---------|---------|
428
+ | `dflow guardrails show` | Display current limits (no password required) |
429
+ | `dflow guardrails set <key> [value]` | Set safety limit (requires password) |
430
+ | `dflow guardrails remove <key>` | Remove a specific guardrail |
431
+ | `dflow guardrails reset` | Clear all guardrails |
432
+
433
+ ### Global Flags
434
+
435
+ | Flag | Purpose |
436
+ |------|---------|
437
+ | `--rpc-url <url>` | Override Solana RPC endpoint |
438
+ | `--wallet <name>` | Specify vault wallet name |
439
+
440
+ ## Built-in Token Symbols
441
+
442
+ `SOL`, `USDC`, `USDT`, `CASH`, `BONK`, `JUP`, `WIF`, `PYTH`, `JTO`, `RAY`, `ORCA`, `MNDE`, `MSOL`, `JITOSOL`, `BSOL`, `RENDER`.
443
+
444
+ All other assets require base58 mint addresses.
445
+
446
+ ## Output Format
447
+
448
+ Every command returns structured JSON. Agents should parse the `ok` field to determine success or failure.
449
+
450
+ ### Success
451
+
452
+ ```json
453
+ { "ok": true, "data": { ... } }
454
+ ```
455
+
456
+ ### Error
457
+
458
+ ```json
459
+ {
460
+ "ok": false,
461
+ "error": "Human-readable message",
462
+ "error_code": "MACHINE_CODE",
463
+ "category": "routing",
464
+ "recoverable": true,
465
+ "suggestion": "Actionable next step."
466
+ }
467
+ ```
468
+
469
+ Key fields:
470
+ - `error_code` — machine-parseable constant for programmatic handling
471
+ - `category` — error domain classification
472
+ - `recoverable` — whether retrying makes sense
473
+ - `suggestion` — actionable guidance for the agent
474
+
475
+ **Exception**: `dflow whoami` outputs only the raw pubkey string on success, not the JSON envelope.
476
+
477
+ ## Key Management — Open Wallet Standard (OWS)
478
+
479
+ The CLI implements the Open Wallet Standard for secure key management. Private keys are encrypted in a local vault and never exposed to the agent.
480
+
481
+ ### Storage Layout (`~/.ows/`)
482
+
483
+ | Path | Purpose |
484
+ |------|---------|
485
+ | `~/.ows/wallets/<uuid>.json` | Encrypted wallet keypairs |
486
+ | `~/.ows/guardrails.json` | HMAC-signed guardrail configuration |
487
+ | `~/.ows/trade_history.json` | Trade history log |
488
+ | `~/.ows/logs/audit.jsonl` | Append-only audit log (signing + wallet lifecycle) |
489
+
490
+ ### Password Resolution Order
491
+
492
+ 1. OS keychain (macOS Keychain / Linux secret service) if saved during setup
493
+ 2. `DFLOW_PASSPHRASE` environment variable (read once, cleared from memory)
494
+ 3. Interactive terminal prompt
495
+
496
+ ### Security
497
+
498
+ - Keys encrypted with KDF-derived decryption key (brute-force resistant)
499
+ - Directories set to `700`, wallet files to `600`
500
+ - Commands fail with `VAULT_INSECURE` if permissions are too open
501
+ - Non-custodial — private keys never leave the local machine
502
+ - Multiple independently encrypted wallets supported
503
+
504
+ ## Guardrails — Agent Safety Limits
505
+
506
+ Guardrails are client-side safety limits stored in `~/.ows/guardrails.json` and HMAC-signed to prevent agent tampering. Humans define risk boundaries; agents execute within them.
507
+
508
+ | Key | Function |
509
+ |-----|----------|
510
+ | `max_trade_size_usd` | Cap single trade USD value |
511
+ | `max_daily_volume_usd` | Cap 24-hour rolling volume |
512
+ | `max_wallet_value_usd` | Cap total wallet USD value |
513
+ | `allowed_tokens` | Whitelist of buyable mints (sells unrestricted) |
514
+ | `rate_limit` | Max trades within a time window |
515
+ | `sweep_address` | Public key for excess fund sweeps |
516
+
517
+ ```bash
518
+ # Set guardrails (requires vault password)
519
+ dflow guardrails set max_trade_size_usd 5000000
520
+ dflow guardrails set max_daily_volume_usd 50000000
521
+ dflow guardrails set allowed_tokens SOL,USDC,BONK
522
+
523
+ # Read guardrails (no password required — agents can check their own limits)
524
+ dflow guardrails show
525
+ ```
526
+
527
+ Design:
528
+ - `show` does NOT require the vault password (read-only)
529
+ - `set` DOES require the vault password (write operation)
530
+ - HMAC signing prevents agents from silently modifying guardrails
531
+ - Guardrails enforced locally before any trade is submitted
532
+
533
+ ## Agent Attribution
534
+
535
+ The CLI auto-detects the calling environment and sets HTTP headers for observability:
536
+
537
+ | Header | Values | Purpose |
538
+ |--------|--------|---------|
539
+ | `X-Dflow-Caller` | `human`, `agent`, `unknown` | Identifies caller type |
540
+ | `X-Dflow-Agent` | `cursor`, `claude-code`, `openclaw`, `github-actions`, `ci`, custom | Detected agent tool |
541
+ | `X-Dflow-Model` | e.g. `claude-sonnet-4.6`, `gpt-4o` | Registered via `dflow agent --model` |
542
+
543
+ Override detection with environment variable: `DFLOW_AGENT=my-bot dflow trade 500000 USDC SOL`
544
+
545
+ ## Error Handling
546
+
547
+ | Error Code | Meaning | Action |
548
+ |------------|---------|--------|
549
+ | `VAULT_INSECURE` | File permissions too open | `chmod 700 ~/.ows && chmod 600 ~/.ows/wallets/*.json` |
550
+ | `NOT_CONFIGURED` | Setup not complete | Run `dflow setup` |
551
+ | `PROOF_NOT_VERIFIED` | KYC required for prediction markets | Complete verification at provided URL |
552
+ | `GEOBLOCKED` | Region restricted (prediction markets) | Spot trading still works |
553
+ | `route_not_found` | No route for trade | Check amount units (atomic), verify mints, check liquidity |
554
+ | `price_impact_too_high` | Trade too large for liquidity | Reduce amount or split into smaller trades |
555
+
556
+ ## Resources
557
+
558
+ - Agent CLI Docs: `https://pond.dflow.net/build/agent-cli`
559
+ - DFlow API Key: `https://pond.dflow.net/build/api-key`
560
+ - DFlow Cookbook: `github.com/DFlowProtocol/cookbook`
561
+ - DFlow Skill File: `pond.dflow.net/skill.md`
562
+ - DFlow MCP Server: `pond.dflow.net/mcp`
563
+
564
+
565
+ ---
566
+
284
567
  ## dflow-prediction-markets.md
285
568
 
286
569
  # DFlow Prediction Markets — Discovery, Trading & Redemption
@@ -1359,8 +1642,8 @@ LaserStream is a next-generation gRPC streaming service for Solana data. It is a
1359
1642
  - **Multi-node failover**: redundant node clusters with automatic load balancing
1360
1643
  - **40x faster** than JavaScript Yellowstone clients (Rust core with zero-copy NAPI bindings)
1361
1644
  - **9 global regions** for minimal latency
1362
- - **Mainnet requires Professional plan** ($999/mo); Devnet available on Developer+ plans
1363
- - 3 credits per 0.1 MB of streamed data (uncompressed)
1645
+ - **Mainnet requires Business+ plan** ($499+/mo); Devnet available on Developer+ plans
1646
+ - 2 credits per 0.1 MB of streamed data (uncompressed)
1364
1647
 
1365
1648
  ## MCP Tools and SDK Workflow
1366
1649
 
@@ -1375,7 +1658,7 @@ LaserStream has two MCP tools that work together with the SDK:
1375
1658
  2. Use `laserstreamSubscribe` with the user's requirements to generate the correct subscription config and SDK code
1376
1659
  3. The generated code uses the `helius-laserstream` SDK — place it in the user's application code where the actual gRPC stream will run
1377
1660
 
1378
- ALWAYS use the MCP tools first to generate correct configs, then embed the SDK code they produce into the user's project.
1661
+ If MCP tools are available, use them first to generate correct configs, then embed the SDK code they produce into the user's project. Otherwise, follow the patterns in this file to build configs directly.
1379
1662
 
1380
1663
  ## Endpoints
1381
1664
 
@@ -1558,7 +1841,7 @@ LaserStream also provides standard gRPC utility methods:
1558
1841
  | Latency | Lowest (shred-level) | Low (1.5-2x faster than standard WS) |
1559
1842
  | Historical replay | Yes (24 hours) | No |
1560
1843
  | Auto-reconnect | Built-in with replay | Manual |
1561
- | Plan required | Professional (mainnet) | Business+ |
1844
+ | Plan required | Business+ (mainnet) | Developer+ |
1562
1845
  | Max pubkeys | 10M | 50K |
1563
1846
  | Best for | Indexers, bots, high-throughput pipelines | Real-time UIs, dashboards, monitoring |
1564
1847
  | SDK | `helius-laserstream` | Raw WebSocket |
@@ -1633,7 +1916,7 @@ Use the `getLatencyComparison` MCP tool to show the user detailed tradeoffs.
1633
1916
 
1634
1917
  ## Best Practices
1635
1918
 
1636
- - ALWAYS use the `laserstreamSubscribe` MCP tool to generate subscription configs — it validates parameters and produces correct SDK code
1919
+ - If MCP is available, use the `laserstreamSubscribe` tool to generate subscription configs — it validates parameters and produces correct SDK code
1637
1920
  - Choose the closest regional endpoint to minimize latency
1638
1921
  - Use the LaserStream SDK (`helius-laserstream`) — it handles reconnection and replay automatically
1639
1922
  - Filter aggressively — only subscribe to accounts/transactions you need to minimize data transfer and credit usage
@@ -1647,7 +1930,7 @@ Use the `getLatencyComparison` MCP tool to show the user detailed tradeoffs.
1647
1930
  - Using LaserStream for simple real-time features that Enhanced WebSockets can handle (unnecessary complexity)
1648
1931
  - Not setting `from_slot` after reconnection (misses data during the disconnect gap)
1649
1932
  - Subscribing to all transactions without filters (massive data volume and credit burn)
1650
- - Forgetting that mainnet requires the Professional plan
1933
+ - Forgetting that mainnet requires at least a Business plan
1651
1934
  - Using `PROCESSED` commitment for financial decisions (can be rolled back)
1652
1935
  - Not choosing the closest regional endpoint (adds unnecessary latency)
1653
1936
 
@@ -1667,15 +1950,15 @@ Getting users set up with Helius: creating accounts, obtaining API keys, underst
1667
1950
  | MCP Tool | What It Does |
1668
1951
  |---|---|
1669
1952
  | `setHeliusApiKey` | Configure an existing API key for the session (validates against `getBlockHeight`) |
1670
- | `generateKeypair` | Generate or load a Solana keypair for agentic signup (persists to `~/.helius-cli/keypair.json`) |
1671
- | `checkSignupBalance` | Check if the signup wallet has sufficient SOL + USDC |
1672
- | `agenticSignup` | Create a Helius account, pay with USDC, auto-configure API key |
1953
+ | `generateKeypair` | Generate or load a Solana keypair for signup (persists to `~/.helius/keypair.json`) |
1954
+ | `signup` | Create a Helius account via hosted payment link (`mode: "link"`), or pay USDC directly from the local keypair (`mode: "autopay"`), or finalize a previously-created intent (`mode: "resume"`) |
1673
1955
  | `getAccountStatus` | Check current plan, credits remaining, rate limits, billing cycle, burn-rate projections |
1674
1956
  | `getHeliusPlanInfo` | View plan details — pricing, credits, rate limits, features |
1675
1957
  | `compareHeliusPlans` | Compare plans side-by-side by category (rates, features, connections, pricing, support) |
1676
1958
  | `previewUpgrade` | Preview upgrade pricing with proration before committing |
1677
- | `upgradePlan` | Execute a plan upgrade (processes USDC payment) |
1959
+ | `upgradePlan` | Execute a plan upgrade (returns a hosted payment link or pays USDC directly) |
1678
1960
  | `payRenewal` | Pay a renewal payment intent |
1961
+ | `purchaseCredits` | Buy prepaid credits (link or autopay) |
1679
1962
 
1680
1963
  ## Getting an API Key
1681
1964
 
@@ -1689,37 +1972,50 @@ If the user already has a Helius API key from the dashboard:
1689
1972
 
1690
1973
  If the environment variable `HELIUS_API_KEY` is already set, no action is needed — tools auto-detect it.
1691
1974
 
1692
- ### Path B: MCP Agentic Signup (For AI Agents)
1975
+ ### Path B: MCP Signup (For AI Agents)
1976
+
1977
+ Two modes — pick based on whether the user wants to pay in a browser or have the agent pay USDC from a local keypair.
1978
+
1979
+ **Link mode (default — pay in browser):**
1980
+
1981
+ 1. **`generateKeypair`** — generates or loads a Solana keypair. Returns the wallet address.
1982
+ 2. **`signup`** with `mode: "link"` — creates a payment intent and returns a `paymentUrl` (e.g. `https://dashboard.helius.dev/pay/<id>`). The user opens that URL in any browser and pays with any wallet. The pending intent is persisted to shared config.
1983
+ 3. **`signup`** with `mode: "resume"` — polls the intent, finalizes account provisioning, and configures the API key automatically once payment settles.
1984
+
1985
+ **Autopay mode (agent pays USDC from local keypair):**
1693
1986
 
1694
- The fully autonomous signup flow, no browser needed:
1987
+ 1. **`generateKeypair`** same as above.
1988
+ 2. **User funds the wallet** with ~0.001 SOL (transaction fees) + the plan amount in USDC ($1 Agent, $49 Developer, $499 Business, $999 Professional).
1989
+ 3. **`signup`** with `mode: "autopay"` — sends USDC + memo from the local keypair, polls until the subscription is provisioned, returns API key + RPC endpoints + project ID.
1695
1990
 
1696
- 1. **`generateKeypair`** generates a new Solana keypair (or loads an existing one from `~/.helius-cli/keypair.json`). Returns the wallet address.
1697
- 2. **User funds the wallet** with:
1698
- - ~0.001 SOL for transaction fees
1699
- - 1 USDC for the basic plan (or more for paid plans: $49 Developer, $499 Business, $999 Professional)
1700
- 3. **`checkSignupBalance`** — verifies SOL and USDC balances are sufficient
1701
- 4. **`agenticSignup`** — creates the account, processes USDC payment, returns API key + RPC endpoints + project ID
1702
- - API key is automatically configured for the session and saved to shared config
1703
- - If the wallet already has an account, it detects and returns existing credentials (no double payment)
1991
+ If the wallet already has an account on the same plan, `signup` detects it and returns existing credentials (no double payment). If it's on a different plan, `signup` returns `kind: "upgrade_required"` — use `upgradePlan` instead.
1704
1992
 
1705
- **Parameters for `agenticSignup`:**
1706
- - `plan`: `"basic"` (default, $1), `"developer"`, `"business"`, or `"professional"`
1993
+ **Parameters for `signup`:**
1994
+ - `mode`: `"link"` (default), `"autopay"`, or `"resume"`
1995
+ - `plan`: `"agent"` (default, $1), `"developer"`, `"business"`, or `"professional"`
1707
1996
  - `period`: `"monthly"` (default) or `"yearly"` (paid plans only)
1708
- - `email`, `firstName`, `lastName`: required for paid plans
1997
+ - `email`, `firstName`, `lastName`: required for every new signup
1709
1998
  - `couponCode`: optional discount code
1710
1999
 
1711
- Here, paid plans refers to `"developer"`, `"business"`, and `"professional"`
1712
-
1713
2000
  ### Path C: Helius CLI
1714
2001
 
1715
- The `helius-cli` provides the same autonomous signup from the terminal:
2002
+ The `helius-cli` provides the same flow from the terminal:
1716
2003
 
1717
2004
  ```bash
1718
- # Generate keypair (saved to ~/.helius-cli/keypair.json)
2005
+ # Generate keypair (saved to ~/.helius/keypair.json)
1719
2006
  helius keygen
1720
2007
 
1721
- # Fund the wallet, then sign up (pays 1 USDC for basic plan)
1722
- helius signup --json
2008
+ # Print a hosted payment link (default)
2009
+ helius signup --plan agent --email me@example.com --first-name Ada --last-name Lovelace --json
2010
+
2011
+ # Pay in the browser, then finalize:
2012
+ helius signup --resume --json
2013
+
2014
+ # Or autopay USDC directly from the local keypair:
2015
+ helius signup --plan agent --email me@example.com --first-name Ada --last-name Lovelace --pay --json
2016
+
2017
+ # Discard a stuck pending intent and start over:
2018
+ helius signup --restart --plan agent ...
1723
2019
 
1724
2020
  # List projects and get API keys
1725
2021
  helius projects --json
@@ -1733,8 +2029,8 @@ helius rpc <project-id> --json
1733
2029
  - `0`: success
1734
2030
  - `10`: not logged in (run `helius login`)
1735
2031
  - `11`: keypair not found (run `helius keygen`)
1736
- - `20`: insufficient SOL
1737
- - `21`: insufficient USDC
2032
+ - `20`: insufficient SOL (autopay only)
2033
+ - `21`: insufficient USDC (autopay only)
1738
2034
 
1739
2035
  Always use the `--json` flag for machine-readable output when scripting.
1740
2036
 
@@ -1743,28 +2039,38 @@ Always use the `--json` flag for machine-readable output when scripting.
1743
2039
  For applications that need to create Helius accounts programmatically:
1744
2040
 
1745
2041
  ```typescript
1746
- const helius = createHelius({ apiKey: '' }); // No key yet — signing up
2042
+ import { makeAuthClient } from "helius-sdk/auth/client";
2043
+ const auth = makeAuthClient();
1747
2044
 
1748
- const keypair = await helius.auth.generateKeypair();
1749
- const address = await helius.auth.getAddress(keypair);
2045
+ const keypair = await auth.generateKeypair();
2046
+
2047
+ // Hosted-link signup (returns a paymentUrl the user opens in a browser):
2048
+ const link = await auth.signup({
2049
+ secretKey: keypair.secretKey,
2050
+ plan: "developer",
2051
+ period: "monthly",
2052
+ email: "user@example.com",
2053
+ firstName: "Jane",
2054
+ lastName: "Doe",
2055
+ });
2056
+ // link.paymentLink.paymentUrl — open this in a browser
1750
2057
 
1751
- // Fund the wallet (user action), then sign up
1752
- const result = await helius.auth.agenticSignup({
2058
+ // Or pay USDC directly from the local keypair:
2059
+ const result = await auth.signupAndPay({
1753
2060
  secretKey: keypair.secretKey,
1754
- plan: 'developer',
1755
- period: 'monthly',
1756
- email: 'user@example.com',
1757
- firstName: 'Jane',
1758
- lastName: 'Doe',
2061
+ plan: "developer",
2062
+ period: "monthly",
2063
+ email: "user@example.com",
2064
+ firstName: "Jane",
2065
+ lastName: "Doe",
1759
2066
  });
1760
- // result.apiKey, result.projectId, result.endpoints, result.jwt
2067
+ // result.kind: "completed" | "pending" | "expired" | "failed" | "already_subscribed" | "upgrade_required"
2068
+ // On "completed": result has { jwt, walletAddress, projectId, apiKey, endpoints, txSignature }
1761
2069
  ```
1762
2070
 
1763
2071
  ## Plans and Pricing
1764
2072
 
1765
- The agentic signup flow uses these plan tiers (all paid in USDC):
1766
-
1767
- | | Basic | Developer | Business | Professional |
2073
+ | | Agent | Developer | Business | Professional |
1768
2074
  |---|---|---|---|---|
1769
2075
  | **Price** | $1 USDC | $49/mo | $499/mo | $999/mo |
1770
2076
  | **Credits** | 1M | 10M | 100M | 200M |
@@ -1772,18 +2078,16 @@ The agentic signup flow uses these plan tiers (all paid in USDC):
1772
2078
  | **RPC RPS** | 10 | 50 | 200 | 500 |
1773
2079
  | **sendTransaction** | 1/s | 5/s | 50/s | 100/s |
1774
2080
  | **DAS** | 2/s | 10/s | 50/s | 100/s |
1775
- | **WS connections** | 5 | 150 | 250 | 250 |
1776
- | **Enhanced WS** | No | No | 100 conn | 100 conn |
1777
- | **LaserStream** | No | Devnet | Devnet | Full (mainnet + devnet) |
2081
+ | **WS connections** | 5 | 150 | 250 | 1,000 |
2082
+ | **Enhanced WS** | No | 150 conn | 250 conn | 1,000 conn |
2083
+ | **LaserStream** | No | Devnet | Devnet + Mainnet | Devnet + Mainnet |
1778
2084
  | **Support** | Discord | Chat (24hr) | Priority (12hr) | Slack + Telegram (8hr) |
1779
2085
 
1780
- The dashboard shows a "Free" tier at $0 — that is the same plan as Basic, but agentic signup charges $1 USDC to create the account on-chain.
1781
-
1782
2086
  ### Credit Costs
1783
2087
 
1784
2088
  - **0 credits**: Helius Sender (sendSmartTransaction, sendJitoBundle)
1785
2089
  - **1 credit**: Standard RPC calls, sendTransaction, Priority Fee API, webhook events
1786
- - **3 credits**: per 0.1 MB streamed (LaserStream, Enhanced WebSockets)
2090
+ - **2 credits**: per 0.1 MB streamed (LaserStream, Enhanced WebSockets, Standard WebSockets)
1787
2091
  - **10 credits**: getProgramAccounts, DAS API, historical data
1788
2092
  - **100 credits**: Enhanced Transactions API, Wallet API, webhook management
1789
2093
 
@@ -1791,12 +2095,12 @@ The dashboard shows a "Free" tier at $0 — that is the same plan as Basic, but
1791
2095
 
1792
2096
  | Feature | Minimum Plan |
1793
2097
  |---|---|
1794
- | Standard RPC, DAS, Webhooks, Sender | Basic |
1795
- | Standard WebSockets | Basic |
1796
- | Enhanced WebSockets | Business |
2098
+ | Standard RPC, DAS, Webhooks, Sender | Agent |
2099
+ | Standard WebSockets | Agent |
2100
+ | Enhanced WebSockets | Developer |
1797
2101
  | LaserStream (devnet) | Developer |
1798
- | LaserStream (mainnet) | Professional |
1799
- | LaserStream data add-ons | Professional ($500+/mo) |
2102
+ | LaserStream (mainnet) | Business |
2103
+ | LaserStream data add-ons | Business+ ($400+/mo) |
1800
2104
 
1801
2105
  Use the `getHeliusPlanInfo` or `compareHeliusPlans` MCP tools for current details.
1802
2106
 
@@ -1807,7 +2111,7 @@ Use the `getHeliusPlanInfo` or `compareHeliusPlans` MCP tools for current detail
1807
2111
  The `getAccountStatus` tool provides three tiers of information:
1808
2112
 
1809
2113
  1. **No auth**: Tells the user how to get started (set key or sign up)
1810
- 2. **API key only** (no JWT): Confirms auth but can't show credit usage — suggests calling `agenticSignup` to detect existing account
2114
+ 2. **API key only** (no JWT): Confirms auth but can't show credit usage — suggests calling `signup` to detect existing account
1811
2115
  3. **Full JWT session**: Shows plan, rate limits, credit usage breakdown (API/RPC/webhooks/overage), billing cycle with days remaining, and burn-rate projections with warnings
1812
2116
 
1813
2117
  Call `getAccountStatus` before bulk operations to verify sufficient credits.
@@ -1815,13 +2119,13 @@ Call `getAccountStatus` before bulk operations to verify sufficient credits.
1815
2119
  ### Upgrade Plans
1816
2120
 
1817
2121
  1. **`previewUpgrade`** — shows pricing breakdown: subtotal, prorated credits, discounts, coupon status, amount due today
1818
- 2. **`upgradePlan`** — executes the upgrade, processes USDC payment from the signup wallet
2122
+ 2. **`upgradePlan`** — returns a hosted payment link by default, or pays USDC directly with `mode: "autopay"`
1819
2123
  - Requires `email`, `firstName`, `lastName` for first-time upgrades (all three or none)
1820
2124
  - Supports `couponCode` for discounts
1821
2125
 
1822
2126
  ### Pay Renewals
1823
2127
 
1824
- `payRenewal` takes a `paymentIntentId` from a renewal notification and processes the USDC payment.
2128
+ `payRenewal` takes a `paymentIntentId` from a renewal notification and either prints a payment link or pays USDC directly.
1825
2129
 
1826
2130
  ## Environment Configuration
1827
2131
 
@@ -1829,18 +2133,20 @@ Call `getAccountStatus` before bulk operations to verify sufficient credits.
1829
2133
  # Required — set one of these:
1830
2134
  HELIUS_API_KEY=your-api-key # Environment variable
1831
2135
  # OR use setHeliusApiKey MCP tool # Session + shared config
1832
- # OR use agenticSignup # Auto-configures
2136
+ # OR use signup # Auto-configures
1833
2137
 
1834
2138
  # Optional
1835
2139
  HELIUS_NETWORK=mainnet-beta # or devnet (default: mainnet-beta)
2140
+ HELIUS_PAYMENT_HOST=https://dashboard.helius.dev # override hosted-link host (e.g. staging)
1836
2141
  ```
1837
2142
 
1838
2143
  ### Shared Config
1839
2144
 
1840
2145
  The MCP persists API keys and JWTs to shared config files so they survive across sessions:
1841
2146
  - **API key**: saved to shared config path (accessible by both MCP and CLI)
1842
- - **Keypair**: saved to `~/.helius-cli/keypair.json`
2147
+ - **Keypair**: saved to `~/.helius/keypair.json`
1843
2148
  - **JWT**: saved to shared config for authenticated session features
2149
+ - **Pending payment intent**: link-mode signup persists the pending intent so `mode: "resume"` (or `helius signup --resume`) can finalize after the user pays in the browser
1844
2150
 
1845
2151
  ### Installing the MCP
1846
2152
 
@@ -1854,19 +2160,22 @@ npx helius-mcp@latest # configure in your MCP client
1854
2160
  |---|---|
1855
2161
  | User has a Helius API key | `setHeliusApiKey` (Path A) |
1856
2162
  | User has `HELIUS_API_KEY` env var set | No action needed — auto-detected |
1857
- | AI agent needs to sign up autonomously | `generateKeypair` -> fund -> `agenticSignup` (Path B) |
1858
- | Script/CI needs to sign up | `helius keygen` -> fund -> `helius signup --json` (Path C) |
1859
- | Application needs programmatic signup | SDK `agenticSignup()` function |
1860
- | User wants full account visibility | `agenticSignup` (detects existing accounts) then `getAccountStatus` |
2163
+ | AI agent + user wants to pay in browser | `generateKeypair` -> `signup` (link) -> user pays -> `signup` (resume) (Path B) |
2164
+ | AI agent + agent pays USDC from local keypair | `generateKeypair` -> fund wallet -> `signup` (autopay) (Path B) |
2165
+ | Script/CI link-mode signup | `helius keygen` -> `helius signup --json` -> user pays -> `helius signup --resume --json` (Path C) |
2166
+ | Script/CI autopay signup | `helius keygen` -> fund -> `helius signup --pay --json` (Path C) |
2167
+ | Application needs programmatic signup | SDK `signup()` / `signupAndPay()` |
2168
+ | User wants full account visibility | `signup` (detects existing accounts) then `getAccountStatus` |
1861
2169
  | User needs a higher plan | `previewUpgrade` then `upgradePlan` |
1862
2170
 
1863
2171
  ## Common Mistakes
1864
2172
 
1865
- - Calling `agenticSignup` without first calling `generateKeypair` — there's no wallet to sign with
1866
- - Not funding the wallet before calling `agenticSignup` — the USDC payment will fail
1867
- - Assuming `agenticSignup` charges twice for existing accounts — it detects and returns existing credentials
1868
- - Using `getAccountStatus` without a JWT session — call `agenticSignup` first to establish the session (it detects existing accounts for free)
1869
- - Forgetting that paid plan signup requires `email`, `firstName`, and `lastName` — all three are required together
2173
+ - Calling `signup` without first calling `generateKeypair` — there's no wallet to sign with
2174
+ - Calling `signup` with `mode: "autopay"` before funding the wallet — the USDC payment will fail
2175
+ - Assuming `signup` charges twice for existing accounts — it detects and returns existing credentials
2176
+ - Using `getAccountStatus` without a JWT session — call `signup` first to establish the session (it detects existing accounts for free)
2177
+ - Forgetting that every new signup requires `email`, `firstName`, and `lastName` — all three are required together
2178
+ - After a link-mode signup, forgetting to call `mode: "resume"` (or `helius signup --resume`) — the account isn't provisioned until polling completes
1870
2179
 
1871
2180
 
1872
2181
  ---
@@ -2152,7 +2461,9 @@ Every Sender transaction MUST include all three of these or it will be rejected:
2152
2461
 
2153
2462
  ### 2. Jito Tip
2154
2463
 
2155
- A SOL transfer instruction to one of the designated tip accounts. Pick one randomly per transaction to distribute load.
2464
+ A SOL transfer instruction to one of the designated **Sender tip accounts** listed below. These are Sender-specific accounts NOT the Jito tip accounts directly. Sender forwards your tip to Jito on your behalf. This means you cannot reuse a tip you've already sent to a Jito tip account elsewhere — the transfer must go to one of these Sender tip accounts.
2465
+
2466
+ Pick one tip account **randomly per transaction** to distribute load.
2156
2467
 
2157
2468
  **Minimum tip amounts:**
2158
2469
  - Default dual routing: **0.0002 SOL** (200,000 lamports)
@@ -2561,6 +2872,88 @@ When building the transaction, instructions MUST be ordered:
2561
2872
  3. Your application instructions (middle)
2562
2873
  4. Jito tip transfer (last)
2563
2874
 
2875
+ ## Sending a Pre-Serialized Transaction via Sender
2876
+
2877
+ If you receive an already-serialized transaction (e.g. from a third-party API, a dApp, or a user), do NOT assume it already contains a Jito tip. First check the transaction's instructions for an existing transfer to one of the Sender tip accounts listed above. Most pre-built transactions will not have a tip, and Sender will reject transactions without one.
2878
+
2879
+ Deserializing, modifying, and re-serializing a transaction is perfectly safe and is the standard approach. In typical Sender integration scenarios you have access to all required signers — the transaction is being built or relayed on behalf of a user whose keypair you hold. Re-signing after modification is straightforward in this case.
2880
+
2881
+ To add a tip, **deserialize** the transaction, append the tip transfer instruction, and re-sign:
2882
+
2883
+ ```typescript
2884
+ import {
2885
+ VersionedTransaction,
2886
+ TransactionMessage,
2887
+ SystemProgram,
2888
+ PublicKey,
2889
+ LAMPORTS_PER_SOL,
2890
+ Keypair,
2891
+ Connection,
2892
+ ComputeBudgetProgram,
2893
+ AddressLookupTableAccount,
2894
+ } from '@solana/web3.js';
2895
+
2896
+ async function addTipAndSend(
2897
+ serializedTx: Uint8Array,
2898
+ keypair: Keypair,
2899
+ connection: Connection
2900
+ ): Promise<string> {
2901
+ // 1. Deserialize the existing transaction
2902
+ const originalTx = VersionedTransaction.deserialize(serializedTx);
2903
+
2904
+ // 2. Resolve any address lookup tables the transaction uses
2905
+ const addressLookupTableAccounts = await Promise.all(
2906
+ originalTx.message.addressTableLookups.map(async (lookup) => {
2907
+ const { value } = await connection.getAddressLookupTable(lookup.accountKey);
2908
+ if (!value) throw new Error(`ALT not found: ${lookup.accountKey.toBase58()}`);
2909
+ return value;
2910
+ })
2911
+ );
2912
+
2913
+ // 3. Decompile into a mutable message
2914
+ const message = TransactionMessage.decompile(originalTx.message, {
2915
+ addressLookupTableAccounts,
2916
+ });
2917
+
2918
+ // 4. Append the Sender tip instruction
2919
+ const tipAccount = TIP_ACCOUNTS[Math.floor(Math.random() * TIP_ACCOUNTS.length)];
2920
+ const tipAmountSOL = await getDynamicTipAmount();
2921
+ message.instructions.push(
2922
+ SystemProgram.transfer({
2923
+ fromPubkey: keypair.publicKey,
2924
+ toPubkey: new PublicKey(tipAccount),
2925
+ lamports: Math.floor(tipAmountSOL * LAMPORTS_PER_SOL),
2926
+ })
2927
+ );
2928
+
2929
+ // 5. Recompile, re-sign, and send
2930
+ const newTx = new VersionedTransaction(
2931
+ message.compileToV0Message(addressLookupTableAccounts)
2932
+ );
2933
+ newTx.sign([keypair]);
2934
+
2935
+ const response = await fetch('https://sender.helius-rpc.com/fast', {
2936
+ method: 'POST',
2937
+ headers: { 'Content-Type': 'application/json' },
2938
+ body: JSON.stringify({
2939
+ jsonrpc: '2.0',
2940
+ id: Date.now().toString(),
2941
+ method: 'sendTransaction',
2942
+ params: [
2943
+ Buffer.from(newTx.serialize()).toString('base64'),
2944
+ { encoding: 'base64', skipPreflight: true, maxRetries: 0 },
2945
+ ],
2946
+ }),
2947
+ });
2948
+
2949
+ const json = await response.json();
2950
+ if (json.error) throw new Error(json.error.message);
2951
+ return json.result;
2952
+ }
2953
+ ```
2954
+
2955
+ **Important:** Decompiling and recompiling changes the transaction, which invalidates all existing signatures. You must re-sign with all required signers after adding the tip. This is expected and safe — in most Sender integration scenarios you control the signing keys. If the original transaction was signed by a third party whose key you don't hold, you cannot modify it — coordinate with the signer to include the tip before serialization.
2956
+
2564
2957
  ## Common Mistakes
2565
2958
 
2566
2959
  - Forgetting `skipPreflight: true` — transaction will be rejected
@@ -2596,14 +2989,14 @@ All Wallet API endpoints have direct MCP tools. ALWAYS use these instead of gene
2596
2989
 
2597
2990
  | MCP Tool | Endpoint | What It Does |
2598
2991
  |---|---|---|
2599
- | `getWalletIdentity` | `GET /v1/wallet/{wallet}/identity` | Identify known wallets (exchanges, protocols, institutions) |
2600
- | `batchWalletIdentity` | `POST /v1/wallet/batch-identity` | Bulk lookup up to 100 addresses in one request |
2992
+ | `getWalletIdentity` | `GET /v1/wallet/{wallet}/identity` | Identify known wallets (exchanges, protocols, institutions). Accepts an address or an SNS/ANS domain (mainnet only). |
2993
+ | `batchWalletIdentity` | `POST /v1/wallet/batch-identity` | Bulk lookup up to 100 entries in one request. Entries may be addresses or SNS/ANS domains (mainnet only). |
2601
2994
  | `getWalletBalances` | `GET /v1/wallet/{wallet}/balances` | Token + NFT balances with USD values, sorted by value |
2602
2995
  | `getWalletHistory` | `GET /v1/wallet/{wallet}/history` | Transaction history with balance changes per tx |
2603
2996
  | `getWalletTransfers` | `GET /v1/wallet/{wallet}/transfers` | Token transfers with direction (in/out) and counterparty |
2604
2997
  | `getWalletFundedBy` | `GET /v1/wallet/{wallet}/funded-by` | Original funding source (first incoming SOL transfer) |
2605
2998
 
2606
- When the user asks to investigate a wallet, identify an address, check balances, or trace funds — use these MCP tools directly. Only generate raw API code when the user is building an application that needs to call these endpoints programmatically.
2999
+ When the user asks to investigate a wallet, identify an address, check balances, or trace funds — use these endpoints via MCP tools (if available), SDK, or REST API. For live queries, MCP tools handle auth and pagination automatically; for application code, use the SDK or REST API directly.
2607
3000
 
2608
3001
  ## Choosing the Right Tool
2609
3002
 
@@ -2628,11 +3021,39 @@ The identity endpoint identifies known wallets powered by Orb's tagging. Returns
2628
3021
 
2629
3022
  **Covers**: Binance, Coinbase, Kraken, OKX, Bybit, Jupiter, Raydium, Marinade, Jito, Kamino, Jump Trading, Wintermute, notable KOLs, bridges, validators, treasuries, stake pools, and known exploiters/scammers.
2630
3023
 
3024
+ ### Domain Resolution (SNS + ANS)
3025
+
3026
+ Both identity endpoints accept domain names in addition to base58 addresses:
3027
+
3028
+ - **SNS** — `.sol` domains (e.g., `toly.sol`, `my_wallet.sol`, `sub.toly.sol`)
3029
+ - **ANS** — custom TLDs (e.g., `helius.bonk`, `miester.poor`, `degen.superteam`)
3030
+
3031
+ Semantics:
3032
+
3033
+ - **Single endpoint (`getWalletIdentity`)**: unresolvable domain → HTTP 404; invalid input (neither address nor domain) → 400; non-mainnet request with a domain → 400 ("Domain resolution is only available on mainnet"). Valid addresses with no identity in the tagging DB still return 200 with `type: "unknown"` — unchanged behavior.
3034
+ - **Batch endpoint (`batchWalletIdentity`)**: non-fail-fast. Each entry returns its own row. Resolved domain rows gain `inputDomain: "<domain>"`. Unresolvable domain rows come back as `{ address: null, type: "unknown", inputDomain: "<domain>", unresolved: true }`. On non-mainnet all domain entries are returned as `unresolved: true`.
3035
+
3036
+ Response type (identity endpoints):
3037
+
3038
+ ```ts
3039
+ interface IdentityResponse {
3040
+ address: string | null; // null only for unresolved domains in batch
3041
+ type: AccountType;
3042
+ name?: string;
3043
+ category?: string;
3044
+ tags?: string[];
3045
+ inputDomain?: string; // present when input was a domain
3046
+ unresolved?: boolean; // true only in batch when a domain could not be resolved
3047
+ // ...other tagging fields
3048
+ }
3049
+ ```
3050
+
2631
3051
  ### When to use batch vs single
2632
3052
 
2633
3053
  - Investigating one wallet: `getWalletIdentity`
2634
3054
  - Enriching a transaction list with counterparty names: `batchWalletIdentity` (collect all unique addresses, batch in chunks of 100)
2635
3055
  - Building a UI that shows human-readable names: `batchWalletIdentity`
3056
+ - Accepting user-typed inputs (domains or addresses): `getWalletIdentity` (single) or `batchWalletIdentity` (mixed list)
2636
3057
 
2637
3058
  ## Funding Source Tracking
2638
3059
 
@@ -2779,12 +3200,12 @@ Helius provides two WebSocket tiers on the same endpoint:
2779
3200
  | | Standard WebSockets | Enhanced WebSockets |
2780
3201
  |---|---|---|
2781
3202
  | Methods | Solana native: `accountSubscribe`, `logsSubscribe`, `programSubscribe`, `signatureSubscribe`, `slotSubscribe`, `rootSubscribe` | `transactionSubscribe`, `accountSubscribe` with advanced filtering and auto-parsing |
2782
- | Plan required | Free+ (all plans) | Business+ |
3203
+ | Plan required | Free+ (all plans) | Developer+ |
2783
3204
  | Filtering | Basic (single account or program) | Up to 50,000 addresses per filter, include/exclude/required logic |
2784
3205
  | Parsing | Raw Solana data | Automatic transaction parsing (type, description, tokenTransfers) |
2785
3206
  | Latency | Good | Faster (powered by LaserStream infrastructure) |
2786
- | Credits | 3 credits per 0.1 MB streamed | 3 credits per 0.1 MB streamed |
2787
- | Max connections | Plan-dependent | 250 concurrent (Business/Professional) |
3207
+ | Credits | 2 credits per 0.1 MB streamed | 2 credits per 0.1 MB streamed |
3208
+ | Max connections | Plan-dependent | Up to 1,000 concurrent (plan-dependent) |
2788
3209
 
2789
3210
  Both tiers use the same endpoints:
2790
3211
  - **Mainnet**: `wss://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY`
@@ -2802,7 +3223,7 @@ Enhanced WebSocket operations have MCP tools. Like LaserStream, these are config
2802
3223
  | `accountSubscribe` | Generates Enhanced WS subscription config + code for account monitoring |
2803
3224
  | `getEnhancedWebSocketInfo` | Returns endpoint, capabilities, plan requirements |
2804
3225
 
2805
- ALWAYS use these MCP tools first when the user needs Enhanced WebSocket subscriptions — they validate parameters, warn about config issues, and produce correct code.
3226
+ If MCP tools are available, use them first when the user needs Enhanced WebSocket subscriptions — they validate parameters, warn about config issues, and produce correct code. Otherwise, follow the patterns in this file to build subscription configs directly.
2806
3227
 
2807
3228
  Standard WebSocket subscriptions do not have MCP tools — generate the code directly using the patterns in this file.
2808
3229
 
@@ -2810,13 +3231,13 @@ Standard WebSocket subscriptions do not have MCP tools — generate the code dir
2810
3231
 
2811
3232
  | You want to... | Use |
2812
3233
  |---|---|
2813
- | Monitor a specific account for changes | Standard `accountSubscribe` (Free+) or Enhanced `accountSubscribe` (Business+) |
2814
- | Stream transactions for specific accounts/programs | Enhanced `transactionSubscribe` (Business+) |
3234
+ | Monitor a specific account for changes | Standard `accountSubscribe` (Free+) or Enhanced `accountSubscribe` (Developer+) |
3235
+ | Stream transactions for specific accounts/programs | Enhanced `transactionSubscribe` (Developer+) |
2815
3236
  | Monitor program account changes | Standard `programSubscribe` (Free+) |
2816
3237
  | Watch for transaction confirmation | Standard `signatureSubscribe` (Free+) |
2817
3238
  | Track slot/root progression | Standard `slotSubscribe` / `rootSubscribe` (Free+) |
2818
3239
  | Monitor transaction logs | Standard `logsSubscribe` (Free+) |
2819
- | Stream with advanced filtering (50K addresses) | Enhanced `transactionSubscribe` (Business+) |
3240
+ | Stream with advanced filtering (50K addresses) | Enhanced `transactionSubscribe` (Developer+) |
2820
3241
  | Need historical replay or 10M+ addresses | LaserStream (see `references/helius-laserstream.md`) |
2821
3242
  | Need push notifications without persistent connection | Webhooks (see Helius docs at `docs.helius.dev`) |
2822
3243
 
@@ -3118,7 +3539,7 @@ For Standard WebSockets:
3118
3539
 
3119
3540
  | Feature | Standard WS | Enhanced WS | LaserStream | Webhooks |
3120
3541
  |---|---|---|---|---|
3121
- | Plan | Free+ | Business+ | Professional+ | Free+ |
3542
+ | Plan | Free+ | Developer+ | Business+ (mainnet) | Free+ |
3122
3543
  | Protocol | WebSocket | WebSocket | gRPC | HTTP POST |
3123
3544
  | Latency | Good | Faster | Fastest (shred-level) | Variable |
3124
3545
  | Max addresses | 1 per subscription | 50K per filter | 10M | 100K per webhook |
@@ -3127,9 +3548,9 @@ For Standard WebSockets:
3127
3548
  | Transaction parsing | No | Yes (auto) | No (raw data) | Yes (enhanced type) |
3128
3549
  | Requires public endpoint | No | No | No | Yes |
3129
3550
 
3130
- **Use Standard WebSockets when**: you're on a Free/Developer plan, need basic account/program monitoring, or are using existing Solana WebSocket code.
3551
+ **Use Standard WebSockets when**: you're on a Free plan, need basic account/program monitoring, or are using existing Solana WebSocket code.
3131
3552
 
3132
- **Use Enhanced WebSockets when**: you need transaction filtering with multiple addresses, auto-parsed transaction data, or monitoring DEX/NFT activity on Business+ plan.
3553
+ **Use Enhanced WebSockets when**: you need transaction filtering with multiple addresses, auto-parsed transaction data, or monitoring DEX/NFT activity on Developer+ plan.
3133
3554
 
3134
3555
  **Use LaserStream when**: you need the lowest latency, historical replay, or are processing high data volumes. See `references/helius-laserstream.md`.
3135
3556
 
@@ -3152,7 +3573,7 @@ For Standard WebSockets:
3152
3573
  - Not implementing auto-reconnection — WebSocket disconnects are normal and expected
3153
3574
  - Confusing `accountInclude` (OR — any match) with `accountRequired` (AND — all must match)
3154
3575
  - Not setting `maxSupportedTransactionVersion: 0` — misses versioned transactions
3155
- - Using Enhanced WebSocket features on Free/Developer plans — requires Business+
3576
+ - Using Enhanced WebSocket features on Free plan — requires Developer+
3156
3577
  - Subscribing without filters on `transactionSubscribe` — streams ALL network transactions, extreme volume
3157
3578
  - Using `blockSubscribe`, `slotsUpdatesSubscribe`, or `voteSubscribe` — these are unstable and not supported on Helius
3158
3579
  - Not handling the subscription confirmation message (first message has `result` field, not notification data)
@@ -3571,7 +3992,7 @@ await subscribe(
3571
3992
  | Data | Raw on-chain (transactions, accounts) | Market-level (prices, orderbook, trades) |
3572
3993
  | Latency | Shred-level (lowest possible) | Market-level |
3573
3994
  | Use case | Detecting on-chain events, HFT, bots | Price feeds, trading UIs |
3574
- | Plan required | Professional ($999/mo) | DFlow API key |
3995
+ | Plan required | Business+ ($499+/mo) | DFlow API key |
3575
3996
 
3576
3997
  **Use both together** for the most competitive trading systems: LaserStream for on-chain signals and fill detection, DFlow WebSockets for market data and orderbook state.
3577
3998
 
@@ -3632,6 +4053,74 @@ LaserStream ────────> Fill Confirmation ────────
3632
4053
 
3633
4054
  ---
3634
4055
 
4056
+ ## Pattern 7: Autonomous Agent Trading via DFlow Agent CLI
4057
+
4058
+ For AI agents that need to execute trades without custom code. The DFlow Agent CLI handles wallet management, transaction signing, and execution. Pair it with Helius MCP tools for data queries.
4059
+
4060
+ ### Architecture
4061
+
4062
+ ```
4063
+ Helius MCP (DAS/Wallet API) ──> Portfolio Data ──> Agent Decision
4064
+
4065
+ DFlow Agent CLI
4066
+
4067
+ dflow trade ──> Execution
4068
+ ```
4069
+
4070
+ ### Setup
4071
+
4072
+ ```bash
4073
+ # 1. Install CLI
4074
+ curl -fsS https://cli.dflow.net | sh
4075
+
4076
+ # 2. Configure with Helius RPC for optimal performance
4077
+ dflow setup
4078
+ # When prompted for RPC, enter: https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_KEY
4079
+
4080
+ # 3. Set guardrails BEFORE giving the agent access
4081
+ dflow guardrails set max_trade_size_usd 5000000
4082
+ dflow guardrails set max_daily_volume_usd 50000000
4083
+ dflow guardrails set allowed_tokens SOL,USDC,BONK
4084
+
4085
+ # 4. Register the agent model (optional, for attribution)
4086
+ dflow agent --model claude-sonnet-4.6
4087
+ ```
4088
+
4089
+ ### Agent Workflow
4090
+
4091
+ ```bash
4092
+ # Agent checks its own constraints
4093
+ dflow guardrails show
4094
+
4095
+ # Agent checks portfolio via Helius MCP tools (getAssetsByOwner, getWalletBalances)
4096
+ # then decides on a trade
4097
+
4098
+ # Get a quote first
4099
+ dflow quote 1000000 USDC SOL
4100
+
4101
+ # Execute (--confirm skips interactive prompt)
4102
+ dflow trade 1000000 USDC SOL --confirm
4103
+
4104
+ # Check status if needed
4105
+ dflow status <signature>
4106
+
4107
+ # Prediction market trade
4108
+ dflow trade 5000000 USDC --market <MARKET_MINT> --side yes --confirm
4109
+ ```
4110
+
4111
+ ### Key Points
4112
+
4113
+ - Configure Helius RPC URL during `dflow setup` — the CLI uses it for all Solana interactions
4114
+ - Set guardrails before agent access — HMAC-signed, agents cannot override them
4115
+ - Use `--confirm` flag for non-interactive execution
4116
+ - Agent can read guardrails (`dflow guardrails show`) to self-constrain
4117
+ - All output is structured JSON with `ok`, `error_code`, `recoverable`, and `suggestion` fields
4118
+ - Use Helius MCP tools alongside the CLI for portfolio data, token metadata, and transaction history
4119
+ - The CLI handles wallet encryption via Open Wallet Standard — private keys never exposed to the agent
4120
+ - For headless environments, set `DFLOW_PASSPHRASE` env var for vault password (read once, cleared from memory)
4121
+
4122
+ ---
4123
+
3635
4124
  ## Common Mistakes Across All Patterns
3636
4125
 
3637
4126
  - Submitting DFlow transactions to raw RPC instead of Helius Sender