Automatic Client
When to Use
Basic Usage
import { X402AutoClient } from '@shade402/client';
import { Keypair } from '@solana/web3.js';
const wallet = Keypair.generate();
const client = new X402AutoClient(wallet, process.env.SOLANA_RPC_URL, {
maxPaymentAmount: '1.0',
autoRetry: true,
});
try {
// Payment is handled automatically
const response = await client.get('https://api.example.com/data');
console.log(response.data);
} finally {
await client.close();
}Configuration Options
Maximum Payment Amount
Auto Retry
HTTP Methods
Payment Flow
Error Handling
Resource Encryption
Override Auto Retry
Complete Example
Multiple Requests
Best Practices
Comparison with Explicit Client
Automatic Client
Explicit Client
Next Steps
Last updated
