feat: add x402 and payai skills (Solana + EVM agent payments) - #48
Open
notorious-d-e-v wants to merge 2 commits into
Open
feat: add x402 and payai skills (Solana + EVM agent payments)#48notorious-d-e-v wants to merge 2 commits into
notorious-d-e-v wants to merge 2 commits into
Conversation
Adds two complementary skills that let an OpenClaw agent pay for and sell services over the x402 protocol, with first-class Solana support. - skills/x402: the client skill β detect an HTTP 402, build/sign a USDC payment on Solana (facilitator pays gas) or EVM (EIP-3009), and retry with X-PAYMENT. Includes a zero-dep inspect-402.mjs helper. - skills/payai: the network skill β browse the PayAI Bazaar (/discovery/resources), use the multi-chain facilitator (/supported, /verify, /settle), and monetize your own endpoints. Includes a zero-dep discover.mjs helper. Both helpers are verified against the live PayAI facilitator. Complements the existing sp3nd skill, which already settles via the PayAI facilitator on Solana.
6 tasks
The prior version documented only the v1 wire format (X-PAYMENT / X-PAYMENT-RESPONSE). x402 v2 changes the headers, network format, packages, and payload envelope. Both skills now cover v1 and v2: - Add a v1-vs-v2 table: PAYMENT-REQUIRED / PAYMENT-SIGNATURE / PAYMENT-RESPONSE headers, CAIP-2 networks (eip155:*, solana:<genesis>), @x402/* packages. - Client (Option A): show the v2 builder pattern (x402Client + register ExactEvmScheme/ExactSvmScheme via @x402/fetch); keep v1 as legacy. Correct a bug: the payer does not pass a facilitator URL β the seller settles. - Manual flow: scope it explicitly to the v1 format (still accepted by the facilitator) and add a note that v2 Solana needs the resource/accepted/payload envelope + a Memo instruction (nonce/replay protection) β use @x402/svm. - payai: mark discovery items' per-item x402Version; v2 seller middleware (@x402/express) + the @x402/extensions/bazaar declareDiscoveryExtension() requirement for Bazaar discoverability. Grounded in x402-foundation/x402 docs (migration-v1-to-v2, http-402, scheme_exact_svm) and the live PayAI facilitator (both v1 and v2 supported).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two complementary skills that let an OpenClaw agent pay for and sell services over the x402 protocol, with first-class Solana support alongside EVM. This fills a gap in the collection: today
sp3ndsettles x402 payments through the PayAI facilitator on Solana, but there's no general skill for paying any 402-gated resource or for discovering paid agent services.skills/x402HTTP 402, build + sign a USDC payment on Solana (facilitator pays gas) or EVM (EIP-3009), retry withX-PAYMENT. Chain-agnostic, no SDK required.skills/payai/discovery/resources), use the multi-chain facilitator (/supported,/verify,/settle), and monetize your own endpoints as x402 resources.Each skill ships
SKILL.md+README.md+_meta.json+ a zero-dependency helper script (Node 18+).Verified against live infrastructure
Both helper scripts were run against the live PayAI facilitator before submitting:
payai/scripts/discover.mjsβ lists live Bazaar resources, filters by network (--network solana) and keyword, renders human-readable USDC amounts.x402/scripts/inspect-402.mjsβ safely decodes the payment requirements of a real402response (network, asset, amount,payTo, Solana fee payer) without spending.The supported-networks table and code examples are grounded in
GET https://facilitator.payai.network/supported(Solana mainnet/devnet + 9 EVM chains).Checklist
SKILL.mdwithname+descriptionfrontmatter (openclawmetadataincluded, matching theacpskill)sp3ndskillskills/x402/andskills/payai/β the auto-generatedskill_index.md/README.mdtables are left for the weekly toolingNotes for reviewers
x402-fetch/x402-axiosclient libs andx402-express/-hono/-nextserver middlewares as the recommended path, and document the raw HTTP flow as a no-SDK fallback (guaranteed correct against the facilitator API)._meta.jsonis set toPayAINetwork.π€ Generated with Claude Code