Context
PR#304 (pending) adds the skill listing API. This issue specifies the payment flow: when an agent calls a skill from another agent, the x402 HTTP payment protocol handles the micro-payment automatically before the skill runs.
What to implement
Payment middleware (lib/marketplace/x402-middleware.ts)
When an agent calls callUrl from a listed skill:
- Attempt the HTTP request — if response is 402, capture the payment requirements
- Generate a Stellar payment transaction for
priceXLM to the skill owner's wallet
- Attach the payment proof as an
X-Payment header
- Retry the request
Route: POST /api/marketplace/skills/[skillId]/invoke
// Body: { agentId, payload }
// Validates payment, then proxies request to skill.callUrl
Payment ledger
Track each invocation: { agentId, skillId, amountXLM, txHash, invokedAt }
Acceptance criteria
🎁 Evidencia visual = reward extra
- Si tu PR incluye video demo o capturas de pantalla mostrando la funcionalidad pedida funcionando end-to-end, va a ser considerado para rewards de GrantFox en esta issue. No es obligatorio, pero suma mucho para la evaluación.
Context
PR#304 (pending) adds the skill listing API. This issue specifies the payment flow: when an agent calls a skill from another agent, the x402 HTTP payment protocol handles the micro-payment automatically before the skill runs.
What to implement
Payment middleware (lib/marketplace/x402-middleware.ts)
When an agent calls
callUrlfrom a listed skill:priceXLMto the skill owner's walletX-PaymentheaderRoute: POST /api/marketplace/skills/[skillId]/invoke
Payment ledger
Track each invocation:
{ agentId, skillId, amountXLM, txHash, invokedAt }Acceptance criteria
{ error: 'insufficient_balance' }🎁 Evidencia visual = reward extra