@dexterai/x402 1.7.2 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,7 +70,7 @@ Quality-verified endpoints (score 75+) get promoted in search results. The verif
70
70
  npm install @dexterai/x402
71
71
  ```
72
72
 
73
- ### Client (Node.js) — NEW!
73
+ ### Client (Node.js)
74
74
 
75
75
  The simplest way to make x402 payments from scripts:
76
76
 
@@ -85,6 +85,20 @@ const x402Fetch = wrapFetch(fetch, {
85
85
  const response = await x402Fetch('https://api.example.com/protected');
86
86
  ```
87
87
 
88
+ Check the payment receipt:
89
+
90
+ ```typescript
91
+ import { wrapFetch, getPaymentReceipt } from '@dexterai/x402/client';
92
+
93
+ const x402Fetch = wrapFetch(fetch, { walletPrivateKey: process.env.SOLANA_PRIVATE_KEY });
94
+ const response = await x402Fetch('https://api.example.com/protected');
95
+
96
+ const receipt = getPaymentReceipt(response);
97
+ if (receipt) {
98
+ console.log('Paid:', receipt.transaction, 'on', receipt.network);
99
+ }
100
+ ```
101
+
88
102
  ### Client (Browser)
89
103
 
90
104
  ```typescript
@@ -152,12 +166,48 @@ function PayButton() {
152
166
 
153
167
  ## Supported Networks
154
168
 
155
- | Network | Identifier | Client | Server |
156
- |---------|------------|--------|--------|
157
- | Solana Mainnet | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | ✅ Verified | ✅ Verified |
158
- | Base Mainnet | `eip155:8453` | ✅ Verified | ✅ Verified |
169
+ All networks supported by the [Dexter facilitator](https://x402.dexter.cash/supported). USDC on every chain.
159
170
 
160
- All networks use USDC. Both client and server SDKs are production-tested with real payments.
171
+ **Mainnets:**
172
+
173
+ | Network | CAIP-2 | Status |
174
+ |---------|--------|--------|
175
+ | Solana | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | Production |
176
+ | Base | `eip155:8453` | Production |
177
+ | Polygon | `eip155:137` | Production |
178
+ | Arbitrum | `eip155:42161` | Production |
179
+ | Optimism | `eip155:10` | Production |
180
+ | Avalanche | `eip155:43114` | Production |
181
+ | SKALE Base | `eip155:1187947933` | Production (zero gas) |
182
+
183
+ **Testnets:**
184
+
185
+ | Network | CAIP-2 |
186
+ |---------|--------|
187
+ | Solana Devnet | `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1` |
188
+ | Base Sepolia | `eip155:84532` |
189
+ | SKALE Sepolia | `eip155:324705682` |
190
+
191
+ Accept payments on multiple chains simultaneously:
192
+
193
+ ```typescript
194
+ // Same address across EVM chains
195
+ app.get('/api/data', x402Middleware({
196
+ payTo: '0xYourAddress',
197
+ amount: '0.01',
198
+ network: ['eip155:8453', 'eip155:137', 'eip155:42161', 'eip155:10'],
199
+ }));
200
+
201
+ // Different addresses per chain family
202
+ app.get('/api/data', x402Middleware({
203
+ payTo: {
204
+ 'solana:*': 'YourSolanaAddress...',
205
+ 'eip155:*': '0xYourEvmAddress...',
206
+ },
207
+ amount: '0.01',
208
+ network: ['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', 'eip155:8453', 'eip155:137'],
209
+ }));
210
+ ```
161
211
 
162
212
  ---
163
213
 
@@ -530,6 +580,23 @@ tiktoken's default encoding works well for most transformer models. Only use a c
530
580
 
531
581
  ---
532
582
 
583
+ ## Sponsored Access (v1.7.2)
584
+
585
+ **Server middleware** accepts `sponsoredAccess: true` in its config. When enabled, it reads `extensions["sponsored-access"]` from the facilitator's settlement response and injects `_x402_sponsored` into the JSON response body so agents can see recommendations.
586
+
587
+ ```typescript
588
+ app.use(x402Middleware({
589
+ facilitatorUrl: "https://x402.dexter.cash",
590
+ sponsoredAccess: true, // opt-in to recommendation injection
591
+ }));
592
+ ```
593
+
594
+ **Client SDK** decodes the `PAYMENT-RESPONSE` header from x402 responses and attaches the full settlement receipt (including extensions) as `response._x402` for programmatic access.
595
+
596
+ **Types:** `SettleResponse` now includes an optional `extensions` field.
597
+
598
+ ---
599
+
533
600
  ## API Reference
534
601
 
535
602
  ### `createX402Client(options)`