use-typescript-x402-core-avm

Implement x402 payment clients, resource servers, and facilitators on Algorand using TypeScript SDK packages.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/Rudhrakoushik10/RootNode --skill use-typescript-x402-core-avm-rudhrakoushik10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: use-typescript-x402-core-avm
Source: https://github.com/Rudhrakoushik10/RootNode/tree/main/projects/.opencode/skill/use-typescript-x402-core-avm
Command: npx skills add https://github.com/Rudhrakoushik10/RootNode --skill use-typescript-x402-core-avm-rudhrakoushik10

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @x402-avm/core, @x402-avm/avm, algosdk, @txnlab/use-wallet, and includes references (resource) components.

What problem does it solve? Building HTTP 402 payment-gated APIs on Algorand requires coordinating clients, resource servers, and facilitators with correct transaction group signing, fee abstraction, and payment verification. This Skill provides the patterns and API knowledge to wire up the @x402-avm/core and @x402-avm/avm packages correctly without trial and error. ## Core Features & Use Cases - Client Integration: Create an x402Client that automatically handles 402 responses, signs payment transactions, and retries requests with the X-PAYMENT header, including browser wallet support via @txnlab/use-wallet. - Resource Server & Facilitator Setup: Build transport-agnostic or HTTP route-based resource servers, plus facilitators that verify signatures, simulate atomic groups, and settle payments on-chain. - Fee Abstraction & Policies: Apply payment policies to filter requirements and use automatic fee abstraction through 2-transaction atomic groups with a fee payer. - Use Case: A developer wants to charge 0.10 USDC per call to a premium weather API on Algorand TestNet. This Skill guides them through registering the exact AVM scheme on a client, configuring a resource server route, and running a facilitator that settles each payment. ## Quick Start Ask the AI to create an x402 client on Algorand TestNet that pays for a protected API endpoint using a private key signer and the @x402-avm packages.

Frequently Asked Questions about use-typescript-x402-core-avm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an x402 payment client on Algorand with TypeScript?

Install @x402-avm/core, @x402-avm/avm, and algosdk, then construct an x402Client and call registerExactAvmScheme with a ClientAvmSigner. The client's fetch method automatically handles 402 responses by signing payment transactions and retrying with the X-PAYMENT header.

How to implement a facilitator that verifies and settles x402 payments?

Create an x402Facilitator and register the exact AVM scheme with a FacilitatorAvmSigner and supported networks. The signer must provide Algod client access, transaction simulation, group submission, and confirmation waiting; the facilitator then exposes verify and settle methods.

Does the x402-avm client work with browser wallets like Pera or Defly?

Yes, the ClientAvmSigner interface is compatible with @txnlab/use-wallet's signTransactions function. Wrap the wallet's activeAccount address and signTransactions method into a signer object and pass it to registerExactAvmScheme.

How does fee abstraction work in x402 Algorand payments?

Fee abstraction is automatic when PaymentRequirements include a feePayer. The scheme creates a 2-transaction atomic group where the payment has zero fee and a fee payer self-payment covers both fees; the facilitator validates and signs the fee payer transaction before submission.

Why do I get 'No scheme registered for network' errors?

This error occurs when registerExactAvmScheme was not called on the client, server, or facilitator before use. Always register the AVM scheme immediately after constructing the x402 component, and ensure the network CAIP-2 identifier matches.

What private key format does AVM_PRIVATE_KEY require?

AVM_PRIVATE_KEY must be a Base64-encoded 64-byte key consisting of a 32-byte Ed25519 seed plus a 32-byte public key. Derive the address with algosdk.encodeAddress(secretKey.slice(32)); a wrong length produces an 'Invalid key length' error.