facinet 2.4.1 → 2.4.2

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
@@ -8,10 +8,10 @@ Make gasless USDC payments and manage facilitators on the x402 decentralized pay
8
8
 
9
9
  | Chain | Network ID | Chain ID | Gas Token | Explorer | API URL |
10
10
  |-------|-----------|----------|-----------|----------|---------|
11
- | Avalanche Fuji | `avalanche-fuji` | 43113 | AVAX | testnet.snowtrace.io | x402-avalanche-chi.vercel.app |
12
- | Ethereum Sepolia | `ethereum-sepolia` | 11155111 | ETH | sepolia.etherscan.io | x402-ethereum-chi.vercel.app |
13
- | Base Sepolia | `base-sepolia` | 84532 | ETH | sepolia.basescan.org | x402-base-chi.vercel.app |
14
- | Polygon Amoy | `polygon-amoy` | 80002 | MATIC | amoy.polygonscan.com | x402-polygon-chi.vercel.app |
11
+ | Avalanche Fuji | `avalanche-fuji` | 43113 | AVAX | testnet.snowtrace.io | facinet.vercel.app |
12
+ | Ethereum Sepolia | `ethereum-sepolia` | 11155111 | ETH | sepolia.etherscan.io | facinet.vercel.app |
13
+ | Base Sepolia | `base-sepolia` | 84532 | ETH | sepolia.basescan.org | facinet.vercel.app |
14
+ | Polygon Amoy | `polygon-amoy` | 80002 | MATIC | amoy.polygonscan.com | facinet.vercel.app |
15
15
 
16
16
  ## Installation
17
17
 
@@ -195,18 +195,15 @@ console.log('Networks:', networks);
195
195
 
196
196
  ```typescript
197
197
  interface FacinetConfig {
198
- apiUrl?: string; // Optional: Override API URL (auto-selected by network)
198
+ apiUrl?: string; // Optional: Override API URL (default: 'https://facinet.vercel.app')
199
199
  privateKey?: string; // For Node.js (not needed in browser)
200
200
  network?: 'avalanche-fuji' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy';
201
201
  rpcUrl?: string; // Custom RPC URL (optional)
202
202
  }
203
203
  ```
204
204
 
205
- **Network-specific API URLs** (automatically selected):
206
- - `avalanche-fuji` → `https://x402-avalanche-chi.vercel.app`
207
- - `ethereum-sepolia` → `https://x402-ethereum-chi.vercel.app`
208
- - `base-sepolia` → `https://x402-base-chi.vercel.app`
209
- - `polygon-amoy` → `https://x402-polygon-chi.vercel.app`
205
+ **Unified API URL** (used for all networks):
206
+ - All networks → `https://facinet.vercel.app`
210
207
 
211
208
  **Legacy aliases** are supported for backwards compatibility:
212
209
  - `'avalanche'` → `'avalanche-fuji'`
@@ -313,7 +310,7 @@ function PaymentButton() {
313
310
  ### How SDK Payments Work
314
311
 
315
312
  1. **Initialize SDK** - Create Facinet instance with your network choice
316
- 2. **Network Detection** - SDK automatically uses the correct API URL for your network
313
+ 2. **Unified API** - SDK uses the unified API endpoint (`facinet.vercel.app`) for all networks
317
314
  3. **Active Facilitator Selection** - SDK picks a random **active** facilitator **for your network**
318
315
  4. **Sign Authorization** - User signs ERC-3009 authorization (gasless!)
319
316
  5. **Facilitator Executes** - Selected facilitator submits transaction and pays gas
@@ -401,18 +398,18 @@ Facinet stores configuration in `~/.facinet/config.json`:
401
398
  "privateKey": "0x...",
402
399
  "address": "0x...",
403
400
  "network": "avalanche-fuji",
404
- "apiUrl": "https://x402-avalanche-chi.vercel.app"
401
+ "apiUrl": "https://facinet.vercel.app"
405
402
  }
406
403
  ```
407
404
 
408
- **Note**: The `apiUrl` is automatically set based on the `network` parameter. You can override it if needed.
405
+ **Note**: The `apiUrl` defaults to `https://facinet.vercel.app` for all networks. You can override it if needed.
409
406
 
410
407
  ## How It Works
411
408
 
412
409
  ### Network-Specific Facilitator Selection
413
410
 
414
411
  1. **Network Selection** - You specify a network (e.g., `'base-sepolia'`)
415
- 2. **API URL Selection** - SDK automatically uses the correct API endpoint for that network
412
+ 2. **Unified API** - SDK uses the unified API endpoint (`facinet.vercel.app`) for all networks
416
413
  3. **Facilitator Filtering** - SDK fetches facilitators and filters by:
417
414
  - Status: Must be `'active'`
418
415
  - Network: Must match your selected network (if facilitator has `network` property)
@@ -474,7 +471,7 @@ facinet-sdk/
474
471
  ## What's New in v2.4.0
475
472
 
476
473
  - **Network-Specific Facilitator Selection** - SDK automatically filters facilitators by network/chainId
477
- - **Network-Specific API URLs** - Each network uses its own API endpoint automatically
474
+ - **Unified API Endpoint** - All networks use the unified API endpoint (`facinet.vercel.app`)
478
475
  - **Enhanced Facilitator Filtering** - Only active facilitators for the selected network are returned
479
476
  - **Better Error Messages** - Error messages now include network information
480
477
  - **Facilitator Name Display** - Facilitator names are properly displayed in all results
package/dist/browser.js CHANGED
@@ -2715,12 +2715,7 @@ var FacinetSDK = (() => {
2715
2715
  "polygon": "polygon-amoy",
2716
2716
  "base": "base-sepolia"
2717
2717
  };
2718
- var NETWORK_API_URLS = {
2719
- "avalanche-fuji": "https://x402-avalanche-chi.vercel.app",
2720
- "ethereum-sepolia": "https://x402-ethereum-chi.vercel.app",
2721
- "base-sepolia": "https://x402-base-chi.vercel.app",
2722
- "polygon-amoy": "https://x402-polygon-chi.vercel.app"
2723
- };
2718
+ var DEFAULT_API_URL = "https://facinet.vercel.app";
2724
2719
  function resolveNetwork(network) {
2725
2720
  return NETWORK_ALIASES[network] || network;
2726
2721
  }
@@ -2728,8 +2723,7 @@ var FacinetSDK = (() => {
2728
2723
  if (customApiUrl) {
2729
2724
  return customApiUrl.replace(/\/$/, "");
2730
2725
  }
2731
- const resolvedNetwork = resolveNetwork(network);
2732
- return NETWORK_API_URLS[resolvedNetwork] || NETWORK_API_URLS["avalanche-fuji"];
2726
+ return DEFAULT_API_URL;
2733
2727
  }
2734
2728
  var Facinet = class _Facinet {
2735
2729
  constructor(config = {}) {