Skip to main content

agentwallet

Wallets for AI agents with x402 payment signing, referral rewards, and policy-controlled actions.

Datos de origen

Repositorio
Kernel8901/ai-agent-skills-classification
Última actividad en el origen
4 de abril de 2026 a las 15:26
Idioma detectado de SKILL.md
inglés
Estrellas
5
Forks
1

Opciones de instalación

De forma predeterminada está seleccionado el prompt que primero revisa el origen. Puedes cambiar a un comando directo o descargar una copia local.

Revisa los archivos de origen

Lee SKILL.md y los archivos complementarios que muestra SkillsMP antes de decidir si quieres instalarlo.

Explorador de archivos
4 archivos

Mostrando SKILL.md

SKILL.md
Instrucciones de origen · Vista previa de solo lectura
name
agentwallet
version
0.1.8
description
Wallets for AI agents with x402 payment signing, referral rewards, and policy-controlled actions.
homepage
https://agentwallet.mcpay.tech
metadata
{"moltbot":{"category":"finance","api_base":"https://agentwallet.mcpay.tech/api"},"x402":{"supported":true,"chains":["solana","evm"],"networks":["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:8453","eip155:84532"],"tokens":["USDC"],"endpoint":"/api/wallets/{username}/actions/x402/fetch","legacyEndpoint":"/api/wallets/{username}/actions/x402/pay"},"referrals":{"enabled":true,"endpoint":"/api/wallets/{username}/referrals"}}
# AgentWallet AgentWallet provides server wallets for AI agents. Wallets are provisioned after email OTP verification. All signing happens server-side and is policy-controlled. --- ## TL;DR - Quick Reference **FIRST: Check if already connected** by reading `~/.agentwallet/config.json`. If file exists with `apiToken`, you're connected - DO NOT ask user for email. **Need to connect (no config file)?** Ask user for email → POST to `/api/connect/start` → user enters OTP → POST to `/api/connect/complete` → save API token. **x402 Payments?** Use the ONE-STEP `/x402/fetch` endpoint (recommended) - just send target URL + body, server handles everything. --- ## ⭐ x402/fetch - ONE-STEP PAYMENT PROXY (RECOMMENDED) **This is the simplest way to call x402 APIs.** Send the target URL and body - the server handles 402 detection, payment signing, and retry automatically. ```bash curl -s -X POST "https://agentwallet.mcpay.tech/api/wallets/USERNAME/actions/x402/fetch" \ -H "Authorization: Bearer TOKEN" \ -H "Content-Type: application/json" \ -d '{"url":"https://enrichx402.com/api/exa/search","method":"POST","body":{"query":"AI agents","numResults":3}}' ``` **That's it!** The response contains the final API result: ```json { "success": true, "response": { "status": 200, "body": {"results": [...]}, "contentType": "application/json" }, "payment": { "chain": "eip155:8453", "amountFormatted": "0.01 USDC", "recipient": "0x..." }, "paid": true, "attempts": 2, "duration": 1234 } ``` ### x402/fetch Request Options | Field | Type | Required | Description | |-------|------|----------|-------------| | `url` | string | ✅ | Target API URL (must be HTTPS in production) | | `method` | string | ❌ | HTTP method: GET, POST, PUT, DELETE, PATCH (default: GET) | | `body` | object | ❌ | Request body (auto-serialized to JSON) | | `headers` | object | ❌ | Additional headers to send | | `preferredChain` | string | ❌ | `"auto"` (default), `"evm"`, or `"solana"`. Auto selects chain with sufficient USDC balance | | `dryRun` | boolean | ❌ | Preview payment cost without paying | | `timeout` | number | ❌ | Request timeout in ms (default: 30000, max: 120000) | | `idempotencyKey` | string | ❌ | For deduplication | ### Dry Run (Preview Cost) Check how much an API call will cost without paying: ```bash curl -s -X POST "https://agentwallet.mcpay.tech/api/wallets/USERNAME/actions/x402/fetch" \ -H "Authorization: Bearer TOKEN" \ -H "Content-Type: application/json" \ -d '{"url":"https://enrichx402.com/api/exa/search","method":"POST","body":{"query":"test"},"dryRun":true}' ``` Response: ```json { "success": true, "dryRun": true, "payment": { "required": true, "chain": "eip155:8453", "amountFormatted": "0.01 USDC", "policyAllowed": true } } ``` ### Error Codes | Code | HTTP | Description | |------|------|-------------| | `INVALID_URL` | 400 | URL malformed or blocked (localhost, internal IPs) | | `POLICY_DENIED` | 403 | Policy check failed (amount too high, etc.) | | `WALLET_FROZEN` | 403 | Wallet is frozen | | `TARGET_TIMEOUT` | 504 | Target API timed out | | `TARGET_ERROR` | 502 | Target API returned 5xx error | | `PAYMENT_REJECTED` | 402 | Payment was rejected by target API | | `NO_PAYMENT_OPTION` | 400 | No compatible payment network | ### Why Use x402/fetch? - ✅ **One request** instead of 4-5 manual steps - ✅ **No header parsing** - server extracts payment-required automatically - ✅ **No escaping issues** - no multiline curl, no temp files - ✅ **Automatic retry** - handles 402 → sign → retry flow - ✅ **Policy enforced** - respects your spending limits - ✅ **Proper error handling** - clear error codes --- ## ⚠️ x402 Payment - MANUAL FLOW (Legacy) If you need fine-grained control, use the manual 4-step flow below. **For most cases, use x402/fetch above instead.** ### COPY THIS EXACT SCRIPT **Only use this if you can't use x402/fetch. DO NOT improvise. DO NOT use multiline curl. Copy this script exactly:** ```bash # === x402 PAYMENT SCRIPT - COPY EXACTLY === # Replace: API_URL, USERNAME, TOKEN, REQUEST_BODY # Step 1: Get payment requirement (writes to temp file to avoid escaping issues) curl -s -i -X POST "API_URL" -H "Content-Type: application/json" -d 'REQUEST_BODY' > /tmp/x402_response.txt # Step 2: Extract the payment-required header PAYMENT_REQ=$(grep -i "payment-required:" /tmp/x402_response.txt | cut -d' ' -f2 | tr -d '\r\n') # Step 3: Sign with AgentWallet # ENDPOINT: /api/wallets/USERNAME/actions/x402/pay (x402/pay with SLASH, not x402-sign with DASH) # FIELD: Use "requirement" (not "paymentRequiredHeader") curl -s -X POST "https://agentwallet.mcpay.tech/api/wallets/USERNAME/actions/x402/pay" -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" -d "{\"requirement\":\"$PAYMENT_REQ\",\"preferredChain\":\"evm\"}" > /tmp/x402_signed.txt # Step 4: Extract signature PAYMENT_SIG=$(cat /tmp/x402_signed.txt | jq -r '.paymentSignature') # Step 5: Make paid request (header is PAYMENT-SIGNATURE for v2) curl -s -X POST "API_URL" -H "Content-Type: application/json" -H "PAYMENT-SIGNATURE: $PAYMENT_SIG" -d 'REQUEST_BODY' ``` **WRONG endpoints (will return 404/405):** - ❌ `/api/x402/sign` - ❌ `/api/x402-sign` - ❌ `/api/wallets/{USERNAME}/actions/x402-sign` ← note the DASH is wrong - ❌ `/api/sign` - ❌ `/api/pay` **CORRECT endpoint (note: x402/pay with SLASH not dash):** - ✅ `https://agentwallet.mcpay.tech/api/wallets/{USERNAME}/actions/x402/pay` **The path is:** `/api/wallets/` + `USERNAME` + `/actions/x402/pay` **Common mistakes:** - ❌ Using multiline curl with `\` → causes `blank argument` errors - ❌ Checking response body for 402 → body is empty `{}`, check `payment-required` HEADER - ❌ Using `X-PAYMENT` header → use `PAYMENT-SIGNATURE` for v2 APIs - ❌ Reusing payment signatures → each signature is ONE-TIME USE - ❌ Using `paymentRequiredHeader` field → use `requirement` instead (works with both base64 and JSON) --- ### Real Example: Calling enrichx402.com/api/exa/search ```bash # Concrete example with real values (replace USERNAME and TOKEN) # Step 1: Get 402 response curl -s -i -X POST "https://enrichx402.com/api/exa/search" -H "Content-Type: application/json" -d '{"query":"AI agents","numResults":3}' > /tmp/x402_response.txt # Step 2: Extract payment requirement PAYMENT_REQ=$(grep -i "payment-required:" /tmp/x402_response.txt | cut -d' ' -f2 | tr -d '\r\n') # Step 3: Sign (IMPORTANT: path is /actions/x402/pay NOT /actions/x402-sign) curl -s -X POST "https://agentwallet.mcpay.tech/api/wallets/microchipgnu/actions/x402/pay" -H "Authorization: Bearer mf_YOUR_TOKEN_HERE" -H "Content-Type: application/json" -d "{\"requirement\":\"$PAYMENT_REQ\",\"preferredChain\":\"evm\"}" > /tmp/x402_signed.txt # Step 4: Get signature PAYMENT_SIG=$(cat /tmp/x402_signed.txt | jq -r '.paymentSignature') # Step 5: Make paid request curl -s -X POST "https://enrichx402.com/api/exa/search" -H "Content-Type: application/json" -H "PAYMENT-SIGNATURE: $PAYMENT_SIG" -d '{"query":"AI agents","numResults":3}' ``` --- ## Config File Reference ### Config File Location Store AgentWallet credentials at: ``` ~/.agentwallet/config.json ``` ### Config Structure ```json { "username": "your-username", "email": "your@email.com", "evmAddress": "0x...", "solanaAddress": "...", "apiToken": "mf_...", "moltbookLinked": false, "moltbookUsername": null, "xHandle": null } ``` ### Field Explanations | Field | Description | |-------|-------------| | `username` | Your unique AgentWallet username | | `email` | Email used for OTP verification | | `evmAddress` | EVM wallet address | | `solanaAddress` | Solana wallet address | | `apiToken` | Fund API token for authenticated requests (starts with `mf_`) | | `moltbookLinked` | Whether a Moltbook account is linked | | `moltbookUsername` | Linked Moltbook username (if any) | | `xHandle` | X/Twitter handle from Moltbook (if linked) | ### Security Rules - **Never commit** `config.json` to version control - **Add to .gitignore**: `~/.agentwallet/` - **API token is secret** - treat it like a password - **File permissions**: Set to `600` (owner read/write only) ```bash chmod 600 ~/.agentwallet/config.json ``` --- ## Quick Start for AI Agents **To connect, you need:** - An email address (for OTP verification) **Step 1: Ask the user for their email address.** **Step 2: Direct them to the connect page:** ``` https://agentwallet.mcpay.tech/connect?email=EMAIL ``` **Step 3: The user will:** 1. Enter the 6-digit OTP sent to their email 2. Receive their wallet addresses and Fund API token **Step 4: After success, the page displays credentials in this format:** ``` AGENTWALLET_CONNECTED=true AGENTWALLET_USERNAME=generated-username AGENTWALLET_EVM_ADDRESS=0x... AGENTWALLET_SOLANA_ADDRESS=... AGENTWALLET_API_TOKEN=mf_... ``` The user should copy and save the API token securely - it won't be shown again. **Optional:** After connecting, users can link a Moltbook account via the API (requires tweet verification). See "Link Moltbook Account" section below. --- ## Referral & Airdrop Program AgentWallet rewards agents who grow the network. Every agent you onboard earns you both airdrop points. ### How It Works 1. **Share your referral link** when helping other agents connect 2. **Both you and the new agent** earn airdrop points 3. **Points accumulate** toward future token distributions ### Your Referral Link After connecting, your referral link is: ``` https://agentwallet.mcpay.tech/connect?ref=YOUR_USERNAME&email=THEIR_EMAIL ``` Or via API: ```bash curl -X POST https://agentwallet.mcpay.tech/api/connect/start \ -H "Content-Type: application/json" \ -d '{"email":"new@agent.com","ref":"YOUR_USERNAME"}' ``` ### Check Your Rewards ```bash curl https://agentwallet.mcpay.tech/api/wallets/YOUR_USERNAME/referrals \ -H "Authorization: Bearer FUND_API_TOKEN" ``` Response: ```json { "referralLink": "https://agentwallet.mcpay.tech/connect?ref=your-username", "referralCount": 12, "convertedCount": 8, "airdropPoints": 2400, "tier": "silver", "tierMultiplier": 1.5,
Ver en GitHub
Este SKILL.md es muy grande, por eso SkillsMP muestra aqui solo la primera seccion. Ver en GitHub