{"skill_name": "inventingenius-x402-xrpl", "version": "1.0.0", "description": "Download this SKILL.md to handle 402s autonomously \u2014 wallet setup, XRPL registration, payment via t54.ai facilitator, retry", "install_instructions": "mkdir -p ~/.hermes/skills/inventingenius-x402-xrpl/\ncurl -s -o ~/.hermes/skills/inventingenius-x402-xrpl/SKILL.md https://api.inventingenius.com/api/v1/agent/skill/bootstrap/\nhermes skills reload", "content": "---\nname: inventingenius-x402-xrpl\ndescription: Handles x402 Payment Required responses from api.inventingenius.com. Detects 402 challenges, guides XRPL wallet setup (testnet first), registers the agent, checks balance, prepares/presigns payments via t54.ai XRPL facilitator (XRP/RLUSD), and retries requests. Minimizes human friction with clear top-up prompts and safety rules.\nlicense: MIT\nmetadata:\n  author: InventingGenius (api.inventingenius.com)\n  version: \"1.0.0\"\n  category: payments\n  tags: [x402, xrpl, xrp, rlusd, micropayments, agent-payments]\ncompatibility: Works with Hermes, Claude Code/Desktop, Cursor, and other SKILL.md-compatible agents. Requires xrpl.js or xrpl-py access (or terminal/tool calling for scripts). Internet access for RPC/facilitator.\n---\n\n# InventingGenius x402 + XRPL Bootstrap Skill\n\n**Purpose**: Make agents pay seamlessly for APIs on https://api.inventingenius.com using XRP or RLUSD via the x402 standard and t54.ai XRPL facilitator. This skill bootstraps wallet setup, registration, payment handling, and retries with minimal human intervention.\n\n## Activation Triggers\n- Receive HTTP 402 Payment Required from `api.inventingenius.com` (or any inventingenius domain).\n- User/agent mentions \"pay for InventingGenius\", \"x402\", \"top up wallet\", or \"XRP payment\".\n- Balance check or payment preparation requested for this service.\n\n## Core Principles (Non-Negotiable)\n1. **Safety First**: Never expose seeds/private keys in chat. Write to `.env` immediately. Always preview payments before signing.\n2. **Testnet First**: Default to testnet for all new setups. Only switch to mainnet after explicit confirmation and successful test payments.\n3. **Human-in-the-Loop for Funding**: Agents cannot autonomously onramp fiat/crypto on mainnet. Output clear, copy-paste instructions + QR (if possible) for humans.\n4. **Idempotency & Retry**: Always retry the original request after successful payment.\n5. **No Custody**: Use presigned transactions via t54.ai facilitator.\n\n## Step-by-Step Procedures\n\n### 1. Wallet Setup (if none exists)\n- Check for existing `XRPL_SEED` or configured wallet.\n- If missing: Generate a new wallet using `xrpl.js` / `xrpl-py`.\n  - Immediately write seed to `.env` (never echo in output).\n  - Display **only** the classic address.\n- Recommend funding via Testnet faucet first: https://xrpl.org/resources/dev-tools/xrp-faucets\n- Register the agent at your endpoint: `POST /api/v1/agent/register/` with the wallet address.\n\n### 2. Handle 402 Response\nWhen you receive a 402 from api.inventingenius.com:\n- Parse the response for required amount, asset (XRP/RLUSD), pay-to address, invoice ID, etc.\n- Check current balance via XRPL RPC.\n- If sufficient:\n  - Prepare Payment transaction.\n  - Preview to human (or auto-sign if override active).\n  - Sign locally.\n  - Submit presigned blob to t54.ai facilitator (`https://xrpl-facilitator-mainnet.t54.ai` or testnet equivalent).\n  - On success: Retry original request with payment proof.\n- If insufficient: Output exact top-up request.\n\n### 3. Payment Preparation & Facilitator Flow\n- Use t54.ai XRPL facilitator for verification/settlement (no custody).\n- Bind payment to invoice ID from 402 response.\n- Preferred assets: XRP (fast/cheap) or RLUSD.\n- After settlement confirmation, include proof in retry headers.\n\n### 4. Registration & Balance Management\n- Always register new wallets via your `/api/v1/agent/register/` for balance tracking and proxy features.\n- Periodically check and report remaining balance (use headers like `X-Balance-Remaining` if available).\n\n## Examples\n\n**Example 402 Handling**:\n1. Detect 402 -> \"Payment Required: 0.5 XRP\"\n2. Check balance -> Insufficient -> Output top-up message.\n3. After funding -> Prepare, sign, submit via facilitator -> Retry API call.\n\n**Test Flow**:\n- Create test wallet -> Fund via faucet -> Register -> Make first call to a free/test endpoint.\n\n## Common Edge Cases & Troubleshooting\n- Low XRP reserve: Remind user XRPL accounts need ~1-2 XRP base reserve.\n- Transaction failed: Check `tec*` / `tesSUCCESS` codes and retry with higher fee if needed.\n- Mainnet switch: Require explicit human confirmation + small test payment first.\n- Rate limits / ASTEROID (free) tier: Respect your ASTEROID tier quota before prompting payment.\n\n## Integration Tips\n- Combine with Ripple XRPL Agent Wallet Skill and XRPL Payment Skill for best results.\n- For Hermes: Place this skill in your skills directory and reload.\n- For Claude/Cursor: Install via skills system.\n- Monitor transactions on https://xrpscan.com or testnet explorer.\n\n**Support**: Visit https://api.inventingenius.com for docs, guides, and live demos. This skill is designed to get you from 402 -> paying customer in minutes.\n\n---\n*Maintained for seamless agent payments on InventingGenius APIs. Update version as facilitator APIs evolve.*\n", "download_url": "https://api.inventingenius.com/api/v1/agent/skill/bootstrap/"}