بنقرة واحدة
morph-x402
x402 HTTP payment protocol on Morph L2 — pay for and receive USDC payments for API resources
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
x402 HTTP payment protocol on Morph L2 — pay for and receive USDC payments for API resources
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
AI Agent skill for Morph L2 — wallet, explorer, DEX swap, cross-chain bridge with order management, EIP-8004 agent identity & reputation, alt-fee gas payment, EIP-7702 delegation, and x402 payment protocol
EIP-7702 EOA delegation on Morph L2 — batch calls and delegation management via tx type 0x04
EIP-8004 agent identity and reputation commands for Morph — register agents, query metadata, submit and read feedback
Alt-fee gas payment on Morph L2 — pay gas with alternative ERC20 tokens via tx type 0x7f
Cross-chain swap with JWT auth — quote prices, create orders, submit transactions, track order status across 6 chains
DEX swap execution on Morph L2 — quote and send swaps via Bulbaswap aggregator
| name | morph-x402 |
| version | 1.0.0 |
| description | x402 HTTP payment protocol on Morph L2 — pay for and receive USDC payments for API resources |
HTTP 402 payment protocol on Morph Mainnet (Chain ID: 2818). Agents can pay for protected resources with USDC (client) and receive payments for services they expose (merchant). All commands output JSON.
Use this skill when the user wants to: check x402 support, discover payment requirements for a URL, pay for an x402-protected resource, register as a merchant to receive payments, verify a payment signature, or settle a payment on-chain.
Decide the mode once via the root SKILL.md and docs/social-wallet-integration.md.
x402-pay and x402-register require --private-key for local signing.x402-discover, x402-supported, x402-verify, x402-settle, x402-server do NOT require a private key — they work with any wallet type.Paying for a resource (SLW payer):
1. Morph: x402-discover --url <url> → get payment requirements (amount, payTo, asset)
2. BGW: sign EIP-3009 TransferWithAuthorization using TEE
(pass the requirements from step 1 to BGW's signing flow)
3. Agent: construct PAYMENT-SIGNATURE header from the BGW signature
4. Agent: replay GET <url> with the header → receive paid content
Receiving payments (SLW merchant):
1. BGW: resolve wallet address
2. Morph: x402-register --private-key <local-key> --save --name <name>
(Note: registration requires a local key for EIP-191 signing.
If the agent only has a SLW, use BGW to sign the registration challenge,
then pass the JWT to Morph for API key creation — or use a separate local key.)
3. Morph: x402-server / x402-verify / x402-settle work with HMAC credentials only — no private key needed
The key insight: only the signing step needs BGW. All other x402 operations (discover, verify, settle, server) work without a private key.
pip install requests eth_account eth_abi eth_utils
# Run from repository root
python3 scripts/morph_api.py <command> [options]
No API keys required for client-side commands. Merchant-side commands require HMAC credentials from x402-register.
x402-supportedQuery the Morph Facilitator for supported payment schemes and networks.
python3 scripts/morph_api.py x402-supported
x402-discoverProbe a URL to check if it requires x402 payment. Does not pay.
python3 scripts/morph_api.py x402-discover --url https://api.example.com/resource
x402-payPay for an x402-protected resource with USDC. Default max payment: 1.0 USDC.
python3 scripts/morph_api.py x402-pay --url https://api.example.com/resource --private-key 0xKey
# Allow higher payments
python3 scripts/morph_api.py x402-pay --url https://api.example.com/resource --private-key 0xKey --max-payment 5.0
x402-registerRegister a wallet with the Facilitator to get HMAC credentials for merchant operations.
# Register and save credentials locally (encrypted)
python3 scripts/morph_api.py x402-register --private-key 0xKey --save --name myagent
# Register without saving (prints keys once)
python3 scripts/morph_api.py x402-register --private-key 0xKey
x402-verifyVerify a payment signature received from a payer. No on-chain action.
python3 scripts/morph_api.py x402-verify --payload '{"x402Version":2,...}' --requirements '{"scheme":"exact",...}' --name myagent
x402-settleSettle a verified payment on-chain (triggers USDC transfer from payer to merchant).
python3 scripts/morph_api.py x402-settle --payload '...' --requirements '...' --name myagent
x402-serverStart a local HTTP server with x402 payment protection. Supports dev mode (structural check, no real payments) and verified mode (Facilitator verify + settle).
# Dev mode (no HMAC credentials needed, structural check only)
python3 scripts/morph_api.py x402-server --pay-to 0xWalletAddr --price 0.001 --dev
# Verified mode (requires saved credentials)
python3 scripts/morph_api.py x402-server --pay-to 0xWalletAddr --price 0.001 --name myagent
# Custom port and path
python3 scripts/morph_api.py x402-server --pay-to 0xAddr --price 0.01 --port 9000 --path /api/data --name myagent
Endpoints served: /api/free (free, 200), <paid-path> (402 → verify payment → 200).
x402-pay enforces --max-payment (default 1.0 USDC). Amounts exceeding the limit are rejected before signing.x402-pay — show the amount, recipient, and URL.x402-register only shows secretKey on first creation. If --save is not used, the key is lost.isValidSignature for delegated accounts.0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B, 6 decimals, FiatTokenV2.2)https://morph-rails.morph.network/x402 — verifies signatures and settles on-chainreceiveWithAuthorization on USDC contract.MORPH-ACCESS-KEY / MORPH-ACCESS-SIGN / MORPH-ACCESS-TIMESTAMP headers~/.morph-agent/x402-credentials/Agent pays for a premium API:
x402-discover --url <url> (check price) → x402-pay --url <url> (sign and access)
Agent monetizes its service (full flow):
agent-register (morph-identity, get agent NFT)
→ x402-register --save --name myagent (get HMAC credentials, agentWallet = payTo)
→ x402-server --pay-to 0xWallet --price 0.001 --name myagent (expose paid HTTP endpoint)
→ other agents call: x402-discover → x402-pay (USDC auto-settles on-chain)
Quick local test (dev mode, no real payments):
x402-server --pay-to 0xAddr --price 0.001 --dev
→ x402-discover --url http://localhost:8402/api/resource
→ x402-pay --url http://localhost:8402/api/resource --private-key 0xTestKey
agent-register creates the agent identity; x402-register turns its wallet into a payment recipient. Together they enable agent monetization.token-balance --token USDC to check USDC balance before paying.7702-delegate first.