Skip to content

feat: add x402 and payai skills (Solana + EVM agent payments) - #48

Open
notorious-d-e-v wants to merge 2 commits into
LeoYeAI:mainfrom
notorious-d-e-v:feat/add-solana-payai-x402-skills
Open

feat: add x402 and payai skills (Solana + EVM agent payments)#48
notorious-d-e-v wants to merge 2 commits into
LeoYeAI:mainfrom
notorious-d-e-v:feat/add-solana-payai-x402-skills

Conversation

@notorious-d-e-v

Copy link
Copy Markdown

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 sp3nd settles 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.

Skill What it does
skills/x402 The client skill. Detect an HTTP 402, build + sign a USDC payment on Solana (facilitator pays gas) or EVM (EIP-3009), retry with X-PAYMENT. Chain-agnostic, no SDK required.
skills/payai The network skill. Browse the PayAI Bazaar (/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 real 402 response (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

  • Each skill has a valid SKILL.md with name + description frontmatter (openclaw metadata included, matching the acp skill)
  • No hardcoded API keys or personal credentials (keys read from env)
  • Helper scripts tested against the live facilitator
  • Clear, useful purpose; cross-linked with the existing sp3nd skill
  • Only adds skills/x402/ and skills/payai/ β€” the auto-generated skill_index.md / README.md tables are left for the weekly tooling

Notes for reviewers

  • The skills reference the standard x402-fetch / x402-axios client libs and x402-express/-hono/-next server middlewares as the recommended path, and document the raw HTTP flow as a no-SDK fallback (guaranteed correct against the facilitator API).
  • Owner in _meta.json is set to PayAINetwork.

πŸ€– Generated with Claude Code

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.
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant